Expose pipeline constants to materials#24502
Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨ |
|
Is this restricted to just f64 -> f32? Is the f64 there because the WebGPU is made with JS in mind? Is there some sort of internal conversion for other types? Could we expose some sort of |
It is f64 like LoadOp::Clear values.The conversion rule is https://gpuweb.github.io/gpuweb/#conversions-to-wgsl |
beicause
left a comment
There was a problem hiding this comment.
Some unnecessary cloning, although it's not big deal since these constants are empty.
Removed Eq derive from VertexState, FragmentState and ComputePipelineDescriptor as f64 does not implement it.
85c718a to
abfe4a7
Compare
Objective
Allow materials to use pipeline constants (pipeline-overridable constants).
They are already available in wgpu, but bevy didn't expose them.
Solution
Expose constants in
RenderPipelineDescriptor&ComputePipelineDescriptor, allowing materials to specify them in their specilize function.Note: I had to remove the
Eqderive fromComputePipelineDescriptor,VertexStateandFragmentState, due to the new f64 field. It was already a bit inconsistent withRenderPipelineDescriptornot having it.Testing
cargo checkcargo testdue to it taking looots of disk space to run, but I have a hard time seeing it break something at runtimeShowcase
See the added example, where pipeline constants are used to change the

LEVELSoverride in WGSL.