On MacOS 10.14, I tried to convert SPIR-V to MSL and found that when using the findLSB() as the argument of the clamp function, the MSL compiler gives the following error:
result.msl:17:9: error: no matching function for call to 'clamp'
if (clamp(47910, findLSB(40365u), 1) > 0)
^~~~~
On MacOS 10.14, I tried to convert SPIR-V to MSL and found that when using the findLSB() as the argument of the clamp function, the MSL compiler gives the following error:
The GLSL fragment shader:
MSL obtained by SPIRV-Cross:
Versions:
Steps to reproduce:
Convert the GLSL shader to SPIR-V using glslangValidator with the command
glslangValidator -V sample.frag -o sample.spv
Validate the generated SPIR-V with the command
spirv-val sample.spv
Convert the SPIR-V to MSL using SPIRV-Cross with the command
spirv-cross --msl sample.spv --output result.msl
Build a Metal library with the command
xcrun --sdk macosx10.14 metal -x metal -std=macos-metal1.2 result.msl
This Archive.zip contains the original fragment shader, the associated SPIR-V, and MSL shader.
Issue found using GraphicsFuzz.