@@ -1520,6 +1520,11 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
15201520 } ,
15211521
15221522 glCompressedTexImage2D : ( target , level , internalFormat , width , height , border , imageSize , data ) = > {
1523+ // `data` may be null here, which means "allocate uniniitalized space but
1524+ // don't upload" in GLES parlance, but `compressedTexImage2D` requires the
1525+ // final data parameter, so we simply pass a heap view starting at zero
1526+ // effectively uploading whatever happens to be near address zero. See
1527+ // https://github.com/emscripten-core/emscripten/issues/19300.
15231528#if MAX_WEBGL_VERSION >= 2
15241529 if ( { { { isCurrentContextWebGL2( ) } } } ) {
15251530 if ( GLctx . currentPixelUnpackBufferBinding || ! imageSize ) {
@@ -1533,7 +1538,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
15331538 }
15341539#endif
15351540#if INCLUDE_WEBGL1_FALLBACK
1536- GLctx . compressedTexImage2D ( target , level , internalFormat , width , height , border , data ? { { { makeHEAPView ( 'U8' , 'data' , 'data+imageSize' ) } } } : null ) ;
1541+ GLctx . compressedTexImage2D ( target , level , internalFormat , width , height , border , { { { makeHEAPView ( 'U8' , 'data' , 'data+imageSize' ) } } } ) ;
15371542#endif
15381543 } ,
15391544
@@ -1552,7 +1557,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
15521557 }
15531558#endif
15541559#if INCLUDE_WEBGL1_FALLBACK
1555- GLctx . compressedTexSubImage2D ( target , level , xoffset , yoffset , width , height , format , data ? { { { makeHEAPView ( 'U8' , 'data' , 'data+imageSize' ) } } } : null ) ;
1560+ GLctx . compressedTexSubImage2D ( target , level , xoffset , yoffset , width , height , format , { { { makeHEAPView ( 'U8' , 'data' , 'data+imageSize' ) } } } ) ;
15561561#endif
15571562 } ,
15581563
0 commit comments