Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix glDrawElements under CAN_ADDRESS_2GB #21251

Merged
merged 1 commit into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ jobs:
browser_2gb.test_cubegeom
browser_2gb.test_cubegeom_normal
browser_2gb.test_cubegeom_normal_dap
browser_2gb.test_cubegeom_normal_dap_far
"
test-browser-chrome-wasm64-4gb:
executor: bionic
Expand Down
14 changes: 10 additions & 4 deletions src/library_glemu.js
Original file line number Diff line number Diff line change
Expand Up @@ -2940,9 +2940,9 @@ var LibraryGLEmulation = {
// Detect which case we are in by using a quick heuristic by examining the
// strides of the buffers. If all the buffers have identical stride, we
// assume we have case (2), otherwise we have something more complex.
var clientStartPointer = 0x7FFFFFFF;
var clientStartPointer = {{{ POINTER_MAX }}};
var bytes = 0; // Total number of bytes taken up by a single vertex.
var minStride = 0x7FFFFFFF;
var minStride = {{{ POINTER_MAX }}};
var maxStride = 0;
var attributes = GLImmediate.liveClientAttributes;
attributes.length = 0;
Expand Down Expand Up @@ -3544,8 +3544,14 @@ var LibraryGLEmulation = {
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
GLImmediate.lastVertex = end ? end + 1 : 0;
start = GLImmediate.vertexPointer;
end = end ? GLImmediate.vertexPointer + (end+1)*GLImmediate.stride : undefined;
GLImmediate.vertexData = HEAPF32.subarray({{{ getHeapOffset('start', 'float') }}}, end ? {{{ getHeapOffset('end', 'float') }}} : undefined);
// TODO(sbc): Combine these two subarray calls back into a single one if
// we ever fix https://github.com/emscripten-core/emscripten/issues/21250.
if (end) {
end = GLImmediate.vertexPointer + (end +1 ) * GLImmediate.stride;
GLImmediate.vertexData = HEAPF32.subarray({{{ getHeapOffset('start', 'float') }}}, {{{ getHeapOffset('end', 'float') }}});
} else {
GLImmediate.vertexData = HEAPF32.subarray({{{ getHeapOffset('start', 'float') }}});
}
}
GLImmediate.flush(count, 0, indices);
GLImmediate.mode = -1;
Expand Down
1 change: 1 addition & 0 deletions src/parseTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function needsQuoting(ident) {
}

globalThis.POINTER_SIZE = MEMORY64 ? 8 : 4;
globalThis.POINTER_MAX = MEMORY64 ? 'Number.MAX_SAFE_INTEGER' : '0xFFFFFFFF';
globalThis.STACK_ALIGN = 16;
const POINTER_BITS = POINTER_SIZE * 8;
const POINTER_TYPE = `u${POINTER_BITS}`;
Expand Down
Loading