Skip to content
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

style.cursor does not work for OffscreenCanvas #16492

Closed
connorjclark opened this issue Mar 15, 2022 · 2 comments
Closed

style.cursor does not work for OffscreenCanvas #16492

connorjclark opened this issue Mar 15, 2022 · 2 comments

Comments

@connorjclark
Copy link
Contributor

connorjclark commented Mar 15, 2022

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.7 (48a16209b1a0de5efd8112ce6430415730008d18)
clang version 15.0.0 (https://github.com/llvm/llvm-project fbce4a78035c32792b0a13cf1f169048b822c06b)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: C:\Users\cjamc\tools\emsdk\upstream\bin

I hope a picture is sufficient:

image
image

here's my flags:

USE_FLAGS=(
  -s USE_FREETYPE=1
  -s USE_VORBIS=1
  -s USE_OGG=1
  -s USE_LIBJPEG=1
  -s USE_SDL=2
  -s USE_LIBPNG=1
  -s FULL_ES2=1
  -s LLD_REPORT_UNDEFINED
  -s TOTAL_MEMORY=4294836224
  -s USE_PTHREADS=1
  -s PTHREAD_POOL_SIZE=12
  -s PROXY_TO_PTHREAD=1
  -s OFFSCREENCANVAS_SUPPORT=1
  -O2
  -g
)

Related issues/PRs:

#3568
#3623
#3623

This has been fixed previously for setting the cursor via the proxy to worker feature. I'm using two features not mentioned in the above PRs: PROXY_TO_PTHREAD and OFFSCREENCANVAS_SUPPORT. I suspect one or both of these aren't setup to proxy setting the styles from a worker thread to the main thread.

( aside; I am aware that SDL does not yet support proxy_to_pthread emscripten-ports/SDL2#127 . I suppose when it does I can forgo OFFSCREENCANVAS_SUPPORT? I hope so, because even after commenting out this cursor code I get an error about the main thread trying to get the context of a canvas that has been transfered to a worker Failed to execute 'getContext' on 'HTMLCanvasElement': Cannot get context from a canvas that has transferred its control to offscreen ... the only reason I'm using OFFSCREENCANVAS_SUPPORT in the first place is because I was getting webgl errors in a worker )

EDIT: I just noticed https://github.com/libsdl-org/SDL/pull/5365/files#diff-41bdc236909c8708ff058aa571192a0db6e42e4373f12011b7dd3171bc2e586aR234 addresses this issue.

@awoimbee
Copy link

Hi @connorjclark,
I'm having the exact same issue, except I'm using https://github.com/Kitware/VTK which uses its own "vtkSDL2".
It's the first time I'm using emscripten so I'm a bit lost. How did you circumvent this issue ? USE_PTHREADS=1 + --proxy-to-worker (but then you can't use MODULARIZE=1) ?

@connorjclark
Copy link
Contributor Author

Because of this and other issues, emscripten w/ SDL doesn't work with proxying the rendering stuff (so can't use the proxy to worker to proxy main thread flags), so I've just avoided those flags for now. It also means that if your main application thread uses blocking constructs you must use ASYNCIFY, so give that a shot.

It's the first time I'm using emscripten so I'm a bit lost.

Hey I'm with you. Good luck, it gets easier. Make sure you use -g when debugging and enable the DWARF debugging in Chrome/Edge devtools (it is behind an experimental flag AND a devtools extension)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants