SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
1.96k
stars
549
forks
source link
MSL: invalid code generated when atan2 and saturate are used in mixed precision environment #2309
Closed
BlurryLight closed 2 months ago
the following hlsl generate invalid msl: https://godbolt.org/z/7aM4j9Tnb dxc args:
-T ps_6_6 -E PSMain -spirv -enable-16bit-types
which generate invalid msl: https://shader-playground.timjones.io/ebece9aee93af143eb7801593f8cf51a
the error msg is
"error: call to 'clamp' is ambiguous",
because it tries to call a functionclamp(float,half,half)
.Potential cause
it seems spirv-cross always emits
precise::atan2
instead of the relaxed precision version. https://github.com/KhronosGroup/SPIRV-Cross/blob/06407561ece7d7e78544112189f3eee13adf9959/spirv_msl.cpp#L10415-L10416