webgl encoder: accept mainScriptUrlOrBlob in threaded builds (Emscripten 6.0.x)

Newer Emscripten (6.0.x) no longer includes mainScriptUrlOrBlob in its default INCOMING_MODULE_JS_API,
so the threaded encoder loaded via importScripts() in ktx2_studio/encode-worker.js ignored it and the
pthread pool never came up (the worker hangs while loading). Add it explicitly (Emscripten's default list
plus mainScriptUrlOrBlob), as in the development tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard Geldreich
2026-10-23 14:51:35 -04:00
co-authored by Claude Opus 5.5
parent 254c5b8ed1
commit 918d658f95
+4 -1
View File
@@ -149,7 +149,10 @@ if(EMSCRIPTEN)
endif()
endif()
set(LINK_THREADS "-s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=32 -s ENVIRONMENT=web,worker")
# INCOMING_MODULE_JS_API: Emscripten's default list plus mainScriptUrlOrBlob, which newer Emscripten (6.0.x) no longer accepts by default.
# ktx2_studio/encode-worker.js loads the threaded encoder via importScripts() and must pass mainScriptUrlOrBlob, otherwise the pthread
# pool is spawned from the wrong script and the encoder module never finishes loading (silent hang).
set(LINK_THREADS "-s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=32 -s ENVIRONMENT=web,worker -s INCOMING_MODULE_JS_API=['ENVIRONMENT','arguments','canvas','dynamicLibraries','elementPointerLock','instantiateWasm','locateFile','monitorRunDependencies','noExitRuntime','noInitialRun','onAbort','onExit','onRuntimeInitialized','postRun','preInit','preRun','print','printErr','setStatus','statusMessage','stderr','stdin','stdout','thisProgram','wasm','websocket','mainScriptUrlOrBlob']")
set(LINK_WASM64 "-s MEMORY64=1 -sWASM_BIGINT=1 --profiling-funcs")
# Helper to avoid repetition