Skip to content

Commit 4c66a6e

Browse files
committed
Fix remaining webgl + CAN_ADDRESS_2GB issues
1 parent 833448b commit 4c66a6e

File tree

5 files changed

+61
-48
lines changed

5 files changed

+61
-48
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,8 @@ jobs:
819819
browser_2gb.test_cubegeom*
820820
browser_2gb.test_html5_webgl_create_context*
821821
browser_2gb.test_main_thread_async_em_asm
822+
browser_2gb.test_webgl2_*
823+
browser_2gb.test_webgl_*
822824
"
823825
test-browser-chrome-wasm64-4gb:
824826
executor: bionic

src/library_webgl.js

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,12 +2459,12 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
24592459
#if GL_ASSERTIONS
24602460
assert(GL.currentContext.version >= 2);
24612461
#endif
2462-
count && GLctx.uniform1iv(webglGetUniformLocation(location), HEAP32, value>>2, count);
2462+
count && GLctx.uniform1iv(webglGetUniformLocation(location), HEAP32, {{{ getHeapOffset('value', 'float') }}}, count);
24632463
#else
24642464

24652465
#if MAX_WEBGL_VERSION >= 2
24662466
if ({{{ isCurrentContextWebGL2() }}}) { // WebGL 2 provides new garbage-free entry points to call to WebGL. Use those always when possible.
2467-
count && GLctx.uniform1iv(webglGetUniformLocation(location), HEAP32, value>>2, count);
2467+
count && GLctx.uniform1iv(webglGetUniformLocation(location), HEAP32, {{{ getHeapOffset('value', 'float') }}}, count);
24682468
return;
24692469
}
24702470
#endif
@@ -2500,12 +2500,12 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
25002500
#if GL_ASSERTIONS
25012501
assert(GL.currentContext.version >= 2);
25022502
#endif
2503-
count && GLctx.uniform2iv(webglGetUniformLocation(location), HEAP32, value>>2, count*2);
2503+
count && GLctx.uniform2iv(webglGetUniformLocation(location), HEAP32, {{{ getHeapOffset('value', 'float') }}}, count*2);
25042504
#else
25052505

25062506
#if MAX_WEBGL_VERSION >= 2
25072507
if ({{{ isCurrentContextWebGL2() }}}) { // WebGL 2 provides new garbage-free entry points to call to WebGL. Use those always when possible.
2508-
count && GLctx.uniform2iv(webglGetUniformLocation(location), HEAP32, value>>2, count*2);
2508+
count && GLctx.uniform2iv(webglGetUniformLocation(location), HEAP32, {{{ getHeapOffset('value', 'float') }}}, count*2);
25092509
return;
25102510
}
25112511
#endif
@@ -2542,12 +2542,12 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
25422542
#if GL_ASSERTIONS
25432543
assert(GL.currentContext.version >= 2);
25442544
#endif
2545-
count && GLctx.uniform3iv(webglGetUniformLocation(location), HEAP32, value>>2, count*3);
2545+
count && GLctx.uniform3iv(webglGetUniformLocation(location), HEAP32, {{{ getHeapOffset('value', 'float') }}}, count*3);
25462546
#else
25472547

25482548
#if MAX_WEBGL_VERSION >= 2
25492549
if ({{{ isCurrentContextWebGL2() }}}) { // WebGL 2 provides new garbage-free entry points to call to WebGL. Use those always when possible.
2550-
count && GLctx.uniform3iv(webglGetUniformLocation(location), HEAP32, value>>2, count*3);
2550+
count && GLctx.uniform3iv(webglGetUniformLocation(location), HEAP32, {{{ getHeapOffset('value', 'float') }}}, count*3);
25512551
return;
25522552
}
25532553
#endif
@@ -2585,14 +2585,14 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
25852585
#if GL_ASSERTIONS
25862586
assert(GL.currentContext.version >= 2);
25872587
#endif
2588-
count && GLctx.uniform4iv(webglGetUniformLocation(location), HEAP32, value>>2, count*4);
2588+
count && GLctx.uniform4iv(webglGetUniformLocation(location), HEAP32, {{{ getHeapOffset('value', 'float') }}}, count*4);
25892589
#else
25902590

