Skip to content

Commit 48a0bbd

Browse files
authored
Fix closure compiler warnings with -sFULL_ES3 (#26893)
Without this we see ``` building:ERROR: /tmp/emscripten_temp/hello_world.js:14723:8: WARNING - [JSC_UNREACHABLE_CODE] unreachable code 14723| GLctx.bufferSubData(target, mapping.offset, HEAPU8.subarray(mapping.mem, mapping.mem+mapping.length)); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ``` The `if/else` stuff around `GLctx.bufferSubData` is pretty nasty so I have a followup to tidy it up. Also, include more of webgl in test_codesize_hello_dylink_all. It obviously gets much bigger but its also means that we can use this to observe codesize changes in more library code.
1 parent 101b333 commit 48a0bbd

6 files changed

Lines changed: 346 additions & 7 deletions

File tree

embuilder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
'libGL-emu-getprocaddr',
8282
'libGL-emu-webgl2-ofb-getprocaddr',
8383
'libGL-webgl2-ofb-getprocaddr',
84+
'libGL-webgl2-ofb-full_es3-getprocaddr',
8485
'libGL-ww-getprocaddr',
8586
'libhtml5',
8687
'libsockets',

src/lib/libwebgl.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3825,7 +3825,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
38253825
cb.stride = stride;
38263826
cb.ptr = ptr;
38273827
cb.clientside = true;
3828-
cb.vertexAttribPointerAdaptor = function(index, size, type, normalized, stride, ptr) {
3828+
cb.vertexAttribPointerAdaptor = /** @this {WebGLRenderingContext} */ function(index, size, type, normalized, stride, ptr) {
38293829
this.vertexAttribPointer(index, size, type, normalized, stride, ptr);
38303830
};
38313831
return;
@@ -4262,9 +4262,14 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
42624262
#if WEBGL_USE_GARBAGE_FREE_APIS
42634263
if ({{{ isCurrentContextWebGL2() }}}) {
42644264
GLctx.bufferSubData(target, mapping.offset, HEAPU8, mapping.mem, mapping.length);
4265-
} else
4265+
}
4266+
#if INCLUDE_WEBGL1_FALLBACK
4267+
else
42664268
#endif
4269+
#endif
4270+
#if INCLUDE_WEBGL1_FALLBACK
42674271
GLctx.bufferSubData(target, mapping.offset, HEAPU8.subarray(mapping.mem, mapping.mem+mapping.length));
4272+
#endif
42684273
}
42694274
_free(mapping.mem);
42704275
mapping.mem = 0;

src/lib/libwebgl2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ var LibraryWebGL2 = {
930930
cb.stride = stride;
931931
cb.ptr = ptr;
932932
cb.clientside = true;
933-
cb.vertexAttribPointerAdaptor = function(index, size, type, normalized, stride, ptr) {
933+
cb.vertexAttribPointerAdaptor = /** @this {WebGLRenderingContext} */ function(index, size, type, normalized, stride, ptr) {
934934
this.vertexAttribIPointer(index, size, type, stride, ptr);
935935
};
936936
return;

0 commit comments

Comments
 (0)