You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Texture binding sampleType for "float or depth" #3115
OK, here's the proposal, which you can also see in graphical/table form. This should be a non-breaking enhancement that we can do after option 2, and after v1.
Add a new texture binding sampleType "float-or-depth". It is used with texture_2d<f32>. On the color-depth axis it lies between "unfilterable-float" and "depth":
Compared to `"unfilterable-float", it has two differences:
A bind group created against this BGL can bind a depth-format texture here.
A pipeline created against this BGL must not use certain ops on the corresponding texture in its shader. An example of such an op could be textureGather(1, ...) (1 here is a compile-time constant according to WGSL)
The benefit of this is that, unlike "depth", "float-or-depth"is compatible with color textures. Therefore, you can use this when you can't determine far enough ahead of time which it is going to be used with, but don't happen to use it with operations forbidden on depth textures (which probably aren't too common).
FWIW, I think this idea could be extended to a "uint-or-stencil" type if we really wanted it, but we don't even have a "stencil" binding type right now, and adding one would be a breaking change. I do have a small concern about new ops being added which don't support stencil textures, but I suspect the reason this is fine (and Metal doesn't have any distinction) is that stencil8 is fundamentally identical to uint8 whereas depth gets much funkier (with depth24unorm and restricted-range depth32float).
Activity
kainino0x commentedon Jul 23, 2022
I think this is obsolete with the reconsideration of #2094.