25912591
#if MAX_WEBGL_VERSION >= 2
25922592
// WebGL 2 provides new garbage-free entry points to call to WebGL. Use
25932593
// those always when possible.
25942594
if ({{{ isCurrentContextWebGL2() }}}) {
2595-
count && GLctx.uniform4iv(webglGetUniformLocation(location), HEAP32, value>>2, count*4);
2595+
count && GLctx.uniform4iv(webglGetUniformLocation(location), HEAP32, {{{ getHeapOffset('value', 'float') }}}, count*4);
25962596
return;
25972597
}
25982598
#endif
@@ -2631,12 +2631,12 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
26312631
#if GL_ASSERTIONS
26322632
assert(GL.currentContext.version >= 2);
26332633
#endif
2634-
count && GLctx.uniform1fv(webglGetUniformLocation(location), HEAPF32, value>>2, count);
2634+
count && GLctx.uniform1fv(webglGetUniformLocation(location), HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count);
26352635
#else
26362636

26372637
#if MAX_WEBGL_VERSION >= 2
26382638
if ({{{ isCurrentContextWebGL2() }}}) { // WebGL 2 provides new garbage-free entry points to call to WebGL. Use those always when possible.
2639-
count && GLctx.uniform1fv(webglGetUniformLocation(location), HEAPF32, value>>2, count);
2639+
count && GLctx.uniform1fv(webglGetUniformLocation(location), HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count);
26402640
return;
26412641
}
26422642
#endif
@@ -2672,14 +2672,14 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
26722672
#if GL_ASSERTIONS
26732673
assert(GL.currentContext.version >= 2);
26742674
#endif
2675-
count && GLctx.uniform2fv(webglGetUniformLocation(location), HEAPF32, value>>2, count*2);
2675+
count && GLctx.uniform2fv(webglGetUniformLocation(location), HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*2);
26762676
#else
26772677

26782678
#if MAX_WEBGL_VERSION >= 2
26792679
// WebGL 2 provides new garbage-free entry points to call to WebGL. Use
26802680
// those always when possible.
26812681
if ({{{ isCurrentContextWebGL2() }}}) {
2682-
count && GLctx.uniform2fv(webglGetUniformLocation(location), HEAPF32, value>>2, count*2);
2682+
count && GLctx.uniform2fv(webglGetUniformLocation(location), HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*2);
26832683
return;
26842684
}
26852685
#endif
@@ -2709,21 +2709,21 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
27092709
glUniform3fv: (location, count, value) => {
27102710
#if GL_ASSERTIONS
27112711
GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform3fv', 'location');
2712-
assert((value & 3) == 0, 'Pointer to float data passed to glUniform3fv must be aligned to four bytes!' + value);
2712+
assert((value % 4) == 0, 'Pointer to float data passed to glUniform3fv must be aligned to four bytes!' + value);
27132713
#endif
27142714

27152715
#if MIN_WEBGL_VERSION >= 2
27162716
#if GL_ASSERTIONS
27172717
assert(GL.currentContext.version >= 2);
27182718
#endif
2719-
count && GLctx.uniform3fv(webglGetUniformLocation(location), HEAPF32, value>>2, count*3);
2719+
count && GLctx.uniform3fv(webglGetUniformLocation(location), HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*3);
27202720
#else
27212721

27222722
#if MAX_WEBGL_VERSION >= 2
27232723
// WebGL 2 provides new garbage-free entry points to call to WebGL. Use
27242724
// those always when possible.
27252725
if ({{{ isCurrentContextWebGL2() }}}) {
2726-
count && GLctx.uniform3fv(webglGetUniformLocation(location), HEAPF32, value>>2, count*3);
2726+
count && GLctx.uniform3fv(webglGetUniformLocation(location), HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*3);
27272727
return;
27282728
}
27292729
#endif
@@ -2761,14 +2761,14 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
27612761
#if GL_ASSERTIONS
27622762
assert(GL.currentContext.version >= 2);
27632763
#endif
2764-
count && GLctx.uniform4fv(webglGetUniformLocation(location), HEAPF32, value>>2, count*4);
2764+
count && GLctx.uniform4fv(webglGetUniformLocation(location), HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*4);
27652765
#else
27662766

27672767
#if MAX_WEBGL_VERSION >= 2
27682768
// WebGL 2 provides new garbage-free entry points to call to WebGL. Use
27692769
// those always when possible.
27702770
if ({{{ isCurrentContextWebGL2() }}}) {
2771-
count && GLctx.uniform4fv(webglGetUniformLocation(location), HEAPF32, value>>2, count*4);
2771+
count && GLctx.uniform4fv(webglGetUniformLocation(location), HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*4);
27722772
return;
27732773
}
27742774
#endif
@@ -2811,14 +2811,14 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
28112811
#if GL_ASSERTIONS
28122812
assert(GL.currentContext.version >= 2);
28132813
#endif
2814-
count && GLctx.uniformMatrix2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value>>2, count*4);
2814+
count && GLctx.uniformMatrix2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*4);
28152815
#else
28162816

