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

[spv-in] sampling from depth textures returns a scalar and is splatted #6384

Conversation

schell
Copy link
Contributor

@schell schell commented Oct 8, 2024

This wraps the image expression in a splat expression when the texture being sampled/loaded is a depth texture.

Connections
This fixes #4551.

Description
Sampling from a depth texture fails because SPIR-V expects the result of sampling to be a vector, whereas WGSL expects it to be a scalar.

Testing
I ran this on some input shaders.

Checklist

  • Run cargo fmt.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

@schell schell requested a review from a team as a code owner October 8, 2024 20:47
@schell schell marked this pull request as draft October 8, 2024 22:20
@schell schell marked this pull request as ready for review October 8, 2024 22:59
@schell schell force-pushed the fix/spv-in-sampling-result-for-depth-texture-is-scalar branch from 38bf9b1 to 3711eed Compare October 8, 2024 23:34
@schell
Copy link
Contributor Author

schell commented Oct 9, 2024

@jimblandy @cwfitzgerald @teoxoy @Wumpf - I just want to put this on your radar :)

naga/src/front/spv/image.rs Outdated Show resolved Hide resolved
@teoxoy
Copy link
Member

teoxoy commented Oct 10, 2024

Besides the comment I left the changes look correct but could you also add a snapshot test for this?

@schell schell requested a review from teoxoy October 10, 2024 20:15
naga/src/front/spv/image.rs Show resolved Hide resolved
naga/src/front/spv/image.rs Outdated Show resolved Hide resolved
Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
@schell schell requested a review from teoxoy October 11, 2024 08:36
@schell
Copy link
Contributor Author

schell commented Oct 11, 2024

Ok, g2g @teoxoy :)

@teoxoy teoxoy merged commit 76b1605 into gfx-rs:trunk Oct 11, 2024
27 checks passed
@schell schell deleted the fix/spv-in-sampling-result-for-depth-texture-is-scalar branch October 11, 2024 18:43
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.

[spv-in] Sampling results for depth textures need to be changed to scalar floats
2 participants