bevy/examples/shader
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
..
animate_shader.rs add globals to mesh view bind group (#5409) 2022-09-28 04:20:27 +00:00
array_texture.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
compute_shader_game_of_life.rs Add push contant config to layout (#7681) 2023-02-17 06:20:16 +00:00
custom_vertex_attribute.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
post_processing.rs Wgpu 0.15 (#7356) 2023-01-29 20:27:30 +00:00
shader_defs.rs Shader defs can now have a value (#5900) 2022-11-21 22:38:29 +00:00
shader_instancing.rs Migrate engine to Schedule v3 (#7267) 2023-02-06 02:04:50 +00:00
shader_material.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
shader_material_glsl.rs Fix various typos (#7096) 2023-01-06 00:43:30 +00:00
shader_material_screenspace_texture.rs added subdivisions to shape::Plane (#7546) 2023-02-13 18:20:20 +00:00
shader_prepass.rs added subdivisions to shape::Plane (#7546) 2023-02-13 18:20:20 +00:00
texture_binding_array.rs Fix feature gating in texture_binding_array example (#7425) 2023-02-06 17:51:39 +00:00