emscripten-core / emscripten-core/emscripten

EGL calls are always proxied to main thread which breaks OFFSCREENCANVAS_SUPPORT with PROXY_TO_PTHREAD

Open
#24,792 5 comments 0 reactions 0 assignees View on GitHub
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

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.