ask them in this thread :)

I have two questions
23 Replies
Perksey
Perksey11mo ago
.
ritchie ❤
ritchie ❤11mo ago
1. is webgpu like vulkan, in that the render pipeline is immutable and must be fully recreated when something like the Blend State needs to change?
khitiara
khitiara11mo ago
1) yes
ritchie ❤
ritchie ❤11mo ago
okay so the second question is let's say I create the render pipeline, then I create a Texture2D in my engine, then I destroy the render pipeline to recreate it after a graphics settings change do I lose the Texture2D?
khitiara
khitiara11mo ago
not unless youre doing something weird with it, the texture2d is attached to the device/engine/whatever webgpu calls it i forget but its device in vulkan webgpu from what ive seen is pretty similar to vulkan except it sacrifices ultra-flexibility in exchange for reasonable defaults and a good api, and actually being truly cross-platform
ritchie ❤
ritchie ❤11mo ago
It seems like the current vertex/fragment shader being used is also immutable? like you can't change it without rebuilding the render pipeline?
khitiara
khitiara11mo ago
yes, though you can use uniforms/push constants, whatever to change the behavior a bit but yes that fact is actually a big problem in modern games turns out, because games will have to rebuild pipelines constantly because of it theres pipeline caching to help a bit ( i think webgpu has it? ) where aspects of the pipeline get cached and the creating again is faster
ritchie ❤
ritchie ❤11mo ago
Yeah....I don't know how the hell I'd do a Unity-like material system with that Clearly Unity does it in Vulkan though
khitiara
khitiara11mo ago
theyll make a pipeline for every combination that gets used if you have ten materials in the scene youll have ten pipelines and rebind to a new one for each thing you render
ritchie ❤
ritchie ❤11mo ago
That sounds.... Unbelievably painful
Perksey
Perksey11mo ago
this is why things like elden ring are so infamous for having terrible "shader" compilation times
khitiara
khitiara11mo ago
yeah the "shader compilation" is usually rebuilding pipelines whenever you change scenes
Perksey
Perksey11mo ago
The Khronos Group
You Can Use Vulkan Without Pipelines Today
Deploying and developing royalty-free open standards for 3D graphics, Virtual and Augmented Reality, Parallel Computing, Neural Networks, and Vision Processing
khitiara
khitiara11mo ago
yeah vulkan has some stuff to help there but webgpu doesnt yet
Perksey
Perksey11mo ago
khronos is slowly realising that making driver implementation easy by requiring the developer to do everything tends to come at a cost in the software written against it
khitiara
khitiara11mo ago
and it isnt supported on all graphics cards - theres a thing with vulkan to make the api work without deeper support but it just does caching in the background for you
Perksey
Perksey11mo ago
khitiara
khitiara11mo ago
huh didnt know that im hoping webgpu moves to shader objects too but my hopes arent high (its the only thing keeping me back from migrating to webgpu for the portability)
ritchie ❤
ritchie ❤11mo ago
And I'm guessing you NEED a vert + frag shader to build a render pipeline
khitiara
khitiara11mo ago
yup
ritchie ❤
ritchie ❤11mo ago
fuuuuuuck I'm going to need to build an entire system around this
khitiara
khitiara11mo ago
webgpu doesnt have mesh shading so you cant do task + mesh + frag as an alternative you can reuse the vert and frag bits at least across pipelines
ritchie ❤
ritchie ❤11mo ago
I was going to set up the render pipeline as soon as the engine initializes, before loading game assets but that won't work because like shaders are assets