28172817
#if MAX_WEBGL_VERSION >= 2
28182818
// WebGL 2 provides new garbage-free entry points to call to WebGL. Use
28192819
// those always when possible.
28202820
if ({{{ isCurrentContextWebGL2() }}}) {
2821-
count && GLctx.uniformMatrix2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value>>2, count*4);
2821+
count && GLctx.uniformMatrix2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*4);
28222822
return;
28232823
}
28242824
#endif
@@ -2857,14 +2857,14 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
28572857
#if GL_ASSERTIONS
28582858
assert(GL.currentContext.version >= 2);
28592859
#endif
2860-
count && GLctx.uniformMatrix3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value>>2, count*9);
2860+
count && GLctx.uniformMatrix3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*9);
28612861
#else
28622862

28632863
#if MAX_WEBGL_VERSION >= 2
28642864
// WebGL 2 provides new garbage-free entry points to call to WebGL. Use
28652865
// those always when possible.
28662866
if ({{{ isCurrentContextWebGL2() }}}) {
2867-
count && GLctx.uniformMatrix3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value>>2, count*9);
2867+
count && GLctx.uniformMatrix3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*9);
28682868
return;
28692869
}
28702870
#endif
@@ -3966,9 +3966,9 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
39663966
GLctx.multiDrawWebgl['multiDrawArraysWEBGL'](
39673967
mode,
39683968
HEAP32,
3969-
firsts >> 2,
3969+
{{{ getHeapOffset('firsts', 'i32') }}},
39703970
HEAP32,
3971-
counts >> 2,
3971+
{{{ getHeapOffset('counts', 'i32') }}},
39723972
drawcount);
39733973
},
39743974

@@ -3978,11 +3978,11 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
39783978
GLctx.multiDrawWebgl['multiDrawArraysInstancedWEBGL'](
39793979
mode,
39803980
HEAP32,
3981-
firsts >> 2,
3981+
{{{ getHeapOffset('firsts', 'i32') }}},
39823982
HEAP32,
3983-
counts >> 2,
3983+
{{{ getHeapOffset('counts', 'i32') }}},
39843984
HEAP32,
3985-
instanceCounts >> 2,
3985+
{{{ getHeapOffset('instanceCounts', 'float') }}},
39863986
drawcount);
39873987
},
39883988

@@ -4017,10 +4017,10 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
40174017
GLctx.multiDrawWebgl['multiDrawElementsWEBGL'](
40184018
mode,
40194019
HEAP32,
4020-
counts >> 2,
4020+
{{{ getHeapOffset('counts', 'float') }}},
40214021
type,
40224022
HEAP32,
4023-
offsets >> 2,
4023+
{{{ getHeapOffset('offsets', 'float') }}},
40244024
drawcount);
40254025
#if MEMORY64
40264026
stackRestore(stack);
@@ -4040,12 +4040,12 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
40404040
GLctx.multiDrawWebgl['multiDrawElementsInstancedWEBGL'](
40414041
mode,
40424042
HEAP32,
4043-
counts >> 2,
4043+
{{{ getHeapOffset('counts', 'float') }}},
40444044
type,
40454045
HEAP32,
4046-
offsets >> 2,
4046+
{{{ getHeapOffset('offsets', 'float') }}},
40474047
HEAP32,
4048-
instanceCounts >> 2,
4048+
{{{ getHeapOffset('instanceCounts', 'float') }}},
40494049
drawcount);
40504050
#if MEMORY64
40514051
stackRestore(stack);

