Skip to content
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

support push constants on metal #2258

Closed
wants to merge 1 commit into from

Conversation

molikto
Copy link

@molikto molikto commented Dec 5, 2021

Connections

fix #1825
Description

support push constants on metal. needed to run https://github.com/googlefonts/compute-shader-101/tree/main/rust-gpu-toy on macOS

I have no experience working with graphics API, so I don't know if the code in the PR is actually correct :-(

Testing

That repo above seems to run correctly.

@@ -592,7 +592,27 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
_offset: u32,
_data: &[u32],
) {
//TODO
if _stages.contains(wgt::ShaderStages::COMPUTE) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be a tiny bit more complex.
The way it's supposed to work is if you have [u8; max_push_constants] array on the command encoder. set_push_constants would just overwrite some of these bytes, but the shaders would see as much as PipelineLayout have declared.

E.g. user could 0..4 with one set_push_constants and 4..8 with another call, and the shader needs to see all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing Features::PUSH_CONSTANTS for Metal
2 participants