KhronosGroup / SPIRV-Cross

SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
Apache License 2.0
2.02k stars 558 forks source link

MSL: no matching function for call to faceforward on macOS 10.14 #1085

Closed jiradeto closed 5 years ago

jiradeto commented 5 years ago

On MacOS 10.14, when using the variable identifier as the parameter of the built-in function faceforward, the MSL compiler gives the following error:

result.msl:9:15: error: no matching function for call to 'faceforward'
    float b = faceforward(1.0, a, 1.0);
              ^~~~~~~~~~~

The GLSL fragment shader:

void main()
{
    float a = 1.0;
    float b = faceforward(1.0, a, 1.0);
}

MSL obtained by SPIRV-Cross:


fragment void main0()
{
    float a = 1.0;
    float b = faceforward(1.0, a, 1.0);
}

Versions:

Steps to reproduce:

This Archive.zip contains the original fragment shader, the associated SPIR-V, and MSL shader.

Issue found using GraphicsFuzz.

cdavis5e commented 5 years ago

This is yet another function from <metal_graphics> that doesn't have a scalar overload. At this point, I think we should just add scalar versions of all those functions.

HansKristian-Work commented 5 years ago

Ye ... I was doing a pass over the builtin functions a few days ago, but somehow forgot to check if this function also had this weird scalar-only restriction. Guess it's time to go over all functions one by one and see what works and what doesn't.