Skip to content

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

@zb3

Description

@zb3

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions