bevy/examples/2d
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
..
2d_shapes.rs Add quad to 2d_shapes example (#7708) 2023-02-17 01:50:20 +00:00
mesh2d.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
mesh2d_manual.rs Add push contant config to layout (#7681) 2023-02-17 06:20:16 +00:00
mesh2d_vertex_color_texture.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
move_sprite.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
pixel_perfect.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
rotation.rs Migrate engine to Schedule v3 (#7267) 2023-02-06 02:04:50 +00:00
sprite.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
sprite_flipping.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00
sprite_sheet.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
text2d.rs Base Sets (#7466) 2023-02-06 03:10:08 +00:00
texture_atlas.rs Remove .on_update method to improve API consistency and clarity (#7667) 2023-02-14 00:13:10 +00:00
transparency_2d.rs Spawn now takes a Bundle (#6054) 2022-09-23 19:55:54 +00:00