Skip to content

Commit 7cd6360

Browse files
authored
Always fixup custom __proxy attributes in library_html5_webgl.js (#20135)
Fixes: #20134
1 parent e2ad780 commit 7cd6360

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/jsifier.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,12 @@ function(${args}) {
225225
i53ConversionDeps.forEach((d) => deps.push(d))
226226
}
227227

228-
if (SHARED_MEMORY) {
229-
const proxyingMode = LibraryManager.library[symbol + '__proxy'];
230-
if (proxyingMode) {
231-
if (proxyingMode !== 'sync' && proxyingMode !== 'async') {
232-
throw new Error(`Invalid proxyingMode ${symbol}__proxy: '${proxyingMode}' specified!`);
233-
}
228+
const proxyingMode = LibraryManager.library[symbol + '__proxy'];
229+
if (proxyingMode) {
230+
if (proxyingMode !== 'sync' && proxyingMode !== 'async') {
231+
throw new Error(`Invalid proxyingMode ${symbol}__proxy: '${proxyingMode}' specified!`);
232+
}
233+
if (SHARED_MEMORY) {
234234
const sync = proxyingMode === 'sync';
235235
if (PTHREADS) {
236236
snippet = modifyJSFunction(snippet, (args, body, async_, oneliner) => {

src/library_html5_webgl.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,13 @@ var LibraryHtml5WebGL = {
514514
emscripten_webgl_get_parameter_i64v: (param, dst) => writeI53ToI64(dst, GLctx.getParameter(param)),
515515
};
516516

517-
#if PTHREADS
517+
function handleWebGLProxying(funcs) {
518+
#if SHARED_MEMORY
518519
// Process 'sync_on_webgl_context_handle_thread' and 'sync_on_current_webgl_context_thread' pseudo-proxying modes
519520
// to appropriate proxying mechanism, either proxying on-demand, unconditionally, or never, depending on build modes.
520521
// 'sync_on_webgl_context_handle_thread' is used for function signatures that take a HTML5 WebGL context handle
521522
// object as the first argument. 'sync_on_current_webgl_context_thread' is used for functions that operate on the
522523
// implicit "current WebGL context" as activated via emscripten_webgl_make_current() function.
523-
function handleWebGLProxying(funcs) {
524524

525525
function listOfNFunctionArgs(func) {
526526
var args = [];
@@ -586,10 +586,16 @@ function handleWebGLProxying(funcs) {
586586
delete funcs[i + '__proxy'];
587587
}
588588
}
589+
#else
590+
// In single threaded mode just delete our custom __proxy addributes, otherwise
591+
// they will causes errors in the JS compiler.
592+
for (var i in funcs) {
593+
delete funcs[i + '__proxy'];
594+
}
595+
#endif // SHARED_MEMORY
589596
}
590597

591598
handleWebGLProxying(LibraryHtml5WebGL);
592-
#endif // PTHREADS
593599

594600
#if LibraryManager.has('library_webgl.js')
595601
autoAddDeps(LibraryHtml5WebGL, '$GL');

0 commit comments

Comments
 (0)