r/rust • wgpu · rend3 • 18h ago

wgpu v31 has been released!

117 Upvotes

31 comments sorted by

41

u/Sirflankalot wgpu · rend3 18h ago

Maintainer here, AMA!

24

u/gahooa 17h ago

Thank you for your dedication to an excellent crate and everything it supports.

12

u/Sirflankalot wgpu · rend3 17h ago

Thank you!

21

u/valorzard 17h ago

Is your dog doing better?

32

u/Sirflankalot wgpu · rend3 16h ago

Yes! Thankfully, she came out of the hospital two days ago and since then is doing absolutely wonderful. Thank you for asking!

9

u/WalkMaximum 17h ago

Thank you!

8

u/Sirflankalot wgpu · rend3 17h ago

You're welcome! 

6

u/_Arthxr 17h ago

Hi, I hope you don't mind a low effort question. I'm currently learning wayland and planning to write a client. I will want to use gpu to draw in the app. Can wgpu be used in wayland? How difficult would wgpu be compared to opengl for someone who is new to graphics progamming?

13

u/Sirflankalot wgpu · rend3 16h ago

In some ways, OpenGL is easier because it's fully stateful, so there's less setup code and it hides a decent amount of the asynchronousness of GPU programming. However, I think WGPU's errors are much, much better and will serve as a strong launching off point for things like Vulkan or DirectX 12, or even just complicated WGPU applications.

8

u/Sirflankalot wgpu · rend3 16h ago

Yes! You just need to hand us a https://docs.rs/raw-window-handle/0.6.2/raw_window_handle/struct.WaylandDisplayHandle.html and a https://docs.rs/raw-window-handle/0.6.2/raw_window_handle/struct.WaylandWindowHandle.html which we can then pass on to the driver. How you get them (either via winit or manual wayland bindings or some other windowing library) doesn't matter to us.

6

u/franky_reboot 17h ago

Cannot answer fully, but from personal experience I can tell you: rest assured, wgpu can be used in Wayland.

4

u/allocallocalloc 17h ago

Yes, you can use wgpu along with Wayland. wgpu just needs a surface, with or without a window. ("Winit" makes this easy.)

I found wgpu to be more simple to set up in Rust than OpenGL, although OpenGL isn't too bad in C. Both are simpler than Vulkan in C.

4

u/Ok_Management9524 16h ago

Sorry to drop a bombshell question in here, but I've hit a really slow FXC case with PipelineCompilationOptions::zero_initialize_workgroup_memory = true and large var<workgroup> arrays.
naga's HLSL backend emits the zero-init as whole-array assignments done by lane 0:

if (lane == 0) { quads = (uint[1024])0; down_out_sh = (float[1536])0; }

FXC (cs_5_1) takes 40 s to 5+ min per entry point on these kernels meanwhile Vulkan compiles them in a fraction of a second. If I edit the HLSL to a strided loop instead:

for (uint i = lane; i < 1024u; i += 128u) { quads[i] = 0u; }

it brings the same kernels to 0.4-1.9 s with FXC, about the same as turning zero-init off entirely. Is this a known issue?

Edit: format, for whatever reason markdown didnt work

9

u/Sirflankalot wgpu · rend3 15h ago

> Is this a known issue?

Unfortunately the entirety of fxc is a known issue :) It's a 10+ year unmaintained compiler made for the days when shaders were 96 instructions not massive. There are a million ways to cause it to explode into massive runtime. If at all possible, if using the D3D12 backend, use DXC. It also has some problems with this, but its _much much_ better.

> Zero Init

This one particular problem though is something with a fix on the way, as it makes other shader compilers unhappy too. Probably in time for v32, but no promises there.

→ More replies (1)

2

u/0exa 16h ago

Ray tracing when?

5

u/Sirflankalot wgpu · rend3 15h ago

If you want inline ray queries, then January 2025 :). Ray tracing pipelines, this version! Both still experimental, but inline ray queries have been baking for a while!

2

u/0exa 14h ago

Oh, really? I admittedly only use WebGPU in the browser, so I must be quite far behind. But that's good to hear.

2

u/Sirflankalot wgpu · rend3 13h ago

Yeah! WebGPU will get it eventually

10

u/franky_reboot 17h ago

I can only mirror what others have said. Your work is invaluable for the community at large.

3

u/DavidXkL 16h ago

Thank you for your hard work!

2

u/tr0nical 7h ago

Thanks a lot for the awesome work on wgpu and in particular how you all are handling contributions, with kindness and pragmatism.

4

u/Animats 13h ago

And I just finished months of work going from WGPU 24 to WGPU 30. Over 600 lines of changes required.

Does the change

+  default_queue: wgpu::QueueDescriptor { label: None },+  default_queue: wgpu::QueueDescriptor { label: None },

imply that multiple queues (like a separate transfer queue) are finally implemented? Been waiting for that for years now. I'm trying to get asset loading into the GPU out of the main thread.

2

u/Sirflankalot wgpu · rend3 13h ago

It's not implemented yet - this is a forward compatibility thing in the WebGPU spec, as well as allowing you to specify a label for the queue.

2

u/ayanada 13h ago

Congrats on the release! Is there a rough plan for first-class VK_EXT_present_timing support? I've seen #2869 and jameysharp's prototype via set_next_present_chain and open_with_callback - is that the intended path for now, or is a proper presentation-timing API on the roadmap?

4

u/Sirflankalot wgpu · rend3 13h ago

Short term the various prototype apis will let this through sooner, but we do want a proper presentation timing api - the apis across platforms are just quite different, so finding a good api will take some thinking.

→ More replies (1)

4

u/moon-w0man 15h ago

Looks like an awesome release, thank you and the contributors for all the hard work! Damage-aware presentation looks amazing, can't wait to give it a shot.

2

u/Animats 10h ago

Note: wgpu-profiler needs a new version with dependencies adjusted to work with WGPU 31.

2

u/Emotional_Ad_4518 7h ago

Thank you for your hardwork, been using it in my egui 3D workspace app. Work very good so far

1

u/pgh_ski 15m ago

I've been learning wgpu recently and it is awesome! There's a lot of scaffolding needed to get started but once you get going it's powerful and super neat. Having a blast and learning a lot.