Comments (3)
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.
from smithay.
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.
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):
- Lacks the APIs for colorspace management, ala color representation protocol proposal (https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/183).
- Cannot support YUV buffers (actually this might change, but it will only work for importing YUV formatted images gfx-rs/wgpu#3145)
- wgpu does not natively support many features with the high level API (you'll need to manually do many of these things via the wgpu-hal API) including but not limited to:
- Importing an texture from a dmabuf.
- wgpu cannot allocate it's own buffers. This means the
Offscreen
trait is off limits. - wgpu does not allocate it's fences or whatever sync is internally to be exported as a sync fd (this is planned for the existing renderers)
- Vulkan requires the extensions that are needed to be declared when creating an Instance and Device. This means you need to use wgpu-hal to initialize Vulkan.
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've been experimenting on my own with WGPU and DRM and have gotten EGL rendering but I still have yet to implement Vulkan.
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).
from smithay.
Previous discussions on that subject for reference:
from smithay.
Related Issues (20)
- Missing key release events on winit backend results in permanently pressed modifiers
- wvkbd crashes when touching a key HOT 9
- Possibly wrong window geometry size with wp-viewporter HOT 4
- aa8d87a214 broke pointer input in foot HOT 1
- Stuck in listener.accept
- Add blurred Element support to `OutputDamageTracker`
- Initial commit of an XdgToplevel with a buffer already attached doesn't result in an error
- `DrmDevice::new` with disable_connectors = true causes vrr_capable property to get stuck at 0 HOT 3
- `prop_mapping` cache in `AtomicDrmDevice` doesn't handle connector hotplug
- Cursor and overlay elements overwrite primary plane in `RenderFrameResult::blit_frame_result` HOT 5
- Pasting images from wayland -> x11 truncates/corrupts the image HOT 1
- Reduce cloning around opaque region vectors
- `wlr_layer`'s `pre_commit_hook` can post an error, disconnecting the client, leading to a panic later on in the `commit` handling HOT 5
- Send an event, if Xwayland exits unexpectedly HOT 1
- Crop element causes invalid rendering for buffer transforms 1, 3, 5, 7
- Build error on s390x: src/wayland/shm/pool.rs:311:15 ..mem::zeroed() field `__glibc_reserved0` is private HOT 2
- Niri fails to init display in QEMU, smithay error message HOT 7
- app_id for nested compositors HOT 4
- Pointer surface focus not checked before button press
- `KbdRc` and `SeatRc` are leaked HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smithay.