-
-
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
Update and extension of Adding push constants support #1369 #1733
Conversation
# Conflicts: # crates/bevy_render/src/pipeline/pipeline_layout.rs # crates/bevy_wgpu/src/wgpu_type_converter.rs
This is really nice. Thank you for keeping my authorship. |
Because it's a good example I want to repeat the links from the other PR here: |
I'm looking at using push_constants for shadowmapping. That way I can pass the index of the pointlight and the face that needs to be rendered to the shadow map shader. |
Although the limited compatibility concerns me too. I'll look into pushing that data into an aligned uniform as an alternative. |
for push_constant_block in module.enumerate_push_constant_blocks(None).unwrap() { | ||
let range = push_constant_block.offset..push_constant_block.size; | ||
let mut stages = BindingShaderStage::NONE; | ||
if shader_stage.contains(ReflectShaderStageFlags::VERTEX) { |
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.
This seems like it could be potentially non-exhaustive. Room for improved error handling?
@Neo-Zhixing Btw, if you're interested in putting in the work to get this approved, feel free to pull (some of) my commits into your PR and we can close this instead. |
This extends @Neo-Zhixing 's #1369 with shader-reflection and a (albeit contrived) example.
@Neo-Zhixing I hope you don't mind. I left your authorship of the rebased commits intact.
I'd be particularly interested in feedback on how to make a more useful or simple example. But since
set_push_constants
requires DrawContext, I'm not sure if there's a real alternative.