-
Notifications
You must be signed in to change notification settings - Fork 175
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
WGPU backend support #928
Comments
wgpu is indeed a safer API and hides a lot of nasty things like memory barriers. That is a plus over gfx-hal. However there are some parts of a Wayland compositor that wgpu arguably does not go low enough level to let us access. Here are some things wgpu does not address for a Wayland compositor (this list is not exhaustive):
Essentially wgpu lacks what is needed to be a first class renderer that I'd consider suitable for inclusion into Smithay. However this does not mean wgpu is unusable. It should be entirely possible to use wgpu as a guest renderer ontop of the gles2 (you'll need to ensure gles 3.0 is available because wgpu requires gles 3.0) or the future vulkan renderer. This would involve using the wgpu-hal APIs to create an Instance and Device while telling wgpu to not take ownership of the instance and device (which smithay would own).
I do have some pointers on that. In fact I have made a (hacky, it works on amdgpu with a 6700xt but stuff is hardcoded so it may just spit out errors on your system) example of how you'd render to a buffer wgpu imports via it's vulkan hal types and then scan it out: https://gist.github.com/i509VCB/649d3b62f23a458ef18d3f2f4731eca7 I do have a plan to adjust the VulkanAllocator to allow importing dmabufs so that if you truly wanted to do that you'd have smithay deal with all the mess of importing the dmabuf and give you a VkImage. This does require using wgpu-hal, but it is a use case I do want to support. I am also on the smithay and wgpu matrix if you have questions about that (see the badges in the README). |
Additionally, there is only one real learning resource for wgpu and it's pretty low quality. Another problem is that WebGPU standard is not stable and WGSL requires custom pre-processor to implement fake import directives and many other features present in GLSL and HLSL. There is already discussion about wgpu, see discussions section. |
Previous discussions on that subject for reference: |
Hi everyone! What are your thoughts on implementing a WGPU graphics backend? This seems related to #129 and #134.
I'm wondering if there would be any benefit to using WGPU over gfx-hal as WGPU has a (mostly) safe api.
I've been experimenting on my own with WGPU and DRM and have gotten EGL rendering but I still have yet to implement Vulkan.
Let me know what you think!
The text was updated successfully, but these errors were encountered: