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

emscripten_webgl_commit_frame black screen #10309

Closed
malytomas opened this issue Jan 29, 2020 · 2 comments
Closed

emscripten_webgl_commit_frame black screen #10309

malytomas opened this issue Jan 29, 2020 · 2 comments

Comments

@malytomas
Copy link

I have pthread with offscreen canvas and use the commit function, however, all I get is a black screen.
Using emscripten_set_main_loop instead works well.

Source code of the rendering part: https://github.com/melowntech/vts-browser-cpp/blob/9110c3d4fd4cf18dcccfa1358ae4005f73a5b84c/browser/src/vts-browser-wasm-canvas/render.cpp
Defining the RENDER_EXPLICIT_SWAP enables the commit function within an infinite loop. Am I using this correctly?

The emscripten_webgl_commit_frame returns 0 (success).
I also tried adding emscripten_current_thread_process_queued_calls into the loop in case there were any events that would need processing.

I am testing this with chrome Version 79.0.3945.130 (Official Build) (64-bit) on ubuntu.
(I cannot test with firefox because it no longer works with shared array buffers even when enabled.)

Built with sdk-releases-upstream-967836071d96d9b7894e492382f5fcb96423fc07-64bit.

Relevant build flags: -s OFFSCREENCANVAS_SUPPORT=1 -s PROXY_TO_PTHREAD=1 -s OFFSCREENCANVASES_TO_PTHREAD='#display' -s WASM=1 -s USE_PTHREADS=1 -s USE_WEBGL2=1 -s FULL_ES3=1

Thanks for any help.

@juj
Copy link
Collaborator

juj commented Jan 29, 2020

Unfortunately the latest draft of OffscreenCanvas no longer supports explicit swapping behavior. It is not clear if the final spec will, but currently it looks like it will not.

If so, explicit swapping will be restricted to the OFFSCREEN_FRAMEBUFFER feature - and in OFFSCREEN_CANVAS, to swap one will need to yield back to browser event loop.

There was a lot of contention against having a .commit() function. See w3ctag/design-reviews#141 and w3ctag/design-reviews#288 if you are interested in the conversation history.

@malytomas
Copy link
Author

Thanks for the explanation :D

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