-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Type error in emscripten_webgl_do_create_context
#22943
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
Comments
|
Hmm, so in that case it seems like that I guess that means we don't have any testing of this configuration? Would you have time to send a PR for that? It seems like the fix would be to add |
I tried adding .canvas there, but sometimes the result is later accessed by its canvasSharedPtr or offscreenCanvas fields. I think this function’s callers should be checked to see which ones want shared pointers to offscreen/transferred canvases and should use the GL.offscreenCanvases map only, and which ones want “an element of type canvas or offscreencanvas” and need to return the element’s offscreen canvas or canvas fields if it has been transferred, or the result of findEventTarget otherwise. I’m planning to look into this Monday in case no one with more expertise has a chance to look by then. |
The function (emscripten_webgl_do_create_context) is returning the result of GL.createContext though right? Not the canvas. The canvas variable on line 174 is only ever used in the call to |
Sorry, by “this function” I meant findCanvasEventTarget. I think you’re right that adding .canvas in do_create_context is the right fix, but other similar issues arise from the incompatible types coming out of findCanvasEventTarget. |
OK that sounds right. I guess we can/should fix |
I believe changing just do_create_context is enough. I can make PRs tomorrow for this and for #22942 as two separate patches. |
…reating a context; fixes emscripten-core#22943
This was resolved by #22958 . |
If client code asks for explicit swap control, a transferred canvas record is obtained from
GL.offscreenCanvases
, but then that record (and not the underlying OffscreenCanvas) is passed through toGL.createContext
, which expects an actual offscreen canvas. The fix is to add....offscreenCanvas || ....canvas
on the end of line 174, or else to change the code ofemscripten_webgl_do_create_context
to unpack the canvas.emscripten/src/library_html5_webgl.js
Line 174 in 5203d08
The text was updated successfully, but these errors were encountered: