-
Notifications
You must be signed in to change notification settings - Fork 67
Add Image::fetch_with_lod #361
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
base: main
Are you sure you want to change the base?
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.
This looks good, thank you!
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.
You can already fetch image texels with additional settings, like lod, bias, grad and sampleIndex. And naga for some reason requires explicitly fetching from lod 0, like below.
use spirv_std::image::sample_with::lod;
use spirv_std::image::{Image2d, ImageWithMethods};
mask_texture.fetch_with(frag_coord.xy().as_uvec2(), lod(0))
Also I'd call it lod since we're following spirv / glsl naming conventions.
You may also find this thing I've been working on useful: #280
Not required, but it would be nice to put "level" somewhere as a doc alias (or even in the comment) so it comes up if folks search the webgpu terminology. |
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.
Yup, this makes sense now 👍
Looks like some compiletests are failing. You should be able to run them locally with |
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.
CI failures
Fixes #360
I used the terminology
level
since that's what WGSL used, but it would also make sense to uselod
since that's what SPIR-V and GLSL'stexelFetch
use.