-
Notifications
You must be signed in to change notification settings - Fork 344
Description
Currently, the spec has GPUTextureComponentType that has to be provided for "sampled" texture types. @eseaflower pointed to an issue with HLSL that non-float textures can't be sampled at all in gfx-rs/wgpu#999 (comment)
Looking at the documentation, I see that only "float" types are permitted here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/samplelevel-s-float-float-int-uint-
Technically, we can work around this by issuing Load instructions, but this requires a bunch of logic and information about the texture dimensions and sampler wrapping modes, so it would be very unfortunate if we had to do this.
I think we should just restrict this in WGSL by defining the textureSample* to only work on f32 textures and return vec4<f32> correspondingly.
There is another problem with "sampled-texture" binding in WebGPU now: these textures can't really be sampled (if we go with the restriction), so binding them via this type is awkward and confusing.