mirror of
https://github.com/bevyengine/bevy.git
synced 2026-06-30 07:45:50 -04:00
6f270d4776
# Objective Allow materials to use pipeline constants ([pipeline-overridable constants](https://www.w3.org/TR/WGSL/#override-decls)). 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 `Eq` derive from `ComputePipelineDescriptor`, `VertexState` and `FragmentState`, due to the new f64 field. It was already a bit inconsistent with `RenderPipelineDescriptor` not having it. ## Testing - Ran `cargo check` - Created an example & ran it - Couldn't run `cargo test` due to it taking looots of disk space to run, but I have a hard time seeing it break something at runtime ## Showcase See the added example, where pipeline constants are used to change the `LEVELS` override in WGSL. <img width="760" height="289" alt="Screenshot from 2026-05-31 09-46-05" src="https://github.com/user-attachments/assets/6902757c-aea4-4b91-9ff0-e653ce4c3448" />