@@ -2940,9 +2940,9 @@ var LibraryGLEmulation = {
29402940 // Detect which case we are in by using a quick heuristic by examining the
29412941 // strides of the buffers. If all the buffers have identical stride, we
29422942 // assume we have case (2), otherwise we have something more complex.
2943- var clientStartPointer = 0x7FFFFFFF ;
2943+ var clientStartPointer = { { { POINTER_MAX } } } ;
29442944 var bytes = 0 ; // Total number of bytes taken up by a single vertex.
2945- var minStride = 0x7FFFFFFF ;
2945+ var minStride = { { { POINTER_MAX } } } ;
29462946 var maxStride = 0 ;
29472947 var attributes = GLImmediate . liveClientAttributes ;
29482948 attributes . length = 0 ;
@@ -3544,8 +3544,14 @@ var LibraryGLEmulation = {
35443544 GLImmediate . firstVertex = end ? start : HEAP8 . length ; // if we don't know the start, set an invalid value and we will calculate it later from the indices
35453545 GLImmediate . lastVertex = end ? end + 1 : 0 ;
35463546 start = GLImmediate . vertexPointer ;
3547- end = end ? GLImmediate . vertexPointer + ( end + 1 ) * GLImmediate . stride : undefined ;
3548- GLImmediate . vertexData = HEAPF32 . subarray ( { { { getHeapOffset ( 'start' , 'float' ) } } } , end ? { { { getHeapOffset ( 'end' , 'float' ) } } } : undefined ) ;
3547+ // TODO(sbc): Combine these two subarray calls back into a single one if
3548+ // we ever fix https://github.com/emscripten-core/emscripten/issues/21250.
3549+ if ( end ) {
3550+ end = GLImmediate . vertexPointer + ( end + 1 ) * GLImmediate . stride ;
3551+ GLImmediate . vertexData = HEAPF32 . subarray ( { { { getHeapOffset ( 'start' , 'float' ) } } } , { { { getHeapOffset ( 'end' , 'float' ) } } } ) ;
3552+ } else {
3553+ GLImmediate . vertexData = HEAPF32 . subarray ( { { { getHeapOffset ( 'start' , 'float' ) } } } ) ;
3554+ }
35493555 }
35503556 GLImmediate . flush ( count , 0 , indices ) ;
35513557 GLImmediate . mode = - 1 ;
0 commit comments