-
Notifications
You must be signed in to change notification settings - Fork 345
Description
IIUC, given this shader
@group(0) @binding(0) var tex: texture_depth_2d;
@group(0) @binding(1) var smp: sampler;
@compute @workgroup_size(1) fn cs() {
_ = textureSample(tex, smp, vec2f(0));
}
The layout: 'auto' algorithm will make a bind group layout with tex set to sampleType: 'depth' and smp set to type: 'filtering'
This layout is invalid as depth textures are unfiltered-float and require a sampler that is non-filtering.
Similarly
@group(0) @binding(0) var tex: texture_2d<u32>;
@group(0) @binding(1) var smp: sampler;
@compute @workgroup_size(1) fn cs() {
_ = textureGather(0, tex, smp, vec2f(0));
}
will make a bind group layout with tex set to sampleType: 'uint' and smp set to type: 'filtering' which is also invalid.
I'm wondering if it would be good to change the layout: 'auto' algorithm so that a sampler starts as 'filtering' but if it's used with a texture_depth_xxx or texture_??<i32> or texture_??<u32> then it's set to non-filtering. That would make the layout valid.
Note: dawn was not correctly validating that sampleType: 'depth'/'sint'/'uint' texture binding can not be used with a type: 'filtering' sampler. With that validation added this issue surfaced.