Skip to content

Avoid compiling pthread-specific parts of library_html5_webgl.js unle… #15725

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

Merged
merged 1 commit into from
Dec 7, 2021
Merged
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
5 changes: 4 additions & 1 deletion src/library_html5_webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,13 @@ var LibraryHtml5WebGL = {
GL.deleteContext(contextHandle);
},

#if USE_PTHREADS
// Special function that will be invoked on the thread calling emscripten_webgl_destroy_context(), before routing
// the call over to the target thread.
emscripten_webgl_destroy_context_before_on_calling_thread: function(contextHandle) {
if (_emscripten_webgl_get_current_context() == contextHandle) _emscripten_webgl_make_context_current(0);
},
#endif

emscripten_webgl_enable_extension__deps: [
#if GL_SUPPORT_SIMPLE_ENABLE_EXTENSIONS
Expand Down Expand Up @@ -554,13 +556,13 @@ var LibraryHtml5WebGL = {
},
};

#if USE_PTHREADS
// Process 'sync_on_webgl_context_handle_thread' and 'sync_on_current_webgl_context_thread' pseudo-proxying modes
// to appropriate proxying mechanism, either proxying on-demand, unconditionally, or never, depending on build modes.
// 'sync_on_webgl_context_handle_thread' is used for function signatures that take a HTML5 WebGL context handle
// object as the first argument. 'sync_on_current_webgl_context_thread' is used for functions that operate on the
// implicit "current WebGL context" as activated via emscripten_webgl_make_current() function.
function handleWebGLProxying(funcs) {
if (!USE_PTHREADS) return; // No proxying needed in singlethreaded builds

function listOfNFunctionArgs(func) {
var args = [];
Expand Down Expand Up @@ -627,5 +629,6 @@ function handleWebGLProxying(funcs) {
}

handleWebGLProxying(LibraryHtml5WebGL);
#endif

mergeInto(LibraryManager.library, LibraryHtml5WebGL);