emscripten-core / emscripten-core/emscripten
EGL calls are always proxied to main thread which breaks OFFSCREENCANVAS_SUPPORT with PROXY_TO_PTHREAD
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
When I use `PROXY_TO_PTHREAD` and `OFFSCREENCANVAS_SUPPORT` to run a SDL app, the canvas is transferred to the worker and then all operations on the canvas are done by that worker.
GL calls work, however, EGL calls are proxied to the main thread, which can no longer access the canvas and we see this error:
```
InvalidStateError: Failed to execute 'getContext' on 'HTMLCanvasElement': Cannot get context from a canvas that has transferred its control to offscreen.
```
I was able to get my app to work by simply removing lines containing `if (ENVIRONMENT_IS_PTHREAD) return proxyToMainThread` for all functions that start with `_egl` in the generated file, but I'm not sure this is a general solution, hence no PR.
Contributor guide
Assessment
This issue has not been assessed yet.