@@ -1641,16 +1641,18 @@ for (/**@suppress{duplicate}*/var i = 0; i < {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
16411641 // those always when possible.
16421642 if ( GLctx . currentPixelUnpackBufferBinding ) {
16431643 GLctx . texImage2D( target , level, internalFormat, width, height, border, format, type, pixels) ;
1644- } else if ( pixels ) {
1644+ return ;
1645+ }
1646+ if ( pixels ) {
16451647 var heap = heapObjectForWebGLType ( type ) ;
1646- GLctx . texImage2D ( target , level , internalFormat , width , height , border , format , type , heap , toTypedArrayIndex ( pixels , heap ) ) ;
1647- } else {
1648- GLctx . texImage2D ( target , level , internalFormat , width , height , border , format , type , null ) ;
1648+ var index = toTypedArrayIndex ( pixels , heap ) ;
1649+ GLctx . texImage2D ( target , level , internalFormat , width , height , border , format , type , heap , index ) ;
1650+ return ;
16491651 }
1650- return ;
16511652 }
16521653#endif
1653- GLctx . texImage2D ( target , level, internalFormat, width, height, border, format, type, pixels ? emscriptenWebGLGetTexPixelData ( type, format, width, height, pixels, internalFormat ) : null ) ;
1654+ var pixelData = pixels ? emscriptenWebGLGetTexPixelData ( type , format , width , height , pixels , internalFormat ) : null ;
1655+ GLctx . texImage2D ( target , level , internalFormat , width , height , border , format , type , pixelData ) ;
16541656 } ,
16551657
16561658 glTexSubImage2D__deps : [ '$emscriptenWebGLGetTexPixelData '
0 commit comments