-
Notifications
You must be signed in to change notification settings - Fork 195
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
Add textureSampleBaseClampToEdge #2534
base: master
Are you sure you want to change the base?
Conversation
2966ec0
to
0e1dd25
Compare
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.
I haven't yet looked in detail at the PR but wanted to ask if it would be possible to do the translation in the wgsl frontend instead given that none of the other shading languages have this function.
wgsl -> wgsl translation of this fn with a texture_external
wouldn't work but I don't see the usefulness of wgsl -> wgsl translation in general.
@jimblandy what do you think?
Removed |
Thanks!
We now have a codeowners file with the naga team in it which causes github to automatically request reviews. |
Hmm. I actually think it's probably fine to put it in the IR, and make the backends decide how to deal with it. Generally we want the IR to follow WGSL pretty closely. I also think we might get slightly better output this way. I think adding the I would call the variant Another approach with the same advantages would be to change the |
@evahop Thanks for implementing this! If you'd like to post work-in-progress PRs (which we're happy to see), consider marking them as "Draft" when you create the PR. That prevents reviews from being requested. |
let half_texel = vec2(0.5) / vec2<f32>(textureDimensions(t));
textureSampleBase(t, s, clamp(coords, half_texel, 1 - half_texel)); We also translate I think frontends should deal with sugar features like these since there is no benefit to have those in the IR. You could actually make an argument |
@jimblandy and I talked about this and we are unsure where this translation belongs yet due to us not supporting The translation of I think we should ideally add support for |
Hello, thank you for your PR against Naga! As part of gfx-rs/wgpu#4231, we have moved development of Naga into the wgpu repository in the Naga subfolder. We have transferred all issues, but we are unable to automatically transfer PRs. As such, please recreate your PR against the wgpu repository. We apologize for the inconvenience this causes, but will make contributing to both projects more streamlined going forward. We are leaving PRs open, but once they are transferred, please close the original Naga PR. |
From gfx-rs/wgpu#4402
For everything excluding spv:
It creates a local variable containing the half-texel computed from each backend's respective image query function.
It then uses that half-texel to clamp the image coordinates to [half-texel, 1 - half-texel].
For spv:
Does the exact same thing only it's self contained.
The spec says at "base level" which I've interpreted to mean at level 0 everywhere.
The spv snapshot is a little noisy so the relevant bit begins on line
584
.