Skip to content

Commit 4e7c86a

Browse files
authored
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.
1 parent a506124 commit 4e7c86a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/library_webgl.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,7 +2412,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
24122412
},
24132413

24142414
glUniform1iv__deps: ['$webglGetUniformLocation'
2415-
#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1
2415+
#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS)
24162416
, '$miniTempWebGLIntBuffers'
24172417
#endif
24182418
],
@@ -2453,7 +2453,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
24532453
},
24542454

24552455
glUniform2iv__deps: ['$webglGetUniformLocation'
2456-
#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1
2456+
#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS)
24572457
, '$miniTempWebGLIntBuffers'
24582458
#endif
24592459
],
@@ -2495,7 +2495,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
24952495
},
24962496

24972497
glUniform3iv__deps: ['$webglGetUniformLocation'
2498-
#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1
2498+
#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS)
24992499
, '$miniTempWebGLIntBuffers'
25002500
#endif
25012501
],
@@ -2538,7 +2538,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
25382538
},
25392539

25402540
glUniform4iv__deps: ['$webglGetUniformLocation'
2541-
#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1
2541+
#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS)
25422542
, '$miniTempWebGLIntBuffers'
25432543
#endif
25442544
],
@@ -2582,7 +2582,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
25822582
},
25832583

25842584
glUniform1fv__deps: ['$webglGetUniformLocation'
2585-
#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1
2585+
#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS)
25862586
, '$miniTempWebGLFloatBuffers'
25872587
#endif
25882588
],
@@ -2623,7 +2623,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
26232623
},
26242624

26252625
glUniform2fv__deps: ['$webglGetUniformLocation'
2626-
#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1
2626+
#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS)
26272627
, '$miniTempWebGLFloatBuffers'
26282628
#endif
26292629
],
@@ -2665,7 +2665,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
26652665
},
26662666

26672667
glUniform3fv__deps: ['$webglGetUniformLocation'
2668-
#if GL_POOL_TEMP_BUFFERS && !(MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS)
2668+
#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS)
26692669
, '$miniTempWebGLFloatBuffers'
26702670
#endif
26712671
],
@@ -2708,7 +2708,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
27082708
},
27092709

27102710
glUniform4fv__deps: ['$webglGetUniformLocation'
2711-
#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1
2711+
#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS)
27122712
, '$miniTempWebGLFloatBuffers'
27132713
#endif
27142714
],
@@ -2756,7 +2756,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
27562756
},
27572757

27582758
glUniformMatrix2fv__deps: ['$webglGetUniformLocation'
2759-
#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1
2759+
#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS)
27602760
, '$miniTempWebGLFloatBuffers'
27612761
#endif
27622762
],
@@ -2800,7 +2800,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
28002800
},
28012801

28022802
glUniformMatrix3fv__deps: ['$webglGetUniformLocation'
2803-
#if GL_POOL_TEMP_BUFFERS && MIN_WEBGL_VERSION == 1
2803+
#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS)
28042804
, '$miniTempWebGLFloatBuffers'
28052805
#endif
28062806
],
@@ -2849,7 +2849,7 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
28492849
},
28502850

28512851
glUniformMatrix4fv__deps: ['$webglGetUniformLocation'
2852-
#if GL_POOL_TEMP_BUFFERS && !(MIN_WEBGL_VERSION >= 2 && WEBGL_USE_GARBAGE_FREE_APIS)
2852+
#if GL_POOL_TEMP_BUFFERS && (MIN_WEBGL_VERSION == 1 || !WEBGL_USE_GARBAGE_FREE_APIS)
28532853
, '$miniTempWebGLFloatBuffers'
28542854
#endif
28552855
],

0 commit comments

Comments
 (0)