src/library_webgl2.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -622,23 +622,23 @@ var LibraryWebGL2 = {
622622
assert((value & 3) == 0, 'Pointer to integer data passed to glClearBufferiv must be aligned to four bytes!');
623623
#endif
624624

625-
GLctx.clearBufferiv(buffer, drawbuffer, HEAP32, value>>2);
625+
GLctx.clearBufferiv(buffer, drawbuffer, HEAP32, {{{ getHeapOffset('value', 'float') }}});
626626
},
627627

628628
glClearBufferuiv: (buffer, drawbuffer, value) => {
629629
#if GL_ASSERTIONS
630630
assert((value & 3) == 0, 'Pointer to integer data passed to glClearBufferuiv must be aligned to four bytes!');
631631
#endif
632632

633-
GLctx.clearBufferuiv(buffer, drawbuffer, HEAPU32, value>>2);
633+
GLctx.clearBufferuiv(buffer, drawbuffer, HEAPU32, {{{ getHeapOffset('value', 'float') }}});
634634
},
635635

636636
glClearBufferfv: (buffer, drawbuffer, value) => {
637637
#if GL_ASSERTIONS
638638
assert((value & 3) == 0, 'Pointer to float data passed to glClearBufferfv must be aligned to four bytes!');
639639
#endif
640640

641-
GLctx.clearBufferfv(buffer, drawbuffer, HEAPF32, value>>2);
641+
GLctx.clearBufferfv(buffer, drawbuffer, HEAPF32, {{{ getHeapOffset('value', 'float') }}});
642642
},
643643

644644
glFenceSync: (condition, flags) => {
@@ -776,7 +776,7 @@ var LibraryWebGL2 = {
776776
GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform1uiv', 'location');
777777
assert((value & 3) == 0, 'Pointer to integer data passed to glUniform1uiv must be aligned to four bytes!');
778778
#endif
779-
count && GLctx.uniform1uiv(webglGetUniformLocation(location), HEAPU32, value>>2, count);
779+
count && GLctx.uniform1uiv(webglGetUniformLocation(location), HEAPU32, {{{ getHeapOffset('value', 'float') }}}, count);
780780
},
781781

782782
glUniform2uiv__deps: ['$webglGetUniformLocation'],
@@ -785,7 +785,7 @@ var LibraryWebGL2 = {
785785
GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform2uiv', 'location');
786786
assert((value & 3) == 0, 'Pointer to integer data passed to glUniform2uiv must be aligned to four bytes!');
787787
#endif
788-
count && GLctx.uniform2uiv(webglGetUniformLocation(location), HEAPU32, value>>2, count*2);
788+
count && GLctx.uniform2uiv(webglGetUniformLocation(location), HEAPU32, {{{ getHeapOffset('value', 'float') }}}, count*2);
789789
},
790790

791791
glUniform3uiv__deps: ['$webglGetUniformLocation'],
@@ -794,7 +794,7 @@ var LibraryWebGL2 = {
794794
GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform3uiv', 'location');
795795
assert((value & 3) == 0, 'Pointer to integer data passed to glUniform3uiv must be aligned to four bytes!');
796796
#endif
797-
count && GLctx.uniform3uiv(webglGetUniformLocation(location), HEAPU32, value>>2, count*3);
797+
count && GLctx.uniform3uiv(webglGetUniformLocation(location), HEAPU32, {{{ getHeapOffset('value', 'float') }}}, count*3);
798798
},
799799

800800
glUniform4uiv__deps: ['$webglGetUniformLocation'],
@@ -803,7 +803,7 @@ var LibraryWebGL2 = {
803803
GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniform4uiv', 'location');
804804
assert((value & 3) == 0, 'Pointer to integer data passed to glUniform4uiv must be aligned to four bytes!');
805805
#endif
806-
count && GLctx.uniform4uiv(webglGetUniformLocation(location), HEAPU32, value>>2, count*4);
806+
count && GLctx.uniform4uiv(webglGetUniformLocation(location), HEAPU32, {{{ getHeapOffset('value', 'float') }}}, count*4);
807807
},
808808

809809
glUniformMatrix2x3fv__deps: ['$webglGetUniformLocation'],
@@ -812,7 +812,7 @@ var LibraryWebGL2 = {
812812
GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix2x3fv', 'location');
813813
assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix2x3fv must be aligned to four bytes!');
814814
#endif
815-
count && GLctx.uniformMatrix2x3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value>>2, count*6);
815+
count && GLctx.uniformMatrix2x3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*6);
816816
},
817817

