bevy/crates/bevy_core_pipeline/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
..
bloom Add push contant config to layout (#7681) 2023-02-17 06:20:16 +00:00
core_2d Migrate engine to Schedule v3 (#7267) 2023-02-06 02:04:50 +00:00
core_3d Migrate engine to Schedule v3 (#7267) 2023-02-06 02:04:50 +00:00
fullscreen_vertex_shader separate tonemapping and upscaling passes (#3425) 2022-10-26 20:13:59 +00:00
fxaa Add push contant config to layout (#7681) 2023-02-17 06:20:16 +00:00
prepass bevy_core_pipeline: Fix prepass sort orders (#7539) 2023-02-07 11:31:35 +00:00
tonemapping Add push contant config to layout (#7681) 2023-02-17 06:20:16 +00:00
upscaling Add push contant config to layout (#7681) 2023-02-17 06:20:16 +00:00
clear_color.rs Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
lib.rs Add depth and normal prepass (#6284) 2023-01-19 22:11:13 +00:00