From 4e7c86a4abf002b051e1e57af839dd61e4d29cbe Mon Sep 17 00:00:00 2001 From: ntwbvdbl-oe Date: Thu, 25 Apr 2024 14:21:51 +0800 Subject: [PATCH] webgl: Fix errors on some glUniform calls with memory size over 2GiB in WebGL2 (#21819) In #21445, temporary buffers were appropriately included in dependencies. But in the following #21462 they were overlooked, resulting in errors on certain GL calls when memory size exceeded 2GiB in WebGL2. This pull request aims to fix this issue. --- src/library_webgl.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/library_webgl.js b/src/library_webgl.js index 2f9e1fd7fed84..b28040859e14c 100644 --- a/src/library_webgl.js +++ b/src/library_webgl.js @@ -2412,7 +2412,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; }, glUniform1iv__deps: ['$webglGetUniformLocation' -#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1 +#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLIntBuffers' #endif ], @@ -2453,7 +2453,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; }, glUniform2iv__deps: ['$webglGetUniformLocation' -#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1 +#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLIntBuffers' #endif ], @@ -2495,7 +2495,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; }, glUniform3iv__deps: ['$webglGetUniformLocation' -#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1 +#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLIntBuffers' #endif ], @@ -2538,7 +2538,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; }, glUniform4iv__deps: ['$webglGetUniformLocation' -#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1 +#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLIntBuffers' #endif ], @@ -2582,7 +2582,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; }, glUniform1fv__deps: ['$webglGetUniformLocation' -#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1 +#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLFloatBuffers' #endif ], @@ -2623,7 +2623,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; }, glUniform2fv__deps: ['$webglGetUniformLocation' -#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1 +#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLFloatBuffers' #endif ], @@ -2665,7 +2665,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; }, glUniform3fv__deps: ['$webglGetUniformLocation' -#if GL_POOL_TEMP_BUFFERS && !(MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS) +#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLFloatBuffers' #endif ], @@ -2708,7 +2708,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; }, glUniform4fv__deps: ['$webglGetUniformLocation' -#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1 +#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLFloatBuffers' #endif ], @@ -2756,7 +2756,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; }, glUniformMatrix2fv__deps: ['$webglGetUniformLocation' -#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1 +#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLFloatBuffers' #endif ], @@ -2800,7 +2800,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; }, glUniformMatrix3fv__deps: ['$webglGetUniformLocation' -#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1 +#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLFloatBuffers' #endif ], @@ -2849,7 +2849,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}}; }, glUniformMatrix4fv__deps: ['$webglGetUniformLocation' -#if GL_POOL_TEMP_BUFFERS && !(MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS) +#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLFloatBuffers' #endif ],