diff --git a/src/reader/spirv/function.cc b/src/reader/spirv/function.cc index d6daa3de09..ef5deafffc 100644 --- a/src/reader/spirv/function.cc +++ b/src/reader/spirv/function.cc @@ -337,10 +337,18 @@ std::string GetGlslStd450FuncName(uint32_t ext_opcode) { return "normalize"; case GLSLstd450UClamp: case GLSLstd450SClamp: - case GLSLstd450FClamp: + case GLSLstd450NClamp: + case GLSLstd450FClamp: // FClamp is less prescriptive about NaN operands return "clamp"; case GLSLstd450Length: return "length"; + case GLSLstd450NMin: + case GLSLstd450FMin: // FMin is less prescriptive about NaN operands + return "min"; + case GLSLstd450NMax: + case GLSLstd450FMax: // FMax is less prescriptive about NaN operands + return "max"; + default: // TODO(dneto). The following are not implemented. // They are grouped semantically, as in GLSL.std.450.h. @@ -381,10 +389,8 @@ std::string GetGlslStd450FuncName(uint32_t ext_opcode) { case GLSLstd450Modf: case GLSLstd450ModfStruct: - case GLSLstd450FMin: case GLSLstd450UMin: case GLSLstd450SMin: - case GLSLstd450FMax: case GLSLstd450UMax: case GLSLstd450SMax: case GLSLstd450FMix: @@ -418,6 +424,10 @@ std::string GetGlslStd450FuncName(uint32_t ext_opcode) { case GLSLstd450FindILsb: case GLSLstd450FindSMsb: case GLSLstd450FindUMsb: + + case GLSLstd450InterpolateAtCentroid: + case GLSLstd450InterpolateAtSample: + case GLSLstd450InterpolateAtOffset: break; } return ""; diff --git a/src/reader/spirv/function_glsl_std_450_test.cc b/src/reader/spirv/function_glsl_std_450_test.cc index 5de5f47a7e..ffa1e54d0d 100644 --- a/src/reader/spirv/function_glsl_std_450_test.cc +++ b/src/reader/spirv/function_glsl_std_450_test.cc @@ -467,12 +467,21 @@ INSTANTIATE_TEST_SUITE_P(Samples, INSTANTIATE_TEST_SUITE_P(Samples, SpvParserTest_GlslStd450_Floating_FloatingFloating, - ::testing::Values(GlslStd450Case{"Atan2", "atan2"})); + ::testing::ValuesIn(std::vector{ + {"Atan2", "atan2"}, + {"NMax", "max"}, + {"NMin", "min"}, + {"FMax", "max"}, // WGSL max promises more for NaN + {"FMin", "min"} // WGSL min promises more for NaN + })); INSTANTIATE_TEST_SUITE_P( Samples, SpvParserTest_GlslStd450_Floating_FloatingFloatingFloating, - ::testing::Values(GlslStd450Case{"FClamp", "clamp"})); + ::testing::ValuesIn(std::vector{ + {"NClamp", "clamp"}, + {"FClamp", "clamp"} // WGSL FClamp promises more for NaN + })); TEST_P(SpvParserTest_GlslStd450_Inting_IntingIntingInting, Scalar) { const auto assembly = Preamble() + R"(