bevy/crates/bevy_pbr/src
Zhixing Zhang 16feb9acb7 Add push contant config to layout (#7681)
# Objective

Allow for creating pipelines that use push constants. To be able to use push constants. Fixes #4825

As of right now, trying to call `RenderPass::set_push_constants` will trigger the following error:

```
thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In a RenderPass
      note: encoder = `<CommandBuffer-(0, 59, Vulkan)>`
    In a set_push_constant command
    provided push constant is for stage(s) VERTEX | FRAGMENT | VERTEX_FRAGMENT, however the pipeline layout has no push constant range for the stage(s) VERTEX | FRAGMENT | VERTEX_FRAGMENT
```
## Solution

Add a field push_constant_ranges to` RenderPipelineDescriptor` and `ComputePipelineDescriptor`.

This PR supersedes #4908 which now contains merge conflicts due to significant changes to `bevy_render`.

Meanwhile, this PR also made the `layout` field of `RenderPipelineDescriptor` and `ComputePipelineDescriptor` non-optional. If the user do not need to specify the bind group layouts, they can simply supply an empty vector here. No need for it to be optional.

---

## Changelog
- Add a field push_constant_ranges to RenderPipelineDescriptor and ComputePipelineDescriptor
- Made the `layout` field of RenderPipelineDescriptor and ComputePipelineDescriptor non-optional.


## Migration Guide

- Add push_constant_ranges: Vec::new() to every `RenderPipelineDescriptor` and `ComputePipelineDescriptor`
- Unwrap the optional values on the `layout` field of `RenderPipelineDescriptor` and `ComputePipelineDescriptor`. If the descriptor has no layout, supply an empty vector.


Co-authored-by: Zhixing Zhang <me@neoto.xin>
2023-02-17 06:20:16 +00:00
..
environment_map EnvironmentMapLight, BRDF Improvements (#7051) 2023-02-09 16:46:32 +00:00
prepass Add push contant config to layout (#7681) 2023-02-17 06:20:16 +00:00
render Add push contant config to layout (#7681) 2023-02-17 06:20:16 +00:00
alpha.rs Standard Material Blend Modes (#6644) 2023-01-21 21:46:53 +00:00
bundle.rs Cascaded shadow maps. (#7064) 2023-01-25 12:35:39 +00:00
fog.rs Add Distance and Atmospheric Fog support (#6412) 2023-01-29 15:28:56 +00:00
lib.rs Cleanup render schedule (#7589) 2023-02-10 03:32:54 +00:00
light.rs Cam scale cluster fix (#7078) 2023-02-07 16:10:54 +00:00
material.rs Add push contant config to layout (#7681) 2023-02-17 06:20:16 +00:00
pbr_material.rs Change standard material defaults and update docs (#7664) 2023-02-14 07:43:19 +00:00
wireframe.rs Migrate engine to Schedule v3 (#7267) 2023-02-06 02:04:50 +00:00