From 2329478db5fe36f3424f84dd5e41e93f8b9ee6fa Mon Sep 17 00:00:00 2001 From: Minhao Lu Date: Wed, 24 Apr 2024 14:56:41 +0800 Subject: [PATCH] webgl: Fix errors on some glUniform calls with memory size over 2GiB in WebGL2 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 | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/library_webgl.js b/src/library_webgl.js index 2f9e1fd7fed8..513e883117d0 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 >= 2 && 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 >= 2 && 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 >= 2 && 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 >= 2 && 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 >= 2 && 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 >= 2 && 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 >= 2 && 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 >= 2 && 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 >= 2 && WEBGL_USE_GARBAGE_FREE_APIS) , '$miniTempWebGLFloatBuffers' #endif ],