818818
glUniformMatrix3x2fv__deps: ['$webglGetUniformLocation'],
@@ -821,7 +821,7 @@ var LibraryWebGL2 = {
821821
GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix3x2fv', 'location');
822822
assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix3x2fv must be aligned to four bytes!');
823823
#endif
824-
count && GLctx.uniformMatrix3x2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value>>2, count*6);
824+
count && GLctx.uniformMatrix3x2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*6);
825825
},
826826

827827
glUniformMatrix2x4fv__deps: ['$webglGetUniformLocation'],
@@ -830,7 +830,7 @@ var LibraryWebGL2 = {
830830
GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix2x4fv', 'location');
831831
assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix2x4fv must be aligned to four bytes!');
832832
#endif
833-
count && GLctx.uniformMatrix2x4fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value>>2, count*8);
833+
count && GLctx.uniformMatrix2x4fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*8);
834834
},
835835

836836
glUniformMatrix4x2fv__deps: ['$webglGetUniformLocation'],
@@ -839,7 +839,7 @@ var LibraryWebGL2 = {
839839
GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix4x2fv', 'location');
840840
assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix4x2fv must be aligned to four bytes!');
841841
#endif
842-
count && GLctx.uniformMatrix4x2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value>>2, count*8);
842+
count && GLctx.uniformMatrix4x2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*8);
843843
},
844844

845845
glUniformMatrix3x4fv__deps: ['$webglGetUniformLocation'],
@@ -848,7 +848,7 @@ var LibraryWebGL2 = {
848848
GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix3x4fv', 'location');
849849
assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix3x4fv must be aligned to four bytes!');
850850
#endif
851-
count && GLctx.uniformMatrix3x4fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value>>2, count*12);
851+
count && GLctx.uniformMatrix3x4fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*12);
852852
},
853853

854854
glUniformMatrix4x3fv__deps: ['$webglGetUniformLocation'],
@@ -857,7 +857,7 @@ var LibraryWebGL2 = {
857857
GL.validateGLObjectID(GLctx.currentProgram.uniformLocsById, location, 'glUniformMatrix4x3fv', 'location');
858858
assert((value & 3) == 0, 'Pointer to float data passed to glUniformMatrix4x3fv must be aligned to four bytes!');
859859
#endif
860-
count && GLctx.uniformMatrix4x3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value>>2, count*12);
860+
count && GLctx.uniformMatrix4x3fv(webglGetUniformLocation(location), !!transpose, HEAPF32, {{{ getHeapOffset('value', 'float') }}}, count*12);
861861
},
862862

863863
glVertexAttribI4iv: (index, v) => {

test/browser/webgl2_garbage_free_entrypoints.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,14 @@ int main(int argc, char *argv[])
5656
assert(glGetError() == GL_NO_ERROR && "Shader program link failed");
5757

5858
int color_loc = glGetUniformLocation(program, "color");
59+
assert(glGetError() == GL_NO_ERROR);
5960
assert(color_loc != -1);
6061

6162
glUseProgram(program);
63+
assert(glGetError() == GL_NO_ERROR);
6264
float col[3] = { 0.2f, 0.2f, 0.2f };
6365
glUniform3fv(color_loc, 1, col);
66+
assert(glGetError() == GL_NO_ERROR);
6467

6568
int loc2 = glGetUniformLocation(program, "colors[2]");
6669
int loc = glGetUniformLocation(program, "colors");
@@ -75,7 +78,10 @@ int main(int argc, char *argv[])
7578

7679
float colors[4*3] = { 1,0,0, 0,0.5,0, 0,0,0.2, 1,1,1 };
7780

78-
glUniform3fv(loc+1, 3, colors+3); // Pass the actual colors (testing a nonzero location offset), but do a mistake by setting one index too many. Spec says this should be gracefully handled, and that excess elements are ignored.
81+
// Pass the actual colors (testing a nonzero location offset), but do a
82+
// mistake by setting one index too many. Spec says this should be gracefully
83+
// handled, and that excess elements are ignored.
84+
glUniform3fv(loc+1, 3, colors+3);
7985
assert(glGetError() == GL_NO_ERROR);
8086
glUniform3fv(loc, 1, colors); // Set the first index as well.
8187
assert(glGetError() == GL_NO_ERROR);

0 commit comments

Comments
 (0)