From f6480833654a689de8239f37c344ce0cc8e2f9ad Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Fri, 16 Mar 2018 13:15:48 +0000 Subject: [PATCH] Add tests for GL_NV_shader_noperspective_interpolation --- ...vShaderNoperspectiveInterpolation.frag.out | 38 +++++++++++++++++++ Test/nvShaderNoperspectiveInterpolation.frag | 15 ++++++++ gtests/AST.FromFile.cpp | 24 ++++++++++++ gtests/Spv.FromFile.cpp | 2 +- 4 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 Test/baseResults/nvShaderNoperspectiveInterpolation.frag.out create mode 100644 Test/nvShaderNoperspectiveInterpolation.frag diff --git a/Test/baseResults/nvShaderNoperspectiveInterpolation.frag.out b/Test/baseResults/nvShaderNoperspectiveInterpolation.frag.out new file mode 100644 index 00000000..ae004c64 --- /dev/null +++ b/Test/baseResults/nvShaderNoperspectiveInterpolation.frag.out @@ -0,0 +1,38 @@ +nvShaderNoperspectiveInterpolation.frag +ERROR: 0:5: 'noperspective' : Reserved word. +ERROR: 0:5: 'noperspective' : not supported for this version or the enabled extensions +ERROR: 2 compilation errors. No code generated. + + +Shader version: 300 +Requested GL_NV_shader_noperspective_interpolation +ERROR: node is still EOpNull! +0:13 Function Definition: main( ( global void) +0:13 Function Parameters: +0:14 Sequence +0:14 move second child to first child ( temp mediump 4-component vector of float) +0:14 'fragColor' ( out mediump 4-component vector of float) +0:14 'color' ( noperspective in mediump 4-component vector of float) +0:? Linker Objects +0:? 'bad' ( noperspective in mediump 4-component vector of float) +0:? 'color' ( noperspective in mediump 4-component vector of float) +0:? 'fragColor' ( out mediump 4-component vector of float) + + +Linked fragment stage: + + +Shader version: 300 +Requested GL_NV_shader_noperspective_interpolation +ERROR: node is still EOpNull! +0:13 Function Definition: main( ( global void) +0:13 Function Parameters: +0:14 Sequence +0:14 move second child to first child ( temp mediump 4-component vector of float) +0:14 'fragColor' ( out mediump 4-component vector of float) +0:14 'color' ( noperspective in mediump 4-component vector of float) +0:? Linker Objects +0:? 'bad' ( noperspective in mediump 4-component vector of float) +0:? 'color' ( noperspective in mediump 4-component vector of float) +0:? 'fragColor' ( out mediump 4-component vector of float) + diff --git a/Test/nvShaderNoperspectiveInterpolation.frag b/Test/nvShaderNoperspectiveInterpolation.frag new file mode 100644 index 00000000..15c191d0 --- /dev/null +++ b/Test/nvShaderNoperspectiveInterpolation.frag @@ -0,0 +1,15 @@ +#version 300 es + +precision mediump float; + +noperspective in vec4 bad; // ERROR + +#extension GL_NV_shader_noperspective_interpolation : enable + +noperspective in vec4 color; + +out vec4 fragColor; + +void main() { + fragColor = color; +} \ No newline at end of file diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp index 825e4dd2..fea75863 100644 --- a/gtests/AST.FromFile.cpp +++ b/gtests/AST.FromFile.cpp @@ -41,6 +41,10 @@ namespace { using CompileToAstTest = GlslangTest<::testing::TestWithParam>; +#ifdef NV_EXTENSIONS +using CompileToAstTestNV = GlslangTest<::testing::TestWithParam>; +#endif + TEST_P(CompileToAstTest, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), @@ -48,6 +52,16 @@ TEST_P(CompileToAstTest, FromFile) Target::AST); } +#ifdef NV_EXTENSIONS +// Compiling GLSL to SPIR-V under OpenGL semantics (NV extensions enabled). +TEST_P(CompileToAstTestNV, FromFile) +{ + loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), + Source::GLSL, Semantics::OpenGL, glslang::EShTargetVulkan_1_0, + Target::AST); +} +#endif + // clang-format off INSTANTIATE_TEST_CASE_P( Glsl, CompileToAstTest, @@ -214,6 +228,16 @@ INSTANTIATE_TEST_CASE_P( })), FileNameAsCustomTestSuffix ); + +#ifdef NV_EXTENSIONS +INSTANTIATE_TEST_CASE_P( + Glsl, CompileToAstTestNV, + ::testing::ValuesIn(std::vector({ + "nvShaderNoperspectiveInterpolation.frag", + })), + FileNameAsCustomTestSuffix +); +#endif // clang-format on } // anonymous namespace diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index 20ef2d72..54fa00a9 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -171,7 +171,7 @@ TEST_P(CompileVulkanToSpirvTestAMD, FromFile) #endif #ifdef NV_EXTENSIONS -// Compiling GLSL to SPIR-V under Vulkan semantics (AMD extensions enabled). +// Compiling GLSL to SPIR-V under Vulkan semantics (NV extensions enabled). // Expected to successfully generate SPIR-V. TEST_P(CompileVulkanToSpirvTestNV, FromFile) {