This repository has been archived by the owner on Jan 29, 2025. It is now read-only.
Naga generates bad MSL for textureLoad
access on 1d textures
#1642
Labels
area: back-end
Outputs of shader conversion
kind: bug
Something isn't working
lang: Metal
Metal Shading Language
Naga compiles the following WGSL input to Metal Shading Language that does not validate:
The generated MSL is:
The error messages are a bunch of complaints explaining why each overload of
read
doesn't apply, but the gist of it is, we would like this overload:but we don't get it because the level-of-detail argument is not a compile-time constant.
1D textures can't have mipmaps. At the WGSL level, this means that
textureNumLevels
always returns1
on 1D textures, and any value of thetextureLoad
'slevel
argument other than zero is out of bounds. But at the MSL level, thelevel
argument totexture1d::read
must be a constexpr equal to zero. So when Naga emits the expressionstatic_cast<int>(local_id.y)
for that argument, Metal validation fails.The text was updated successfully, but these errors were encountered: