From 2edde6665d9a56ead5ea0e55b4e64d9a803e6164 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 3 Nov 2017 03:39:48 -0600 Subject: [PATCH] SPV: Don't support noise*() when generating SPV. --- Test/baseResults/glspv.frag.out | 10 +++++++--- Test/baseResults/spv.specConstant.vert.out | 6 +++--- Test/baseResults/vulkan.frag.out | 6 +++++- Test/glspv.frag | 8 ++++++++ Test/vulkan.frag | 8 ++++++++ glslang/MachineIndependent/Initialize.cpp | 2 +- 6 files changed, 32 insertions(+), 8 deletions(-) diff --git a/Test/baseResults/glspv.frag.out b/Test/baseResults/glspv.frag.out index 5622d018..49398073 100755 --- a/Test/baseResults/glspv.frag.out +++ b/Test/baseResults/glspv.frag.out @@ -1,9 +1,13 @@ glspv.frag ERROR: 0:4: '#error' : GL_SPIRV is set ( correct , not an error ) ERROR: 0:6: '#error' : GL_SPIR is 100 -ERROR: 0:19: 'input_attachment_index' : only allowed when using GLSL for Vulkan -ERROR: 0:19: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON -ERROR: 4 compilation errors. No code generated. +ERROR: 0:21: 'noise1' : no matching overloaded function found +ERROR: 0:22: 'noise2' : no matching overloaded function found +ERROR: 0:23: 'noise3' : no matching overloaded function found +ERROR: 0:24: 'noise4' : no matching overloaded function found +ERROR: 0:27: 'input_attachment_index' : only allowed when using GLSL for Vulkan +ERROR: 0:27: '' : syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON +ERROR: 8 compilation errors. No code generated. SPIR-V is not generated for failed compile or link diff --git a/Test/baseResults/spv.specConstant.vert.out b/Test/baseResults/spv.specConstant.vert.out index 156497b6..8dda41d4 100644 --- a/Test/baseResults/spv.specConstant.vert.out +++ b/Test/baseResults/spv.specConstant.vert.out @@ -11,7 +11,7 @@ spv.specConstant.vert Source GLSL 400 Name 4 "main" Name 9 "arraySize" - Name 14 "foo(vf4[s1522];" + Name 14 "foo(vf4[s1506];" Name 13 "p" Name 17 "builtin_spec_constant(" Name 20 "color" @@ -102,10 +102,10 @@ spv.specConstant.vert Store 20(color) 46 48: 10 Load 22(ucol) Store 47(param) 48 - 49: 2 FunctionCall 14(foo(vf4[s1522];) 47(param) + 49: 2 FunctionCall 14(foo(vf4[s1506];) 47(param) Return FunctionEnd -14(foo(vf4[s1522];): 2 Function None 12 +14(foo(vf4[s1506];): 2 Function None 12 13(p): 11(ptr) FunctionParameter 15: Label 54: 24(ptr) AccessChain 53(dupUcol) 23 diff --git a/Test/baseResults/vulkan.frag.out b/Test/baseResults/vulkan.frag.out index c8e1ed61..0440cf49 100644 --- a/Test/baseResults/vulkan.frag.out +++ b/Test/baseResults/vulkan.frag.out @@ -39,7 +39,11 @@ ERROR: 0:93: ',' : sampler constructor must appear at point of use ERROR: 0:94: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type ' temp sampler2D' and a right operand of type ' temp sampler2D' (or there is no acceptable conversion) ERROR: 0:94: 'call argument' : sampler constructor must appear at point of use ERROR: 0:96: 'gl_NumSamples' : undeclared identifier -ERROR: 38 compilation errors. No code generated. +ERROR: 0:101: 'noise1' : no matching overloaded function found +ERROR: 0:102: 'noise2' : no matching overloaded function found +ERROR: 0:103: 'noise3' : no matching overloaded function found +ERROR: 0:104: 'noise4' : no matching overloaded function found +ERROR: 42 compilation errors. No code generated. ERROR: Linking fragment stage: Only one push_constant block is allowed per stage diff --git a/Test/glspv.frag b/Test/glspv.frag index 008d191a..86c9f6ab 100644 --- a/Test/glspv.frag +++ b/Test/glspv.frag @@ -16,4 +16,12 @@ layout(location = 2) uniform float g; uniform sampler2D s1; layout(location = 3) uniform sampler2D s2; +void noise() +{ + noise1(vec4(1)); + noise2(4.0); + noise3(vec2(3)); + noise4(1); +} + layout(input_attachment_index = 1) uniform subpassInput sub; // ERROR, no inputs diff --git a/Test/vulkan.frag b/Test/vulkan.frag index 1447ec16..14c0c301 100644 --- a/Test/vulkan.frag +++ b/Test/vulkan.frag @@ -95,3 +95,11 @@ void callUserTexture() gl_NumSamples; // ERROR, not for Vulkan } + +void noise() +{ + noise1(dv4); + noise2(4.0); + noise3(vec2(3)); + noise4(dv4); +} diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index c8229650..40f46b35 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -1384,7 +1384,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV // // Noise functions. // - if (profile != EEsProfile) { + if (spvVersion.spv == 0 && profile != EEsProfile) { commonBuiltins.append( "float noise1(float x);" "float noise1(vec2 x);"