From 1d01acb486dc36ce3b42abf74646f3e23002ca03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Tue, 14 Jun 2022 11:43:58 +0200 Subject: [PATCH] Fix issues with unsigned types in GL ES 3 shader class --- drivers/gles3/shader_gles3.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gles3/shader_gles3.cpp b/drivers/gles3/shader_gles3.cpp index d781f3dd031..2aae6c11161 100644 --- a/drivers/gles3/shader_gles3.cpp +++ b/drivers/gles3/shader_gles3.cpp @@ -242,7 +242,8 @@ bool ShaderGLES3::_process_program_state(Version *p_version, bool p_async_forbid case Version::COMPILE_STATUS_SOURCE_PROVIDED: { uint32_t start_compiles_count = p_async_forbidden ? 2 : 0; if (!start_compiles_count) { - uint32_t free_async_slots = MAX(0, MIN(max_simultaneous_compiles - active_compiles_count, max_simultaneous_compiles - *compiles_started_this_frame)); + uint32_t used_async_slots = MAX(active_compiles_count, *compiles_started_this_frame); + uint32_t free_async_slots = used_async_slots < active_compiles_count ? active_compiles_count - used_async_slots : 0; start_compiles_count = MIN(2, free_async_slots); } if (start_compiles_count >= 1) {