Repository navigation
Conversation
|
hey, I stumbled across this due to an issue search I have setup. I really like the approach with call and getattr looks really clean. Since it took me several months (on and off) to figure out the quirks around pyodide ffi, I can offer you my solution (which makes use of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the browser-native
js_webgpubackend for Pyodide and integrates its presentation context with rendercanvas.Included
navigator.gpuadapter/device acquisitionGPUPromisebridgeGPUCommandEncodercopy/clear/query operationsGPUCanvasContextconfigure()unconfigure()get_current_texture()get_preferred_format()present()rendercanvas flow
rendercanvas.PyodideRenderCanvassupplies:The rendercanvas
WgpuContextToScreenthen callswgpu.gpu.get_canvas_context(). The Pyodide backend wraps the native browsercanvas.getContext("webgpu"), while keeping the public wgpu-py context API expected by rendercanvas.Browser WebGPU presents automatically after queue submission; there is intentionally no native
swapBuffers()equivalent.Next
The next step is a real browser integration test with Pyodide + rendercanvas, including an actual render pass to an HTML canvas. After that, API parity and browser CI can be expanded systematically.