-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - Add push contant config to layout #7681
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM small nit, but not a blocker
Note for reviewers, most of the changes are just adding a new field to existing structs. The actual change is otherwise fairly small.
pub layout: Option<Vec<BindGroupLayout>>, | ||
pub layout: Vec<BindGroupLayout>, | ||
/// The push constant ranges for this pipeline. | ||
pub push_constant_ranges: Vec<PushConstantRange>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's no Default impl, I would add a comment saying that the expected default value is an empty vec.
Actually, wouldn't it be possible to keep the Option for layout and use an Option for push constants too? It would reduce the noise a bit and make it a bit more obvious what to use as a default value. |
That's certainly doable, but I would argue that wrapping values in The only field that doesn't already implement Default here is VertexState. Perhaps in the future we can implement RenderPipelineDescriptor {
layout: vec![layout1, layout2],
...VertexState {
// Fields for vertex state
}.into()
} |
To be clear, by noisy, I meant the current diff is noisy, not the actual usage. I'm fine with no Option personally especially considering that you need to specify a layout anyway most of the time. Yeah, it would be nice to have a default Impl but for now I'm happy with this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I like the move from Option
to Vec
. It avoids quite a bit of noise when creating pipelines.
We should probably add a default value to our pipeline descriptors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM % the PreHashMap
change.
@Neo-Zhixing the CI failure is related to an unused import, I assume because of the PreHashMap change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
# 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 <[email protected]>
Pull request successfully merged into main. Build succeeded:
|
# Objective Allow for creating pipelines that use push constants. To be able to use push constants. Fixes bevyengine#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 bevyengine#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 <[email protected]>
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:Solution
Add a field push_constant_ranges to
RenderPipelineDescriptor
andComputePipelineDescriptor
.This PR supersedes #4908 which now contains merge conflicts due to significant changes to
bevy_render
.Meanwhile, this PR also made the
layout
field ofRenderPipelineDescriptor
andComputePipelineDescriptor
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
layout
field of RenderPipelineDescriptor and ComputePipelineDescriptor non-optional.Migration Guide
RenderPipelineDescriptor
andComputePipelineDescriptor
layout
field ofRenderPipelineDescriptor
andComputePipelineDescriptor
. If the descriptor has no layout, supply an empty vector.