Worth looking at the hello-triangle examples for the C- and Rust-APIs:<p>C99 Hello Triangle:<p><a href="https://github.com/gfx-rs/wgpu/blob/master/examples/hello_triangle_c/main.c" rel="nofollow">https://github.com/gfx-rs/wgpu/blob/master/examples/hello_tr...</a><p>Rust Hello Triangle:<p><a href="https://github.com/gfx-rs/wgpu/blob/master/examples/hello_triangle_rust/main.rs" rel="nofollow">https://github.com/gfx-rs/wgpu/blob/master/examples/hello_tr...</a><p>Both look very neat and tidy IMHO.<p>The C99 version could also use nested designated initialization right in the function call, this would make it look very similar to the Rust version, e.g.:<p><pre><code> WGPUBlendStateId blend_state_0 = wgpu_device_create_blend_state(
device,
&(WGPUBlendDescriptor) {
.blend_enabled = false,
.write_mask = WGPUColorWriteFlags_ALL,
.color = {
.src_factor = WGPUBlendFactor_One,
.dst_factor = WGPUBlendFactor_Zero,
.operation = WGPUBlendOperation_Add,
},
.alpha = {
.src_factor = WGPUBlendFactor_One,
.dst_factor = WGPUBlendFactor_Zero,
.operation = WGPUBlendOperation_Add,
}
});
</code></pre>
But of course that's a matter of taste :)
How practical would it be to produce a 2D UI using a framework built on these kinds of APIs? I'm wondering if there's a future down the road for multi-platform desktop apps with the convenience of Electron-like development and distribution, but where the native clients are able to be much thinner than a whole browser.
> The code runs on a variety of platforms [...] eventually the Web (when the browsers gain support for the API, which is also in our scope of work).<p>Have the big three confirmed intent to support WebGPU?<p>Also, what is the state of WebGL backend support for gfx-rs? I'm watching [0] eagerly. That would be a great practical step towards gfx-rs in browsers today.<p>0 - <a href="https://github.com/gfx-rs/gfx/pull/2554" rel="nofollow">https://github.com/gfx-rs/gfx/pull/2554</a>
"We don’t even rely on Rust syntax and features for safety, since it’s handled at the lower level [...]"<p>This part makes me nervous. Isn't it basically saying "we wrote perfectly safe C and made a Rust wrapper for it"?
Even webgpu makes performance portability hard and keeps the user manually setting barriers etc. We could use a modern but yet higher level api.<p>Shameless plug: We have a graph based approach which automates all intermediate resource allocations and scheduling. I am hoping we can opensource it or something similar as it separates definitions of the algorithms nicely from how they are scheduled in the end (async compute on amd and so forth are all automatic). We also have backend implementations for all the major modern apis.
WebGPU. That's an awful name. Given WebGL is taken and already in version 2. But WebGPU sounds like a virtual GPU for GameStreaming. Even GLWeb would be nicer.
The important question is - are the graphics and platform vendors onboard? Does webgpu sit directly on top of graphics drivers or is this just a MoltenVK/Angle style abstraction layer that abstracts away OpenGL / Vulkan / Metal? Has someone done the hard work of getting Apple onboard for using this outside the browser (ie as a Metal replacement).
<i>> With wgpu-rs we can finally deprecate the old gfx and have a solid recommendation for people getting started with graphics in Rust.</i><p>Does this mean that gfx-rs (the low level API) is deprecated and no longer maintained?