@@ -2940,9 +2940,9 @@ var LibraryGLEmulation = {
2940
2940
// Detect which case we are in by using a quick heuristic by examining the
2941
2941
// strides of the buffers. If all the buffers have identical stride, we
2942
2942
// assume we have case (2), otherwise we have something more complex.
2943
- var clientStartPointer = 0x7FFFFFFF ;
2943
+ var clientStartPointer = { { { POINTER_MAX } } } ;
2944
2944
var bytes = 0 ; // Total number of bytes taken up by a single vertex.
2945
- var minStride = 0x7FFFFFFF ;
2945
+ var minStride = { { { POINTER_MAX } } } ;
2946
2946
var maxStride = 0 ;
2947
2947
var attributes = GLImmediate . liveClientAttributes ;
2948
2948
attributes . length = 0 ;
@@ -3544,8 +3544,14 @@ var LibraryGLEmulation = {
3544
3544
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
3545
3545
GLImmediate . lastVertex = end ? end + 1 : 0 ;
3546
3546
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
+ }
3549
3555
}
3550
3556
GLImmediate . flush ( count , 0 , indices ) ;
3551
3557
GLImmediate . mode = - 1 ;
0 commit comments