On MacOS 10.14, when using uvec4 type as the argument of the ldexp function, the MSL compiler gives the following error:
result.msl:14:22: error: no matching function for call to 'ldexp'
out._GLF_color = ldexp(float4(1.0), popcount(uint4(1u)));
^~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.1/include/metal/metal_math:2185:26: note: candidate function not
viable: no known conversion from 'unsigned int __attribute__((ext_vector_type(4)))' (vector of 4 'unsigned int' values) to 'vec<int, 4>' (vector of 4 'int' values) for 2nd
argument
METAL_ASM vec<float,4> ldexp(vec<float,4> x, vec<int,4> k) __asm("air." _AIR_PREFIX_float "ldexp.v4f32");
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/metal/macos/lib/clang/902.1/include/metal/metal_math:1340:18: note: candidate function not
viable: no known conversion from 'float4' (vector of 4 'float' values) to 'half' for 1st argument
METAL_ASM half ldexp(half x, int k) __asm("air." _AIR_PREFIX_half "ldexp.f16");
On MacOS 10.14, when using uvec4 type as the argument of the ldexp function, the MSL compiler gives the following error:
The GLSL fragment shader:
MSL obtained by SPIRV-Cross:
Versions:
Steps to reproduce:
glslangValidator -V sample.frag -o sample.spv
spirv-val sample.spv
spirv-cross --msl sample.spv --output result.msl
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 the MSL shader.
Issue found using GraphicsFuzz.