@@ -1520,6 +1520,11 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
1520
1520
} ,
1521
1521
1522
1522
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.
1523
1528
#if MAX_WEBGL_VERSION >= 2
1524
1529
if ( { { { isCurrentContextWebGL2( ) } } } ) {
1525
1530
if ( GLctx . currentPixelUnpackBufferBinding || ! imageSize ) {
@@ -1533,7 +1538,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
1533
1538
}
1534
1539
#endif
1535
1540
#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' ) } } } ) ;
1537
1542
#endif
1538
1543
} ,
1539
1544
@@ -1552,7 +1557,7 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
1552
1557
}
1553
1558
#endif
1554
1559
#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' ) } } } ) ;
1556
1561
#endif
1557
1562
} ,
1558
1563
0 commit comments