You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I love that wgpu lets you create a pipeline using layout set to None, this lets you skip both the creation of the pipeline layout and the bind group layouts, because you can just call get_bind_group_layout(). I wish that the Vulkan API had this feature!
Some questions about this feature, just out of curiosity:
(1) I could not find this feature in the WebGPU spec, am I missing it or is it specific to this Rust implementation?
(2) Some of the examples (e.g. the triangle example) could be simplified by using this approach, is there a reason they're not?
A lot of us actually dislike implicit bind group layouts. It is a pain to implement for various reasons. The bind group layouts are also incompatible with all other bind group layouts (unlike normal bind group layouts which are "equivalent" if they store the same stuff) which means you can't share bind groups between pipelines. It also only gives you a bind group layout that can be derived from the shader, which often omit bindings in real code. As such we generally discourage the feature's use. I am personally of the opinion that this is a misfeature within WebGPU.
Ah, right that's the reflection query, also I see now that the spec defines the concept of a "default pipeline layout" which it describes in detail.
Interesting! I grok the pain of an implementor's burden but this is convenient from a user's standpoint, in a lot of situations. Agreed that it's a little weird if the shader are allowed to omit bindings.
Overall I'm loving the WebGPU API, I feel it strikes the right balance for a GPU abstraction; OpenGL is too magical and Vukan has no abstraction at all.
@cwfitzgerald I've come around to your point of view on this, especially after discovering that any bind group that happens to be unused by the WGSL gets automatically culled away from the reflected bind group layout.
This is particularly annoying when temporarily simplifying a shader while debugging -- suddenly you can run into a bind group layout mismatch, just because the shader no longer refers to anything from a particular uniform buffer.
This pitfall can be avoided by explicitly providing a layout, rather than relying on reflection.
So... thanks again for the advice, it is good advice indeed. :)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I love that wgpu lets you create a pipeline using layout set to
None
, this lets you skip both the creation of the pipeline layout and the bind group layouts, because you can just callget_bind_group_layout()
. I wish that the Vulkan API had this feature!Some questions about this feature, just out of curiosity:
(1) I could not find this feature in the WebGPU spec, am I missing it or is it specific to this Rust implementation?
(2) Some of the examples (e.g. the triangle example) could be simplified by using this approach, is there a reason they're not?
Beta Was this translation helpful? Give feedback.
All reactions