emscripten-core / emscripten-core/emscripten

Safari workaround breaks use of preinitialized GL contexts in library_webgl.js

Open
#13,926 4 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Somewhere between 2.0.15 and 2.0.17 code was added at line [586](https://github.com/emscripten-core/emscripten/blob/d5b212dd0c185d2cba6b08115c29228bdc4c38a8/src/library_webgl.js#L586) of createContext() in library_webgl.js to workaround some Safari issue. This code tries to dereference the canvas argument to createContext and thus breaks use of preinitialized GL contexts. When using those you pass `null` as the canvas parameter.

The code that handles preinitialized contexts is at line [621](https://github.com/emscripten-core/emscripten/blob/d5b212dd0c185d2cba6b08115c29228bdc4c38a8/src/library_webgl.js#L621). Presumably the fix is as simple as moving the Safari workaround to the else after line 621, the not-preinitialized case. But I don't have enough familiarity with the webgl library to feel comfortable providing a PR.

This has broken my JS KTX v2 decoder (including Basis Universal) and WebGL uploader. My users are naturally complaining to me. Please fix it as soon as possible.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.