From 65d402479f718221ad083896e29feb81a81b9935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 15 Dec 2017 19:24:31 -0800 Subject: [PATCH] Updated glslang. --- 3rdparty/glslang/SPIRV/GLSL.ext.AMD.h | 7 - 3rdparty/glslang/SPIRV/GLSL.ext.EXT.h | 39 ++++ 3rdparty/glslang/SPIRV/GlslangToSpv.cpp | 29 ++- 3rdparty/glslang/SPIRV/doc.cpp | 5 + 3rdparty/glslang/SPIRV/spirv.hpp | 18 ++ 3rdparty/glslang/StandAlone/StandAlone.cpp | 8 + 3rdparty/glslang/Test/440.vert | 6 + .../glslang/Test/baseResults/400.geom.out | 2 +- .../glslang/Test/baseResults/440.vert.out | 81 ++++---- .../Test/baseResults/hlsl.hull.4.tesc.out | 141 +++++++------- .../Test/baseResults/hlsl.hull.5.tesc.out | 10 +- .../Test/baseResults/hlsl.y-negate-1.vert.out | 113 +++++++++++ .../Test/baseResults/hlsl.y-negate-2.vert.out | 121 ++++++++++++ .../Test/baseResults/hlsl.y-negate-3.vert.out | 177 ++++++++++++++++++ .../Test/baseResults/spv.builtInXFB.vert.out | 47 +++++ .../baseResults/spv.fullyCovered.frag.out | 37 ++++ .../glslang/Test/baseResults/spv.xfb.vert.out | 55 ++++++ 3rdparty/glslang/Test/hlsl.PointSize.geom | 2 +- 3rdparty/glslang/Test/hlsl.y-negate-1.vert | 9 + 3rdparty/glslang/Test/hlsl.y-negate-2.vert | 8 + 3rdparty/glslang/Test/hlsl.y-negate-3.vert | 18 ++ 3rdparty/glslang/Test/runtests | 11 ++ 3rdparty/glslang/Test/spv.builtInXFB.vert | 15 ++ 3rdparty/glslang/Test/spv.fullyCovered.frag | 9 + 3rdparty/glslang/Test/spv.xfb.vert | 20 ++ 3rdparty/glslang/glslang/Include/BaseTypes.h | 2 + 3rdparty/glslang/glslang/Include/Types.h | 8 +- .../glslang/MachineIndependent/Initialize.cpp | 14 ++ .../MachineIndependent/ParseHelper.cpp | 25 ++- .../glslang/MachineIndependent/ShaderLang.cpp | 2 + .../glslang/MachineIndependent/Versions.cpp | 2 + .../glslang/MachineIndependent/Versions.h | 1 + .../MachineIndependent/localintermediate.h | 11 ++ 3rdparty/glslang/glslang/Public/ShaderLang.h | 1 + 3rdparty/glslang/gtests/Spv.FromFile.cpp | 3 + 3rdparty/glslang/hlsl/hlslParseHelper.cpp | 100 +++++++++- 3rdparty/glslang/hlsl/hlslParseHelper.h | 1 + 3rdparty/glslang/known_good.json | 2 +- 38 files changed, 998 insertions(+), 162 deletions(-) create mode 100644 3rdparty/glslang/SPIRV/GLSL.ext.EXT.h create mode 100644 3rdparty/glslang/Test/baseResults/hlsl.y-negate-1.vert.out create mode 100644 3rdparty/glslang/Test/baseResults/hlsl.y-negate-2.vert.out create mode 100644 3rdparty/glslang/Test/baseResults/hlsl.y-negate-3.vert.out create mode 100755 3rdparty/glslang/Test/baseResults/spv.builtInXFB.vert.out create mode 100644 3rdparty/glslang/Test/baseResults/spv.fullyCovered.frag.out create mode 100755 3rdparty/glslang/Test/baseResults/spv.xfb.vert.out create mode 100644 3rdparty/glslang/Test/hlsl.y-negate-1.vert create mode 100644 3rdparty/glslang/Test/hlsl.y-negate-2.vert create mode 100644 3rdparty/glslang/Test/hlsl.y-negate-3.vert create mode 100644 3rdparty/glslang/Test/spv.builtInXFB.vert create mode 100644 3rdparty/glslang/Test/spv.fullyCovered.frag create mode 100644 3rdparty/glslang/Test/spv.xfb.vert diff --git a/3rdparty/glslang/SPIRV/GLSL.ext.AMD.h b/3rdparty/glslang/SPIRV/GLSL.ext.AMD.h index 7e97be38f..d4f57efdc 100644 --- a/3rdparty/glslang/SPIRV/GLSL.ext.AMD.h +++ b/3rdparty/glslang/SPIRV/GLSL.ext.AMD.h @@ -104,14 +104,7 @@ static const char* const E_SPV_AMD_gpu_shader_int16 = "SPV_AMD_gpu_shader_int16" // SPV_AMD_shader_image_load_store_lod static const char* const E_SPV_AMD_shader_image_load_store_lod = "SPV_AMD_shader_image_load_store_lod"; -static const Capability CapabilityImageReadWriteLodAMD = static_cast(5015); - // SPV_AMD_shader_fragment_mask static const char* const E_SPV_AMD_shader_fragment_mask = "SPV_AMD_shader_fragment_mask"; -static const Capability CapabilityFragmentMaskAMD = static_cast(5010); - -static const Op OpFragmentMaskFetchAMD = static_cast(5011); -static const Op OpFragmentFetchAMD = static_cast(5012); - #endif // #ifndef GLSLextAMD_H diff --git a/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h b/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h new file mode 100644 index 000000000..e879714d0 --- /dev/null +++ b/3rdparty/glslang/SPIRV/GLSL.ext.EXT.h @@ -0,0 +1,39 @@ +/* +** Copyright (c) 2014-2016 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a copy +** of this software and/or associated documentation files (the "Materials"), +** to deal in the Materials without restriction, including without limitation +** the rights to use, copy, modify, merge, publish, distribute, sublicense, +** and/or sell copies of the Materials, and to permit persons to whom the +** Materials are furnished to do so, subject to the following conditions: +** +** The above copyright notice and this permission notice shall be included in +** all copies or substantial portions of the Materials. +** +** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS +** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND +** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/ +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS +** IN THE MATERIALS. +*/ + +#ifndef GLSLextEXT_H +#define GLSLextEXT_H + +enum BuiltIn; +enum Op; +enum Capability; + +static const int GLSLextEXTVersion = 100; +static const int GLSLextEXTRevision = 1; + +static const char* const E_SPV_EXT_fragment_fully_covered = "SPV_EXT_fragment_fully_covered"; + +#endif // #ifndef GLSLextEXT_H diff --git a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp index 34465f5a2..745021f26 100755 --- a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp +++ b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp @@ -44,6 +44,7 @@ namespace spv { #include "GLSL.std.450.h" #include "GLSL.ext.KHR.h" + #include "GLSL.ext.EXT.h" #ifdef AMD_EXTENSIONS #include "GLSL.ext.AMD.h" #endif @@ -646,6 +647,10 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI builder.addCapability(spv::CapabilityPerViewAttributesNV); } return spv::BuiltInViewportMaskPerViewNV; + case glslang::EbvFragFullyCoveredNV: + builder.addExtension(spv::E_SPV_EXT_fragment_fully_covered); + builder.addCapability(spv::CapabilityFragmentFullyCoveredEXT); + return spv::BuiltInFullyCoveredEXT; #endif default: return spv::BuiltInMax; @@ -2656,13 +2661,6 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, builder.addCapability(spv::CapabilityGeometryStreams); builder.addDecoration(spvType, spv::DecorationStream, type.getQualifier().layoutStream); } - if (glslangIntermediate->getXfbMode()) { - builder.addCapability(spv::CapabilityTransformFeedback); - if (type.getQualifier().hasXfbStride()) - builder.addDecoration(spvType, spv::DecorationXfbStride, type.getQualifier().layoutXfbStride); - if (type.getQualifier().hasXfbBuffer()) - builder.addDecoration(spvType, spv::DecorationXfbBuffer, type.getQualifier().layoutXfbBuffer); - } } // Turn the expression forming the array size into an id. @@ -5503,15 +5501,6 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol builder.addDecoration(id, spv::DecorationIndex, symbol->getQualifier().layoutIndex); if (symbol->getQualifier().hasComponent()) builder.addDecoration(id, spv::DecorationComponent, symbol->getQualifier().layoutComponent); - if (glslangIntermediate->getXfbMode()) { - builder.addCapability(spv::CapabilityTransformFeedback); - if (symbol->getQualifier().hasXfbStride()) - builder.addDecoration(id, spv::DecorationXfbStride, symbol->getQualifier().layoutXfbStride); - if (symbol->getQualifier().hasXfbBuffer()) - builder.addDecoration(id, spv::DecorationXfbBuffer, symbol->getQualifier().layoutXfbBuffer); - if (symbol->getQualifier().hasXfbOffset()) - builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutXfbOffset); - } // atomic counters use this: if (symbol->getQualifier().hasOffset()) builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutOffset); @@ -5538,8 +5527,14 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol builder.addCapability(spv::CapabilityTransformFeedback); if (symbol->getQualifier().hasXfbStride()) builder.addDecoration(id, spv::DecorationXfbStride, symbol->getQualifier().layoutXfbStride); - if (symbol->getQualifier().hasXfbBuffer()) + if (symbol->getQualifier().hasXfbBuffer()) { builder.addDecoration(id, spv::DecorationXfbBuffer, symbol->getQualifier().layoutXfbBuffer); + unsigned stride = glslangIntermediate->getXfbStride(symbol->getQualifier().layoutXfbBuffer); + if (stride != glslang::TQualifier::layoutXfbStrideEnd) + builder.addDecoration(id, spv::DecorationXfbStride, stride); + } + if (symbol->getQualifier().hasXfbOffset()) + builder.addDecoration(id, spv::DecorationOffset, symbol->getQualifier().layoutXfbOffset); } if (symbol->getType().isImage()) { diff --git a/3rdparty/glslang/SPIRV/doc.cpp b/3rdparty/glslang/SPIRV/doc.cpp index f9d5254c7..7d817b492 100755 --- a/3rdparty/glslang/SPIRV/doc.cpp +++ b/3rdparty/glslang/SPIRV/doc.cpp @@ -49,6 +49,7 @@ namespace spv { extern "C" { // Include C-based headers that don't have a namespace #include "GLSL.ext.KHR.h" + #include "GLSL.ext.EXT.h" #ifdef AMD_EXTENSIONS #include "GLSL.ext.AMD.h" #endif @@ -351,6 +352,8 @@ const char* BuiltInString(int builtIn) case 5262: return "ViewportMaskPerViewNV"; #endif + case 5264: return "FullyCoveredEXT"; + case BuiltInCeiling: default: return "Bad"; } @@ -862,6 +865,8 @@ const char* CapabilityString(int info) case 5260: return "PerViewAttributesNV"; #endif + case 5265: return "FragmentFullyCoveredEXT"; + case CapabilityCeiling: default: return "Bad"; } diff --git a/3rdparty/glslang/SPIRV/spirv.hpp b/3rdparty/glslang/SPIRV/spirv.hpp index 8bddf7e50..daef3419f 100755 --- a/3rdparty/glslang/SPIRV/spirv.hpp +++ b/3rdparty/glslang/SPIRV/spirv.hpp @@ -123,6 +123,7 @@ enum ExecutionMode { ExecutionModeVecTypeHint = 30, ExecutionModeContractionOff = 31, ExecutionModePostDepthCoverage = 4446, + ExecutionModeStencilRefReplacingEXT = 5027, ExecutionModeMax = 0x7fffffff, }; @@ -450,6 +451,7 @@ enum BuiltIn { BuiltInSecondaryViewportMaskNV = 5258, BuiltInPositionPerViewNV = 5261, BuiltInViewportMaskPerViewNV = 5262, + BuiltInFullyCoveredEXT = 5264, BuiltInMax = 0x7fffffff, }; @@ -641,7 +643,9 @@ enum Capability { CapabilityAtomicStorageOps = 4445, CapabilitySampleMaskPostDepthCoverage = 4447, CapabilityImageGatherBiasLodAMD = 5009, + CapabilityFragmentMaskAMD = 5010, CapabilityStencilExportEXT = 5013, + CapabilityImageReadWriteLodAMD = 5015, CapabilitySampleMaskOverrideCoverageNV = 5249, CapabilityGeometryShaderPassthroughNV = 5251, CapabilityShaderViewportIndexLayerEXT = 5254, @@ -649,6 +653,10 @@ enum Capability { CapabilityShaderViewportMaskNV = 5255, CapabilityShaderStereoViewNV = 5259, CapabilityPerViewAttributesNV = 5260, + CapabilityFragmentFullyCoveredEXT = 5265, + CapabilitySubgroupShuffleINTEL = 5568, + CapabilitySubgroupBufferBlockIOINTEL = 5569, + CapabilitySubgroupImageBlockIOINTEL = 5570, CapabilityMax = 0x7fffffff, }; @@ -961,6 +969,16 @@ enum Op { OpGroupFMaxNonUniformAMD = 5005, OpGroupUMaxNonUniformAMD = 5006, OpGroupSMaxNonUniformAMD = 5007, + OpFragmentMaskFetchAMD = 5011, + OpFragmentFetchAMD = 5012, + OpSubgroupShuffleINTEL = 5571, + OpSubgroupShuffleDownINTEL = 5572, + OpSubgroupShuffleUpINTEL = 5573, + OpSubgroupShuffleXorINTEL = 5574, + OpSubgroupBlockReadINTEL = 5575, + OpSubgroupBlockWriteINTEL = 5576, + OpSubgroupImageBlockReadINTEL = 5577, + OpSubgroupImageBlockWriteINTEL = 5578, OpMax = 0x7fffffff, }; diff --git a/3rdparty/glslang/StandAlone/StandAlone.cpp b/3rdparty/glslang/StandAlone/StandAlone.cpp index e7844eb21..6b09c8bda 100644 --- a/3rdparty/glslang/StandAlone/StandAlone.cpp +++ b/3rdparty/glslang/StandAlone/StandAlone.cpp @@ -98,6 +98,7 @@ enum TOptions { EOptionStdin = (1 << 27), EOptionOptimizeDisable = (1 << 28), EOptionOptimizeSize = (1 << 29), + EOptionInvertY = (1 << 30), }; // @@ -519,6 +520,9 @@ void ProcessArguments(std::vector>& workItem variableName = argv[1]; bumpArg(); break; + } else if (lowerword == "invert-y" || // synonyms + lowerword == "iy") { + Options |= EOptionInvertY; } else { usage(); } @@ -840,6 +844,9 @@ void CompileAndLinkShaderUnits(std::vector compUnits) if (Options & EOptionAutoMapLocations) shader->setAutoMapLocations(true); + if (Options & EOptionInvertY) + shader->setInvertY(true); + // Set up the environment, some subsettings take precedence over earlier // ways of setting things. if (Options & EOptionSpv) { @@ -1359,6 +1366,7 @@ void usage() " uint32_t array named \n" " initialized with the shader binary code.\n" " --vn synonym for --variable-name \n" + " --invert-y | --iy invert position.Y output in vertex shader\n" ); exit(EFailUsage); diff --git a/3rdparty/glslang/Test/440.vert b/3rdparty/glslang/Test/440.vert index 2e61f7975..4ab6f2ee2 100644 --- a/3rdparty/glslang/Test/440.vert +++ b/3rdparty/glslang/Test/440.vert @@ -174,6 +174,12 @@ out layout(xfb_buffer=7, xfb_offset=0) bblck10 { // link ERROR, implicit stride float f; } bbinst10; +layout(xfb_buffer = 3) out; +layout(xfb_offset = 32) out gl_PerVertex { + layout(xfb_buffer = 2) float gl_PointSize; // ERROR, change in xfb_buffer + vec4 gl_Position; +}; + int drawParamsBad() { return gl_BaseVertexARB + gl_BaseInstanceARB + gl_DrawIDARB; // ERROR, extension not requested diff --git a/3rdparty/glslang/Test/baseResults/400.geom.out b/3rdparty/glslang/Test/baseResults/400.geom.out index 1d009d9ca..52ebebced 100644 --- a/3rdparty/glslang/Test/baseResults/400.geom.out +++ b/3rdparty/glslang/Test/baseResults/400.geom.out @@ -1,7 +1,7 @@ 400.geom ERROR: 0:12: 'invocations' : can only apply to a standalone qualifier ERROR: 0:20: 'patch' : not supported in this stage: geometry -ERROR: 0:20: 'gl_PointSize' : cannot add layout to redeclared block member +ERROR: 0:20: 'gl_PointSize' : cannot add non-XFB layout to redeclared block member ERROR: 0:20: 'gl_PointSize' : cannot add patch to redeclared block member ERROR: 0:25: 'length' : array must first be sized by a redeclaration or layout qualifier ERROR: 0:36: 'length' : array must first be sized by a redeclaration or layout qualifier diff --git a/3rdparty/glslang/Test/baseResults/440.vert.out b/3rdparty/glslang/Test/baseResults/440.vert.out index 8eafb0aea..33738aaa5 100644 --- a/3rdparty/glslang/Test/baseResults/440.vert.out +++ b/3rdparty/glslang/Test/baseResults/440.vert.out @@ -46,51 +46,52 @@ ERROR: 0:166: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers ERROR: 0:169: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4 ERROR: 0:169: 'xfb_stride' : 1/4 stride is too large: gl_MaxTransformFeedbackInterleavedComponents is 64 ERROR: 0:171: 'xfb_buffer' : buffer is too large: gl_MaxTransformFeedbackBuffers is 4 -ERROR: 0:179: 'gl_BaseVertexARB' : required extension not requested: GL_ARB_shader_draw_parameters -ERROR: 0:179: 'gl_BaseInstanceARB' : required extension not requested: GL_ARB_shader_draw_parameters -ERROR: 0:179: 'gl_DrawIDARB' : required extension not requested: GL_ARB_shader_draw_parameters -ERROR: 0:187: 'assign' : l-value required "gl_BaseVertexARB" (can't modify shader input) -ERROR: 0:188: 'assign' : l-value required "gl_BaseInstanceARB" (can't modify shader input) -ERROR: 0:189: 'assign' : l-value required "gl_DrawIDARB" (can't modify shader input) -ERROR: 0:190: 'glBaseInstanceARB' : undeclared identifier -ERROR: 54 compilation errors. No code generated. +ERROR: 0:179: 'xfb_buffer' : member cannot contradict block (or what block inherited from global) +ERROR: 0:185: 'gl_BaseVertexARB' : required extension not requested: GL_ARB_shader_draw_parameters +ERROR: 0:185: 'gl_BaseInstanceARB' : required extension not requested: GL_ARB_shader_draw_parameters +ERROR: 0:185: 'gl_DrawIDARB' : required extension not requested: GL_ARB_shader_draw_parameters +ERROR: 0:193: 'assign' : l-value required "gl_BaseVertexARB" (can't modify shader input) +ERROR: 0:194: 'assign' : l-value required "gl_BaseInstanceARB" (can't modify shader input) +ERROR: 0:195: 'assign' : l-value required "gl_DrawIDARB" (can't modify shader input) +ERROR: 0:196: 'glBaseInstanceARB' : undeclared identifier +ERROR: 55 compilation errors. No code generated. Shader version: 440 Requested GL_ARB_shader_draw_parameters in xfb mode ERROR: node is still EOpNull! -0:177 Function Definition: drawParamsBad( ( global int) -0:177 Function Parameters: -0:179 Sequence -0:179 Branch: Return with expression -0:179 add ( temp int) -0:179 add ( temp int) -0:179 'gl_BaseVertexARB' ( in int BaseVertex) -0:179 'gl_BaseInstanceARB' ( in int BaseInstance) -0:179 'gl_DrawIDARB' ( in int DrawId) -0:184 Function Definition: drawParams( ( global int) -0:184 Function Parameters: -0:186 Sequence -0:186 Branch: Return with expression -0:186 add ( temp int) -0:186 add ( temp int) -0:186 'gl_BaseVertexARB' ( in int BaseVertex) -0:186 'gl_BaseInstanceARB' ( in int BaseInstance) -0:186 'gl_DrawIDARB' ( in int DrawId) -0:187 move second child to first child ( temp int) -0:187 'gl_BaseVertexARB' ( in int BaseVertex) -0:187 Constant: -0:187 3 (const int) -0:188 move second child to first child ( temp int) -0:188 'gl_BaseInstanceARB' ( in int BaseInstance) -0:188 Constant: -0:188 3 (const int) -0:189 move second child to first child ( temp int) -0:189 'gl_DrawIDARB' ( in int DrawId) -0:189 Constant: -0:189 3 (const int) -0:190 'glBaseInstanceARB' ( temp float) +0:183 Function Definition: drawParamsBad( ( global int) +0:183 Function Parameters: +0:185 Sequence +0:185 Branch: Return with expression +0:185 add ( temp int) +0:185 add ( temp int) +0:185 'gl_BaseVertexARB' ( in int BaseVertex) +0:185 'gl_BaseInstanceARB' ( in int BaseInstance) +0:185 'gl_DrawIDARB' ( in int DrawId) +0:190 Function Definition: drawParams( ( global int) +0:190 Function Parameters: +0:192 Sequence +0:192 Branch: Return with expression +0:192 add ( temp int) +0:192 add ( temp int) +0:192 'gl_BaseVertexARB' ( in int BaseVertex) +0:192 'gl_BaseInstanceARB' ( in int BaseInstance) +0:192 'gl_DrawIDARB' ( in int DrawId) +0:193 move second child to first child ( temp int) +0:193 'gl_BaseVertexARB' ( in int BaseVertex) +0:193 Constant: +0:193 3 (const int) +0:194 move second child to first child ( temp int) +0:194 'gl_BaseInstanceARB' ( in int BaseInstance) +0:194 Constant: +0:194 3 (const int) +0:195 move second child to first child ( temp int) +0:195 'gl_DrawIDARB' ( in int DrawId) +0:195 Constant: +0:195 3 (const int) +0:196 'glBaseInstanceARB' ( temp float) 0:? Linker Objects 0:? 'a' (layout( location=2 component=2) in 2-component vector of float) 0:? 'b' (layout( location=2 component=1) in float) @@ -153,6 +154,7 @@ ERROR: node is still EOpNull! 0:? 'bbinst9' ( out block{layout( xfb_buffer=4 xfb_offset=1) out bool b, layout( xfb_buffer=4 xfb_offset=12) out structure{ global bool b, global structure{ global int i, global double d, global float f} s, global 2-component vector of float v2} t, layout( xfb_buffer=4 xfb_offset=52) out 3X3 matrix of float m3, layout( xfb_buffer=4 xfb_offset=90) out int i, layout( xfb_buffer=4 xfb_offset=98) out double d, layout( xfb_buffer=4 xfb_offset=108) out structure{ global int a} s}) 0:? 'bm' (layout( xfb_buffer=5 xfb_offset=0) smooth out float) 0:? 'bbinst10' ( out block{layout( xfb_buffer=7 xfb_offset=0) out 4X4 matrix of double m1, layout( xfb_buffer=7 xfb_offset=128) out 4X4 matrix of double m2, layout( xfb_buffer=7 xfb_offset=256) out float f}) +0:? 'anon@0' ( out block{layout( xfb_buffer=0 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=0 xfb_offset=32) gl_PointSize float PointSize gl_PointSize, }) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) @@ -235,6 +237,7 @@ ERROR: node is still EOpNull! 0:? 'bbinst9' ( out block{layout( xfb_buffer=4 xfb_offset=1) out bool b, layout( xfb_buffer=4 xfb_offset=12) out structure{ global bool b, global structure{ global int i, global double d, global float f} s, global 2-component vector of float v2} t, layout( xfb_buffer=4 xfb_offset=52) out 3X3 matrix of float m3, layout( xfb_buffer=4 xfb_offset=90) out int i, layout( xfb_buffer=4 xfb_offset=98) out double d, layout( xfb_buffer=4 xfb_offset=108) out structure{ global int a} s}) 0:? 'bm' (layout( xfb_buffer=5 xfb_offset=0) smooth out float) 0:? 'bbinst10' ( out block{layout( xfb_buffer=7 xfb_offset=0) out 4X4 matrix of double m1, layout( xfb_buffer=7 xfb_offset=128) out 4X4 matrix of double m2, layout( xfb_buffer=7 xfb_offset=256) out float f}) +0:? 'anon@0' ( out block{layout( xfb_buffer=0 xfb_offset=36) gl_Position 4-component vector of float Position gl_Position, layout( xfb_buffer=0 xfb_offset=32) gl_PointSize float PointSize gl_PointSize, }) 0:? 'gl_VertexID' ( gl_VertexId int VertexId) 0:? 'gl_InstanceID' ( gl_InstanceId int InstanceId) diff --git a/3rdparty/glslang/Test/baseResults/hlsl.hull.4.tesc.out b/3rdparty/glslang/Test/baseResults/hlsl.hull.4.tesc.out index 139d7d410..3349df81a 100644 --- a/3rdparty/glslang/Test/baseResults/hlsl.hull.4.tesc.out +++ b/3rdparty/glslang/Test/baseResults/hlsl.hull.4.tesc.out @@ -159,10 +159,9 @@ triangle order = cw 0:? 'cpid' ( in uint InvocationID) 0:39 Sequence 0:39 move second child to first child ( temp 4-component vector of float) -0:39 direct index ( out 4-component vector of float Position) +0:39 indirect index ( out 4-component vector of float Position) 0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position) -0:39 Constant: -0:39 0 (const int) +0:? 'cpid' ( in uint InvocationID) 0:39 m_Position: direct index for structure ( temp 4-component vector of float) 0:39 Function Call: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position}) 0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal}) @@ -400,10 +399,9 @@ triangle order = cw 0:? 'cpid' ( in uint InvocationID) 0:39 Sequence 0:39 move second child to first child ( temp 4-component vector of float) -0:39 direct index ( out 4-component vector of float Position) +0:39 indirect index ( out 4-component vector of float Position) 0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position) -0:39 Constant: -0:39 0 (const int) +0:? 'cpid' ( in uint InvocationID) 0:39 m_Position: direct index for structure ( temp 4-component vector of float) 0:39 Function Call: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position}) 0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal}) @@ -479,12 +477,12 @@ triangle order = cw // Module Version 10000 // Generated by (magic number): 80002 -// Id's are bound by 127 +// Id's are bound by 128 Capability Tessellation 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationControl 4 "main" 56 64 83 86 110 123 + EntryPoint TessellationControl 4 "main" 56 64 83 86 111 124 ExecutionMode 4 OutputVertices 3 ExecutionMode 4 Triangles ExecutionMode 4 SpacingFractionalOdd @@ -514,20 +512,20 @@ triangle order = cw Name 81 "cpid" Name 83 "cpid" Name 86 "@entryPointOutput.m_Position" - Name 87 "param" - Name 89 "param" - Name 103 "@patchConstantResult" - Name 104 "param" - Name 110 "@patchConstantOutput.fTessFactor" - Name 123 "@patchConstantOutput.fInsideTessFactor" + Name 88 "param" + Name 90 "param" + Name 104 "@patchConstantResult" + Name 105 "param" + Name 111 "@patchConstantOutput.fTessFactor" + Name 124 "@patchConstantOutput.fInsideTessFactor" Decorate 56(I.m_Position) BuiltIn Position Decorate 64(I) Location 0 Decorate 83(cpid) BuiltIn InvocationId Decorate 86(@entryPointOutput.m_Position) BuiltIn Position - Decorate 110(@patchConstantOutput.fTessFactor) Patch - Decorate 110(@patchConstantOutput.fTessFactor) BuiltIn TessLevelOuter - Decorate 123(@patchConstantOutput.fInsideTessFactor) Patch - Decorate 123(@patchConstantOutput.fInsideTessFactor) BuiltIn TessLevelInner + Decorate 111(@patchConstantOutput.fTessFactor) Patch + Decorate 111(@patchConstantOutput.fTessFactor) BuiltIn TessLevelOuter + Decorate 124(@patchConstantOutput.fInsideTessFactor) Patch + Decorate 124(@patchConstantOutput.fInsideTessFactor) BuiltIn TessLevelInner 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -568,27 +566,27 @@ triangle order = cw 83(cpid): 82(ptr) Variable Input 85: TypePointer Output 54 86(@entryPointOutput.m_Position): 85(ptr) Variable Output - 93: TypePointer Output 7(fvec4) - 95: 9(int) Constant 2 - 96: 9(int) Constant 1 - 97: 9(int) Constant 0 - 99: TypeBool - 107: 9(int) Constant 4 - 108: TypeArray 6(float) 107 - 109: TypePointer Output 108 -110(@patchConstantOutput.fTessFactor): 109(ptr) Variable Output - 113: TypePointer Output 6(float) - 121: TypeArray 6(float) 95 - 122: TypePointer Output 121 -123(@patchConstantOutput.fInsideTessFactor): 122(ptr) Variable Output + 94: TypePointer Output 7(fvec4) + 96: 9(int) Constant 2 + 97: 9(int) Constant 1 + 98: 9(int) Constant 0 + 100: TypeBool + 108: 9(int) Constant 4 + 109: TypeArray 6(float) 108 + 110: TypePointer Output 109 +111(@patchConstantOutput.fTessFactor): 110(ptr) Variable Output + 114: TypePointer Output 6(float) + 122: TypeArray 6(float) 96 + 123: TypePointer Output 122 +124(@patchConstantOutput.fInsideTessFactor): 123(ptr) Variable Output 4(main): 2 Function None 3 5: Label 53(I): 12(ptr) Variable Function 81(cpid): 19(ptr) Variable Function - 87(param): 12(ptr) Variable Function - 89(param): 19(ptr) Variable Function -103(@patchConstantResult): 26(ptr) Variable Function - 104(param): 12(ptr) Variable Function + 88(param): 12(ptr) Variable Function + 90(param): 19(ptr) Variable Function +104(@patchConstantResult): 26(ptr) Variable Function + 105(param): 12(ptr) Variable Function 58: 57(ptr) AccessChain 56(I.m_Position) 33 59: 7(fvec4) Load 58 60: 48(ptr) AccessChain 53(I) 33 33 @@ -615,42 +613,43 @@ triangle order = cw Store 80 79 84: 9(int) Load 83(cpid) Store 81(cpid) 84 - 88: 11 Load 53(I) - Store 87(param) 88 - 90: 9(int) Load 81(cpid) - Store 89(param) 90 - 91:20(HS_Main_Output) FunctionCall 24(@main(struct-HS_Input-vf4-vf41[3];u1;) 87(param) 89(param) - 92: 7(fvec4) CompositeExtract 91 0 - 94: 93(ptr) AccessChain 86(@entryPointOutput.m_Position) 33 - Store 94 92 - ControlBarrier 95 96 97 - 98: 9(int) Load 83(cpid) - 100: 99(bool) IEqual 98 33 - SelectionMerge 102 None - BranchConditional 100 101 102 - 101: Label - 105: 11 Load 53(I) - Store 104(param) 105 - 106:14(HS_Output) FunctionCall 17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];) 104(param) - Store 103(@patchConstantResult) 106 - 111: 34(ptr) AccessChain 103(@patchConstantResult) 33 33 - 112: 6(float) Load 111 - 114: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 33 - Store 114 112 - 115: 34(ptr) AccessChain 103(@patchConstantResult) 33 32 - 116: 6(float) Load 115 - 117: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 32 - Store 117 116 - 118: 34(ptr) AccessChain 103(@patchConstantResult) 33 74 - 119: 6(float) Load 118 - 120: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 74 - Store 120 119 - 124: 34(ptr) AccessChain 103(@patchConstantResult) 32 - 125: 6(float) Load 124 - 126: 113(ptr) AccessChain 123(@patchConstantOutput.fInsideTessFactor) 33 - Store 126 125 - Branch 102 - 102: Label + 87: 9(int) Load 83(cpid) + 89: 11 Load 53(I) + Store 88(param) 89 + 91: 9(int) Load 81(cpid) + Store 90(param) 91 + 92:20(HS_Main_Output) FunctionCall 24(@main(struct-HS_Input-vf4-vf41[3];u1;) 88(param) 90(param) + 93: 7(fvec4) CompositeExtract 92 0 + 95: 94(ptr) AccessChain 86(@entryPointOutput.m_Position) 87 + Store 95 93 + ControlBarrier 96 97 98 + 99: 9(int) Load 83(cpid) + 101: 100(bool) IEqual 99 33 + SelectionMerge 103 None + BranchConditional 101 102 103 + 102: Label + 106: 11 Load 53(I) + Store 105(param) 106 + 107:14(HS_Output) FunctionCall 17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];) 105(param) + Store 104(@patchConstantResult) 107 + 112: 34(ptr) AccessChain 104(@patchConstantResult) 33 33 + 113: 6(float) Load 112 + 115: 114(ptr) AccessChain 111(@patchConstantOutput.fTessFactor) 33 + Store 115 113 + 116: 34(ptr) AccessChain 104(@patchConstantResult) 33 32 + 117: 6(float) Load 116 + 118: 114(ptr) AccessChain 111(@patchConstantOutput.fTessFactor) 32 + Store 118 117 + 119: 34(ptr) AccessChain 104(@patchConstantResult) 33 74 + 120: 6(float) Load 119 + 121: 114(ptr) AccessChain 111(@patchConstantOutput.fTessFactor) 74 + Store 121 120 + 125: 34(ptr) AccessChain 104(@patchConstantResult) 32 + 126: 6(float) Load 125 + 127: 114(ptr) AccessChain 124(@patchConstantOutput.fInsideTessFactor) 33 + Store 127 126 + Branch 103 + 103: Label Return FunctionEnd 17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];):14(HS_Output) Function None 15 diff --git a/3rdparty/glslang/Test/baseResults/hlsl.hull.5.tesc.out b/3rdparty/glslang/Test/baseResults/hlsl.hull.5.tesc.out index 3a42b52e6..656427b6d 100644 --- a/3rdparty/glslang/Test/baseResults/hlsl.hull.5.tesc.out +++ b/3rdparty/glslang/Test/baseResults/hlsl.hull.5.tesc.out @@ -80,10 +80,9 @@ ERROR: node is still EOpNull! 0:? 'cpid' ( in uint InvocationID) 0:39 Sequence 0:39 move second child to first child ( temp 4-component vector of float) -0:39 direct index ( out 4-component vector of float Position) +0:39 indirect index ( out 4-component vector of float Position) 0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position) -0:39 Constant: -0:39 0 (const int) +0:? 'cpid' ( in uint InvocationID) 0:39 m_Position: direct index for structure ( temp 4-component vector of float) 0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position}) 0:? 'cpid' ( temp uint) @@ -174,10 +173,9 @@ ERROR: node is still EOpNull! 0:? 'cpid' ( in uint InvocationID) 0:39 Sequence 0:39 move second child to first child ( temp 4-component vector of float) -0:39 direct index ( out 4-component vector of float Position) +0:39 indirect index ( out 4-component vector of float Position) 0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position) -0:39 Constant: -0:39 0 (const int) +0:? 'cpid' ( in uint InvocationID) 0:39 m_Position: direct index for structure ( temp 4-component vector of float) 0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position}) 0:? 'cpid' ( temp uint) diff --git a/3rdparty/glslang/Test/baseResults/hlsl.y-negate-1.vert.out b/3rdparty/glslang/Test/baseResults/hlsl.y-negate-1.vert.out new file mode 100644 index 000000000..332339eb1 --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/hlsl.y-negate-1.vert.out @@ -0,0 +1,113 @@ +hlsl.y-negate-1.vert +Shader version: 500 +0:? Sequence +0:7 Function Definition: @main( ( temp 4-component vector of float) +0:7 Function Parameters: +0:? Sequence +0:8 Branch: Return with expression +0:8 pos: direct index for structure ( uniform 4-component vector of float) +0:8 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:8 Constant: +0:8 0 (const uint) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Function Call: @main( ( temp 4-component vector of float) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Constant: +0:7 1 (const int) +0:7 Negate value ( temp float) +0:7 direct index ( temp float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Constant: +0:7 1 (const int) +0:7 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' ( out 4-component vector of float Position) +0:7 '@position' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:? '@entryPointOutput' ( out 4-component vector of float Position) + + +Linked vertex stage: + + +Shader version: 500 +0:? Sequence +0:7 Function Definition: @main( ( temp 4-component vector of float) +0:7 Function Parameters: +0:? Sequence +0:8 Branch: Return with expression +0:8 pos: direct index for structure ( uniform 4-component vector of float) +0:8 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:8 Constant: +0:8 0 (const uint) +0:7 Function Definition: main( ( temp void) +0:7 Function Parameters: +0:? Sequence +0:7 Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Function Call: @main( ( temp 4-component vector of float) +0:7 move second child to first child ( temp float) +0:7 direct index ( temp float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Constant: +0:7 1 (const int) +0:7 Negate value ( temp float) +0:7 direct index ( temp float) +0:7 '@position' ( temp 4-component vector of float) +0:7 Constant: +0:7 1 (const int) +0:7 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput' ( out 4-component vector of float Position) +0:7 '@position' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:? '@entryPointOutput' ( out 4-component vector of float Position) + +// Module Version 10000 +// Generated by (magic number): 80002 +// Id's are bound by 41 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 32 + Source HLSL 500 + Name 4 "main" + Name 11 "$Global" + MemberName 11($Global) 0 "pos" + Name 13 "" + Name 32 "@entryPointOutput" + MemberDecorate 11($Global) 0 Offset 0 + Decorate 11($Global) Block + Decorate 13 DescriptorSet 0 + Decorate 32(@entryPointOutput) BuiltIn Position + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 11($Global): TypeStruct 7(fvec4) + 12: TypePointer Uniform 11($Global) + 13: 12(ptr) Variable Uniform + 14: TypeInt 32 1 + 15: 14(int) Constant 0 + 16: TypePointer Uniform 7(fvec4) + 31: TypePointer Output 7(fvec4) +32(@entryPointOutput): 31(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 35: 16(ptr) AccessChain 13 15 + 36: 7(fvec4) Load 35 + 38: 6(float) CompositeExtract 36 1 + 29: 6(float) FNegate 38 + 40: 7(fvec4) CompositeInsert 29 36 1 + Store 32(@entryPointOutput) 40 + Return + FunctionEnd diff --git a/3rdparty/glslang/Test/baseResults/hlsl.y-negate-2.vert.out b/3rdparty/glslang/Test/baseResults/hlsl.y-negate-2.vert.out new file mode 100644 index 000000000..57f8e01a4 --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/hlsl.y-negate-2.vert.out @@ -0,0 +1,121 @@ +hlsl.y-negate-2.vert +Shader version: 500 +0:? Sequence +0:6 Function Definition: @main(vf4; ( temp void) +0:6 Function Parameters: +0:6 'position' ( out 4-component vector of float) +0:? Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 'position' ( out 4-component vector of float) +0:7 pos: direct index for structure ( uniform 4-component vector of float) +0:7 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:7 Constant: +0:7 0 (const uint) +0:6 Function Definition: main( ( temp void) +0:6 Function Parameters: +0:? Sequence +0:6 Function Call: @main(vf4; ( temp void) +0:? 'position' ( temp 4-component vector of float) +0:6 Sequence +0:6 move second child to first child ( temp 4-component vector of float) +0:6 '@position' ( temp 4-component vector of float) +0:? 'position' ( temp 4-component vector of float) +0:6 move second child to first child ( temp float) +0:6 direct index ( temp float) +0:6 '@position' ( temp 4-component vector of float) +0:6 Constant: +0:6 1 (const int) +0:6 Negate value ( temp float) +0:6 direct index ( temp float) +0:6 '@position' ( temp 4-component vector of float) +0:6 Constant: +0:6 1 (const int) +0:6 move second child to first child ( temp 4-component vector of float) +0:? 'position' ( out 4-component vector of float Position) +0:6 '@position' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:? 'position' ( out 4-component vector of float Position) + + +Linked vertex stage: + + +Shader version: 500 +0:? Sequence +0:6 Function Definition: @main(vf4; ( temp void) +0:6 Function Parameters: +0:6 'position' ( out 4-component vector of float) +0:? Sequence +0:7 move second child to first child ( temp 4-component vector of float) +0:7 'position' ( out 4-component vector of float) +0:7 pos: direct index for structure ( uniform 4-component vector of float) +0:7 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:7 Constant: +0:7 0 (const uint) +0:6 Function Definition: main( ( temp void) +0:6 Function Parameters: +0:? Sequence +0:6 Function Call: @main(vf4; ( temp void) +0:? 'position' ( temp 4-component vector of float) +0:6 Sequence +0:6 move second child to first child ( temp 4-component vector of float) +0:6 '@position' ( temp 4-component vector of float) +0:? 'position' ( temp 4-component vector of float) +0:6 move second child to first child ( temp float) +0:6 direct index ( temp float) +0:6 '@position' ( temp 4-component vector of float) +0:6 Constant: +0:6 1 (const int) +0:6 Negate value ( temp float) +0:6 direct index ( temp float) +0:6 '@position' ( temp 4-component vector of float) +0:6 Constant: +0:6 1 (const int) +0:6 move second child to first child ( temp 4-component vector of float) +0:? 'position' ( out 4-component vector of float Position) +0:6 '@position' ( temp 4-component vector of float) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float pos}) +0:? 'position' ( out 4-component vector of float Position) + +// Module Version 10000 +// Generated by (magic number): 80002 +// Id's are bound by 43 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 35 + Source HLSL 500 + Name 4 "main" + Name 13 "$Global" + MemberName 13($Global) 0 "pos" + Name 15 "" + Name 35 "position" + MemberDecorate 13($Global) 0 Offset 0 + Decorate 13($Global) Block + Decorate 15 DescriptorSet 0 + Decorate 35(position) BuiltIn Position + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 13($Global): TypeStruct 7(fvec4) + 14: TypePointer Uniform 13($Global) + 15: 14(ptr) Variable Uniform + 16: TypeInt 32 1 + 17: 16(int) Constant 0 + 18: TypePointer Uniform 7(fvec4) + 34: TypePointer Output 7(fvec4) + 35(position): 34(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 37: 18(ptr) AccessChain 15 17 + 38: 7(fvec4) Load 37 + 40: 6(float) CompositeExtract 38 1 + 32: 6(float) FNegate 40 + 42: 7(fvec4) CompositeInsert 32 38 1 + Store 35(position) 42 + Return + FunctionEnd diff --git a/3rdparty/glslang/Test/baseResults/hlsl.y-negate-3.vert.out b/3rdparty/glslang/Test/baseResults/hlsl.y-negate-3.vert.out new file mode 100644 index 000000000..5983c2b79 --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/hlsl.y-negate-3.vert.out @@ -0,0 +1,177 @@ +hlsl.y-negate-3.vert +Shader version: 500 +0:? Sequence +0:11 Function Definition: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Parameters: +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of float) +0:14 pos: direct index for structure ( temp 4-component vector of float) +0:14 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:14 Constant: +0:14 0 (const int) +0:14 position: direct index for structure ( uniform 4-component vector of float) +0:14 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position}) +0:14 Constant: +0:14 0 (const uint) +0:15 move second child to first child ( temp int) +0:15 somethingelse: direct index for structure ( temp int) +0:15 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:15 Constant: +0:15 1 (const int) +0:15 Constant: +0:15 42 (const int) +0:17 Branch: Return with expression +0:17 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Definition: main( ( temp void) +0:11 Function Parameters: +0:? Sequence +0:11 Sequence +0:11 move second child to first child ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Call: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 '@position' ( temp 4-component vector of float) +0:11 pos: direct index for structure ( temp 4-component vector of float) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Constant: +0:11 0 (const int) +0:11 move second child to first child ( temp float) +0:11 direct index ( temp float) +0:11 '@position' ( temp 4-component vector of float) +0:11 Constant: +0:11 1 (const int) +0:11 Negate value ( temp float) +0:11 direct index ( temp float) +0:11 '@position' ( temp 4-component vector of float) +0:11 Constant: +0:11 1 (const int) +0:11 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput.pos' ( out 4-component vector of float Position) +0:11 '@position' ( temp 4-component vector of float) +0:11 move second child to first child ( temp int) +0:? '@entryPointOutput.somethingelse' (layout( location=0) out int) +0:11 somethingelse: direct index for structure ( temp int) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Constant: +0:11 1 (const int) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position}) +0:? '@entryPointOutput.pos' ( out 4-component vector of float Position) +0:? '@entryPointOutput.somethingelse' (layout( location=0) out int) + + +Linked vertex stage: + + +Shader version: 500 +0:? Sequence +0:11 Function Definition: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Parameters: +0:? Sequence +0:14 move second child to first child ( temp 4-component vector of float) +0:14 pos: direct index for structure ( temp 4-component vector of float) +0:14 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:14 Constant: +0:14 0 (const int) +0:14 position: direct index for structure ( uniform 4-component vector of float) +0:14 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position}) +0:14 Constant: +0:14 0 (const uint) +0:15 move second child to first child ( temp int) +0:15 somethingelse: direct index for structure ( temp int) +0:15 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:15 Constant: +0:15 1 (const int) +0:15 Constant: +0:15 42 (const int) +0:17 Branch: Return with expression +0:17 'vsout' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Definition: main( ( temp void) +0:11 Function Parameters: +0:? Sequence +0:11 Sequence +0:11 move second child to first child ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Function Call: @main( ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Sequence +0:11 move second child to first child ( temp 4-component vector of float) +0:11 '@position' ( temp 4-component vector of float) +0:11 pos: direct index for structure ( temp 4-component vector of float) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Constant: +0:11 0 (const int) +0:11 move second child to first child ( temp float) +0:11 direct index ( temp float) +0:11 '@position' ( temp 4-component vector of float) +0:11 Constant: +0:11 1 (const int) +0:11 Negate value ( temp float) +0:11 direct index ( temp float) +0:11 '@position' ( temp 4-component vector of float) +0:11 Constant: +0:11 1 (const int) +0:11 move second child to first child ( temp 4-component vector of float) +0:? '@entryPointOutput.pos' ( out 4-component vector of float Position) +0:11 '@position' ( temp 4-component vector of float) +0:11 move second child to first child ( temp int) +0:? '@entryPointOutput.somethingelse' (layout( location=0) out int) +0:11 somethingelse: direct index for structure ( temp int) +0:11 'flattenTemp' ( temp structure{ temp 4-component vector of float pos, temp int somethingelse}) +0:11 Constant: +0:11 1 (const int) +0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float position}) +0:? '@entryPointOutput.pos' ( out 4-component vector of float Position) +0:? '@entryPointOutput.somethingelse' (layout( location=0) out int) + +// Module Version 10000 +// Generated by (magic number): 80002 +// Id's are bound by 67 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 44 47 + Source HLSL 500 + Name 4 "main" + Name 9 "VS_OUT" + MemberName 9(VS_OUT) 0 "pos" + MemberName 9(VS_OUT) 1 "somethingelse" + Name 16 "$Global" + MemberName 16($Global) 0 "position" + Name 18 "" + Name 44 "@entryPointOutput.pos" + Name 47 "@entryPointOutput.somethingelse" + MemberDecorate 16($Global) 0 Offset 0 + Decorate 16($Global) Block + Decorate 18 DescriptorSet 0 + Decorate 44(@entryPointOutput.pos) BuiltIn Position + Decorate 47(@entryPointOutput.somethingelse) Location 0 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeInt 32 1 + 9(VS_OUT): TypeStruct 7(fvec4) 8(int) + 15: 8(int) Constant 0 + 16($Global): TypeStruct 7(fvec4) + 17: TypePointer Uniform 16($Global) + 18: 17(ptr) Variable Uniform + 19: TypePointer Uniform 7(fvec4) + 25: 8(int) Constant 42 + 43: TypePointer Output 7(fvec4) +44(@entryPointOutput.pos): 43(ptr) Variable Output + 46: TypePointer Output 8(int) +47(@entryPointOutput.somethingelse): 46(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 52: 19(ptr) AccessChain 18 15 + 53: 7(fvec4) Load 52 + 64: 6(float) CompositeExtract 53 1 + 41: 6(float) FNegate 64 + 66: 7(fvec4) CompositeInsert 41 53 1 + Store 44(@entryPointOutput.pos) 66 + Store 47(@entryPointOutput.somethingelse) 25 + Return + FunctionEnd diff --git a/3rdparty/glslang/Test/baseResults/spv.builtInXFB.vert.out b/3rdparty/glslang/Test/baseResults/spv.builtInXFB.vert.out new file mode 100755 index 000000000..f13dfe1b2 --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/spv.builtInXFB.vert.out @@ -0,0 +1,47 @@ +spv.builtInXFB.vert +// Module Version 10000 +// Generated by (magic number): 80002 +// Id's are bound by 21 + + Capability Shader + Capability TransformFeedback + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 10 + ExecutionMode 4 Xfb + Source GLSL 450 + Name 4 "main" + Name 8 "gl_PerVertex" + MemberName 8(gl_PerVertex) 0 "gl_Position" + MemberName 8(gl_PerVertex) 1 "gl_PointSize" + Name 10 "" + MemberDecorate 8(gl_PerVertex) 0 Offset 20 + MemberDecorate 8(gl_PerVertex) 0 BuiltIn Position + MemberDecorate 8(gl_PerVertex) 1 Offset 16 + MemberDecorate 8(gl_PerVertex) 1 BuiltIn PointSize + Decorate 8(gl_PerVertex) Block + Decorate 10 XfbBuffer 1 + Decorate 10 XfbStride 64 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8(gl_PerVertex): TypeStruct 7(fvec4) 6(float) + 9: TypePointer Output 8(gl_PerVertex) + 10: 9(ptr) Variable Output + 11: TypeInt 32 1 + 12: 11(int) Constant 0 + 13: 6(float) Constant 1065353216 + 14: 7(fvec4) ConstantComposite 13 13 13 13 + 15: TypePointer Output 7(fvec4) + 17: 11(int) Constant 1 + 18: 6(float) Constant 1073741824 + 19: TypePointer Output 6(float) + 4(main): 2 Function None 3 + 5: Label + 16: 15(ptr) AccessChain 10 12 + Store 16 14 + 20: 19(ptr) AccessChain 10 17 + Store 20 18 + Return + FunctionEnd diff --git a/3rdparty/glslang/Test/baseResults/spv.fullyCovered.frag.out b/3rdparty/glslang/Test/baseResults/spv.fullyCovered.frag.out new file mode 100644 index 000000000..4df1c5541 --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/spv.fullyCovered.frag.out @@ -0,0 +1,37 @@ +spv.fullyCovered.frag +// Module Version 10000 +// Generated by (magic number): 80002 +// Id's are bound by 18 + + Capability Shader + Capability FragmentFullyCoveredEXT + Extension "SPV_EXT_fragment_fully_covered" + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 9 12 + ExecutionMode 4 OriginUpperLeft + Source GLSL 450 + SourceExtension "GL_NV_conservative_raster_underestimation" + Name 4 "main" + Name 9 "color" + Name 12 "gl_FragFullyCoveredNV" + Decorate 12(gl_FragFullyCoveredNV) BuiltIn FullyCoveredEXT + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Output 7(fvec4) + 9(color): 8(ptr) Variable Output + 10: TypeBool + 11: TypePointer Input 10(bool) +12(gl_FragFullyCoveredNV): 11(ptr) Variable Input + 14: 6(float) Constant 0 + 15: 6(float) Constant 1065353216 + 4(main): 2 Function None 3 + 5: Label + 13: 10(bool) Load 12(gl_FragFullyCoveredNV) + 16: 6(float) Select 13 15 14 + 17: 7(fvec4) CompositeConstruct 16 14 14 14 + Store 9(color) 17 + Return + FunctionEnd diff --git a/3rdparty/glslang/Test/baseResults/spv.xfb.vert.out b/3rdparty/glslang/Test/baseResults/spv.xfb.vert.out new file mode 100755 index 000000000..f60982681 --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/spv.xfb.vert.out @@ -0,0 +1,55 @@ +spv.xfb.vert +// Module Version 10000 +// Generated by (magic number): 80002 +// Id's are bound by 16 + + Capability Shader + Capability TransformFeedback + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 8 11 14 15 + ExecutionMode 4 Xfb + Source GLSL 450 + Name 4 "main" + Name 8 "out1" + Name 9 "outXfb" + MemberName 9(outXfb) 0 "out2" + Name 11 "" + Name 12 "outXfb2" + MemberName 12(outXfb2) 0 "out3" + Name 14 "" + Name 15 "out4" + Decorate 8(out1) Location 0 + Decorate 8(out1) XfbBuffer 3 + Decorate 8(out1) XfbStride 48 + Decorate 8(out1) Offset 12 + MemberDecorate 9(outXfb) 0 Offset 8 + Decorate 9(outXfb) Block + Decorate 11 Location 1 + Decorate 11 XfbBuffer 2 + Decorate 11 XfbStride 32 + MemberDecorate 12(outXfb2) 0 Offset 60 + Decorate 12(outXfb2) Block + Decorate 14 Location 3 + Decorate 14 XfbBuffer 1 + Decorate 14 XfbStride 64 + Decorate 15(out4) Location 4 + Decorate 15(out4) XfbBuffer 0 + Decorate 15(out4) XfbStride 8 + Decorate 15(out4) Offset 4 + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypePointer Output 6(float) + 8(out1): 7(ptr) Variable Output + 9(outXfb): TypeStruct 6(float) + 10: TypePointer Output 9(outXfb) + 11: 10(ptr) Variable Output + 12(outXfb2): TypeStruct 6(float) + 13: TypePointer Output 12(outXfb2) + 14: 13(ptr) Variable Output + 15(out4): 7(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + Return + FunctionEnd diff --git a/3rdparty/glslang/Test/hlsl.PointSize.geom b/3rdparty/glslang/Test/hlsl.PointSize.geom index d2a04a48d..ef66fc891 100644 --- a/3rdparty/glslang/Test/hlsl.PointSize.geom +++ b/3rdparty/glslang/Test/hlsl.PointSize.geom @@ -1,5 +1,5 @@ struct S { - [[vk::builtin("PointSize")]] float ps; + [[vk::builtin("PointSize")]] float ps : PSIZE; }; [maxvertexcount(4)] diff --git a/3rdparty/glslang/Test/hlsl.y-negate-1.vert b/3rdparty/glslang/Test/hlsl.y-negate-1.vert new file mode 100644 index 000000000..ee62ec24b --- /dev/null +++ b/3rdparty/glslang/Test/hlsl.y-negate-1.vert @@ -0,0 +1,9 @@ + +// Test Y negation from entry point return + +float4 pos; + +float4 main() : SV_Position +{ + return pos; +} diff --git a/3rdparty/glslang/Test/hlsl.y-negate-2.vert b/3rdparty/glslang/Test/hlsl.y-negate-2.vert new file mode 100644 index 000000000..01fa6ce71 --- /dev/null +++ b/3rdparty/glslang/Test/hlsl.y-negate-2.vert @@ -0,0 +1,8 @@ +// Test Y negation from entry point out parameter + +float4 pos; + +void main(out float4 position : SV_Position) +{ + position = pos; +} diff --git a/3rdparty/glslang/Test/hlsl.y-negate-3.vert b/3rdparty/glslang/Test/hlsl.y-negate-3.vert new file mode 100644 index 000000000..a0c4a8d63 --- /dev/null +++ b/3rdparty/glslang/Test/hlsl.y-negate-3.vert @@ -0,0 +1,18 @@ +// Test Y negation from entry point out parameter + +float4 position; + +struct VS_OUT { + float4 pos : SV_Position; + int somethingelse; +}; + +VS_OUT main() +{ + VS_OUT vsout; + + vsout.pos = position; + vsout.somethingelse = 42; + + return vsout; +} diff --git a/3rdparty/glslang/Test/runtests b/3rdparty/glslang/Test/runtests index 814210ba4..3a5b17534 100755 --- a/3rdparty/glslang/Test/runtests +++ b/3rdparty/glslang/Test/runtests @@ -186,6 +186,17 @@ diff -b $BASEDIR/remap.invalid-spirv-1.out $TARGETDIR/remap.invalid-spirv-1.out $REMAPEXE --do-everything -i remap.invalid-spirv-2.spv -o $TARGETDIR > $TARGETDIR/remap.invalid-spirv-2.out && HASERROR=1 diff -b $BASEDIR/remap.invalid-spirv-2.out $TARGETDIR/remap.invalid-spirv-2.out || HASERROR=1 +# +# Testing position Y inversion +# +echo "Testing position Y inversion" +$EXE -H -e main -V -D -H -i --iy hlsl.y-negate-1.vert > $TARGETDIR/hlsl.y-negate-1.vert.out +diff -b $BASEDIR/hlsl.y-negate-1.vert.out $TARGETDIR/hlsl.y-negate-1.vert.out || HASERROR=1 +$EXE -H -e main -V -D -H -i --invert-y hlsl.y-negate-2.vert > $TARGETDIR/hlsl.y-negate-2.vert.out +diff -b $BASEDIR/hlsl.y-negate-2.vert.out $TARGETDIR/hlsl.y-negate-2.vert.out || HASERROR=1 +$EXE -H -e main -V -D -H -i --invert-y hlsl.y-negate-3.vert > $TARGETDIR/hlsl.y-negate-3.vert.out +diff -b $BASEDIR/hlsl.y-negate-3.vert.out $TARGETDIR/hlsl.y-negate-3.vert.out || HASERROR=1 + # # Final checking # diff --git a/3rdparty/glslang/Test/spv.builtInXFB.vert b/3rdparty/glslang/Test/spv.builtInXFB.vert new file mode 100644 index 000000000..619bc1e2f --- /dev/null +++ b/3rdparty/glslang/Test/spv.builtInXFB.vert @@ -0,0 +1,15 @@ +#version 450 + +layout(xfb_buffer = 1, xfb_stride = 64) out; + +layout (xfb_buffer = 1, xfb_offset = 16) out gl_PerVertex +{ + float gl_PointSize; + vec4 gl_Position; +}; + +void main() +{ + gl_Position = vec4(1.0); + gl_PointSize = 2.0; +} \ No newline at end of file diff --git a/3rdparty/glslang/Test/spv.fullyCovered.frag b/3rdparty/glslang/Test/spv.fullyCovered.frag new file mode 100644 index 000000000..c7f30853d --- /dev/null +++ b/3rdparty/glslang/Test/spv.fullyCovered.frag @@ -0,0 +1,9 @@ +#version 450 + +#extension GL_NV_conservative_raster_underestimation : enable + +out vec4 color; + +void main() { + color = vec4(gl_FragFullyCoveredNV, 0, 0, 0); +} diff --git a/3rdparty/glslang/Test/spv.xfb.vert b/3rdparty/glslang/Test/spv.xfb.vert new file mode 100644 index 000000000..ad762bc21 --- /dev/null +++ b/3rdparty/glslang/Test/spv.xfb.vert @@ -0,0 +1,20 @@ +#version 450 + +layout(xfb_buffer = 3) out; +layout(xfb_stride = 48) out; +layout(xfb_offset = 12, location = 0) out float out1; + +layout(xfb_buffer = 2) out; +layout(location=1) out outXfb { + layout(xfb_buffer = 2, xfb_stride = 32, xfb_offset = 8) float out2; +}; + +layout(xfb_buffer = 1, location=3) out outXfb2 { + layout(xfb_stride = 64, xfb_offset = 60) float out3; +}; + +layout(location = 4, xfb_buffer = 0, xfb_offset = 4) out float out4; + +void main() +{ +} \ No newline at end of file diff --git a/3rdparty/glslang/glslang/Include/BaseTypes.h b/3rdparty/glslang/glslang/Include/BaseTypes.h index 0a46a7c0f..050c2c4b9 100644 --- a/3rdparty/glslang/glslang/Include/BaseTypes.h +++ b/3rdparty/glslang/glslang/Include/BaseTypes.h @@ -218,6 +218,7 @@ enum TBuiltInVariable { EbvSecondaryViewportMaskNV, EbvPositionPerViewNV, EbvViewportMaskPerViewNV, + EbvFragFullyCoveredNV, #endif // HLSL built-ins that live only temporarily, until they get remapped @@ -355,6 +356,7 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v) case EbvSecondaryViewportMaskNV: return "SecondaryViewportMaskNV"; case EbvPositionPerViewNV: return "PositionPerViewNV"; case EbvViewportMaskPerViewNV: return "ViewportMaskPerViewNV"; + case EbvFragFullyCoveredNV: return "FragFullyCoveredNV"; #endif default: return "unknown built-in variable"; } diff --git a/3rdparty/glslang/glslang/Include/Types.h b/3rdparty/glslang/glslang/Include/Types.h index d23b61531..cc847b5e7 100644 --- a/3rdparty/glslang/glslang/Include/Types.h +++ b/3rdparty/glslang/glslang/Include/Types.h @@ -650,15 +650,19 @@ public: layoutXfbOffset = layoutXfbOffsetEnd; } - bool hasLayout() const + bool hasNonXfbLayout() const { return hasUniformLayout() || hasAnyLocation() || hasStream() || - hasXfb() || hasFormat() || layoutPushConstant; } + bool hasLayout() const + { + return hasNonXfbLayout() || + hasXfb(); + } TLayoutMatrix layoutMatrix : 3; TLayoutPacking layoutPacking : 4; int layoutOffset; diff --git a/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp b/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp index 40f46b353..dd1fc299c 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp @@ -3963,6 +3963,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV "in vec3 gl_BaryCoordPullModelAMD;" ); #endif + +#ifdef NV_EXTENSIONS + if (version >= 430) + stageBuiltins[EShLangFragment].append( + "in bool gl_FragFullyCoveredNV;" + ); +#endif } else { // ES profile @@ -5858,6 +5865,13 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion } #endif +#ifdef NV_EXTENSIONS + if (profile != EEsProfile && version >= 430) { + symbolTable.setVariableExtensions("gl_FragFullyCoveredNV", 1, &E_GL_NV_conservative_raster_underestimation); + BuiltInVariable("gl_FragFullyCoveredNV", EbvFragFullyCoveredNV, symbolTable); + } +#endif + symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth); if (profile == EEsProfile && version < 320) { diff --git a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp index 733b74dab..78a5d8ee6 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -2560,7 +2560,7 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali // now, knowing it is a shader in/out, do all the in/out semantic checks - if (publicType.basicType == EbtBool) { + if (publicType.basicType == EbtBool && !parsingBuiltins) { error(loc, "cannot be bool", GetStorageQualifierString(qualifier.storage), ""); return; } @@ -3478,17 +3478,24 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT return; } + // Fix XFB stuff up, it applies to the order of the redeclaration, not + // the order of the original members. + if (currentBlockQualifier.storage == EvqVaryingOut && globalOutputDefaults.hasXfbBuffer()) { + currentBlockQualifier.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer; + fixBlockXfbOffsets(currentBlockQualifier, newTypeList); + } + // Edit and error check the container against the redeclaration // - remove unused members // - ensure remaining qualifiers/types match + TType& type = block->getWritableType(); #ifdef NV_EXTENSIONS // if gl_PerVertex is redeclared for the purpose of passing through "gl_Position" - // for passthrough purpose, the redclared block should have the same qualifers as + // for passthrough purpose, the redeclared block should have the same qualifers as // the current one - if (currentBlockQualifier.layoutPassthrough) - { + if (currentBlockQualifier.layoutPassthrough) { type.getQualifier().layoutPassthrough = currentBlockQualifier.layoutPassthrough; type.getQualifier().storage = currentBlockQualifier.storage; type.getQualifier().layoutStream = currentBlockQualifier.layoutStream; @@ -3529,10 +3536,12 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT arrayLimitCheck(loc, member->type->getFieldName(), newType.getOuterArraySize()); if (newType.getQualifier().isMemory()) error(memberLoc, "cannot add memory qualifier to redeclared block member", member->type->getFieldName().c_str(), ""); - if (newType.getQualifier().hasLayout()) - error(memberLoc, "cannot add layout to redeclared block member", member->type->getFieldName().c_str(), ""); + if (newType.getQualifier().hasNonXfbLayout()) + error(memberLoc, "cannot add non-XFB layout to redeclared block member", member->type->getFieldName().c_str(), ""); if (newType.getQualifier().patch) error(memberLoc, "cannot add patch to redeclared block member", member->type->getFieldName().c_str(), ""); + if (newType.getQualifier().hasXfbBuffer() && newType.getQualifier().layoutXfbBuffer != currentBlockQualifier.layoutXfbBuffer) + error(memberLoc, "member cannot contradict block (or what block inherited from global)", "xfb_buffer", ""); oldType.getQualifier().centroid = newType.getQualifier().centroid; oldType.getQualifier().sample = newType.getQualifier().sample; oldType.getQualifier().invariant = newType.getQualifier().invariant; @@ -3540,7 +3549,9 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT oldType.getQualifier().smooth = newType.getQualifier().smooth; oldType.getQualifier().flat = newType.getQualifier().flat; oldType.getQualifier().nopersp = newType.getQualifier().nopersp; - + oldType.getQualifier().layoutXfbOffset = newType.getQualifier().layoutXfbOffset; + if (oldType.getQualifier().layoutXfbOffset != TQualifier::layoutXfbBufferEnd) + type.getQualifier().layoutXfbBuffer = currentBlockQualifier.layoutXfbBuffer; if (oldType.isImplicitlySizedArray() && newType.isExplicitlySizedArray()) oldType.changeOuterArraySize(newType.getOuterArraySize()); diff --git a/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp b/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp index 62e079e55..c92d02391 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp @@ -1686,6 +1686,8 @@ void TShader::setShiftUavBinding(unsigned int base) { setShiftBinding(EResUa void TShader::setShiftSsboBinding(unsigned int base) { setShiftBinding(EResSsbo, base); } // Enables binding automapping using TIoMapper void TShader::setAutoMapBindings(bool map) { intermediate->setAutoMapBindings(map); } +// Enables position.Y output negation in vertex shader +void TShader::setInvertY(bool invert) { intermediate->setInvertY(invert); } // Fragile: currently within one stage: simple auto-assignment of location void TShader::setAutoMapLocations(bool map) { intermediate->setAutoMapLocations(map); } // See comment above TDefaultHlslIoMapper in iomapper.cpp: diff --git a/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp b/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp index b1893b37e..225c71ccb 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp @@ -212,6 +212,7 @@ void TParseVersions::initializeExtensionBehavior() extensionBehavior[E_GL_NV_stereo_view_rendering] = EBhDisable; extensionBehavior[E_GL_NVX_multiview_per_view_attributes] = EBhDisable; extensionBehavior[E_GL_NV_shader_atomic_int64] = EBhDisable; + extensionBehavior[E_GL_NV_conservative_raster_underestimation] = EBhDisable; #endif // AEP @@ -345,6 +346,7 @@ void TParseVersions::getPreamble(std::string& preamble) "#define GL_NV_geometry_shader_passthrough 1\n" "#define GL_NV_viewport_array2 1\n" "#define GL_NV_shader_atomic_int64 1\n" + "#define GL_NV_conservative_raster_underestimation 1\n" #endif ; diff --git a/3rdparty/glslang/glslang/MachineIndependent/Versions.h b/3rdparty/glslang/glslang/MachineIndependent/Versions.h index bd57103af..493c03b28 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/Versions.h +++ b/3rdparty/glslang/glslang/MachineIndependent/Versions.h @@ -183,6 +183,7 @@ const char* const E_GL_NV_viewport_array2 = "GL_NV_viewpor const char* const E_GL_NV_stereo_view_rendering = "GL_NV_stereo_view_rendering"; const char* const E_GL_NVX_multiview_per_view_attributes = "GL_NVX_multiview_per_view_attributes"; const char* const E_GL_NV_shader_atomic_int64 = "GL_NV_shader_atomic_int64"; +const char* const E_GL_NV_conservative_raster_underestimation = "GL_NV_conservative_raster_underestimation"; // Arrays of extensions for the above viewportEXTs duplications diff --git a/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h b/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h index 062eb1b08..4d48c68d4 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h +++ b/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h @@ -224,6 +224,7 @@ public: #endif autoMapBindings(false), autoMapLocations(false), + invertY(false), flattenUniformArrays(false), useUnknownFormat(false), hlslOffsets(false), @@ -317,6 +318,14 @@ public: processes.addProcess("auto-map-locations"); } bool getAutoMapLocations() const { return autoMapLocations; } + void setInvertY(bool invert) + { + invertY = invert; + if (invertY) + processes.addProcess("invert-y"); + } + bool getInvertY() const { return invertY; } + void setFlattenUniformArrays(bool flatten) { flattenUniformArrays = flatten; @@ -574,6 +583,7 @@ public: xfbBuffers[buffer].stride = stride; return true; } + unsigned getXfbStride(int buffer) const { return xfbBuffers[buffer].stride; } int addXfbBufferOffset(const TType&); unsigned int computeTypeXfbSize(const TType&, bool& containsDouble) const; static int getBaseAlignmentScalar(const TType&, int& size); @@ -682,6 +692,7 @@ protected: std::vector resourceSetBinding; bool autoMapBindings; bool autoMapLocations; + bool invertY; bool flattenUniformArrays; bool useUnknownFormat; bool hlslOffsets; diff --git a/3rdparty/glslang/glslang/Public/ShaderLang.h b/3rdparty/glslang/glslang/Public/ShaderLang.h index 6e22bdd72..35d846362 100644 --- a/3rdparty/glslang/glslang/Public/ShaderLang.h +++ b/3rdparty/glslang/glslang/Public/ShaderLang.h @@ -371,6 +371,7 @@ public: void setResourceSetBinding(const std::vector& base); void setAutoMapBindings(bool map); void setAutoMapLocations(bool map); + void setInvertY(bool invert); void setHlslIoMapping(bool hlslIoMap); void setFlattenUniformArrays(bool flatten); void setNoStorageFormat(bool useUnknownFormat); diff --git a/3rdparty/glslang/gtests/Spv.FromFile.cpp b/3rdparty/glslang/gtests/Spv.FromFile.cpp index 4a396273d..da80b1168 100644 --- a/3rdparty/glslang/gtests/Spv.FromFile.cpp +++ b/3rdparty/glslang/gtests/Spv.FromFile.cpp @@ -232,6 +232,7 @@ INSTANTIATE_TEST_CASE_P( "spv.bool.vert", "spv.boolInBlock.frag", "spv.branch-return.vert", + "spv.builtInXFB.vert", "spv.conditionalDiscard.frag", "spv.conversion.frag", "spv.dataOut.frag", @@ -249,6 +250,7 @@ INSTANTIATE_TEST_CASE_P( "spv.flowControl.frag", "spv.forLoop.frag", "spv.forwardFun.frag", + "spv.fullyCovered.frag", "spv.functionCall.frag", "spv.functionNestedOpaque.vert", "spv.functionSemantics.frag", @@ -327,6 +329,7 @@ INSTANTIATE_TEST_CASE_P( "spv.storageBuffer.vert", "spv.precise.tese", "spv.precise.tesc", + "spv.xfb.vert", })), FileNameAsCustomTestSuffix ); diff --git a/3rdparty/glslang/hlsl/hlslParseHelper.cpp b/3rdparty/glslang/hlsl/hlslParseHelper.cpp index 6264a146d..a3e5e8a73 100755 --- a/3rdparty/glslang/hlsl/hlslParseHelper.cpp +++ b/3rdparty/glslang/hlsl/hlslParseHelper.cpp @@ -2301,6 +2301,63 @@ void HlslParseContext::handleFunctionArgument(TFunction* function, arguments = newArg; } +// Position may require special handling: we can optionally invert Y. +// See: https://github.com/KhronosGroup/glslang/issues/1173 +// https://github.com/KhronosGroup/glslang/issues/494 +TIntermTyped* HlslParseContext::assignPosition(const TSourceLoc& loc, TOperator op, + TIntermTyped* left, TIntermTyped* right) +{ + // If we are not asked for Y inversion, use a plain old assign. + if (!intermediate.getInvertY()) + return intermediate.addAssign(op, left, right, loc); + + // If we get here, we should invert Y. + TIntermAggregate* assignList = nullptr; + + // If this is a complex rvalue, we don't want to dereference it many times. Create a temporary. + TVariable* rhsTempVar = nullptr; + rhsTempVar = makeInternalVariable("@position", right->getType()); + rhsTempVar->getWritableType().getQualifier().makeTemporary(); + + { + TIntermTyped* rhsTempSym = intermediate.addSymbol(*rhsTempVar, loc); + assignList = intermediate.growAggregate(assignList, + intermediate.addAssign(EOpAssign, rhsTempSym, right, loc), loc); + } + + // pos.y = -pos.y + { + const int Y = 1; + + TIntermTyped* tempSymL = intermediate.addSymbol(*rhsTempVar, loc); + TIntermTyped* tempSymR = intermediate.addSymbol(*rhsTempVar, loc); + TIntermTyped* index = intermediate.addConstantUnion(Y, loc); + + TIntermTyped* lhsElement = intermediate.addIndex(EOpIndexDirect, tempSymL, index, loc); + TIntermTyped* rhsElement = intermediate.addIndex(EOpIndexDirect, tempSymR, index, loc); + + const TType derefType(right->getType(), 0); + + lhsElement->setType(derefType); + rhsElement->setType(derefType); + + TIntermTyped* yNeg = intermediate.addUnaryMath(EOpNegative, rhsElement, loc); + + assignList = intermediate.growAggregate(assignList, intermediate.addAssign(EOpAssign, lhsElement, yNeg, loc)); + } + + // Assign the rhs temp (now with Y inversion) to the final output + { + TIntermTyped* rhsTempSym = intermediate.addSymbol(*rhsTempVar, loc); + assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, left, rhsTempSym, loc)); + } + + assert(assignList != nullptr); + assignList->setOperator(EOpSequence); + + return assignList; +} + // Clip and cull distance require special handling due to a semantic mismatch. In HLSL, // these can be float scalar, float vector, or arrays of float scalar or float vector. // In SPIR-V, they are arrays of scalar floats in all cases. We must copy individual components @@ -2566,6 +2623,12 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op wasSplit(binaryNode->getLeft()); }; + // Return true if this stage assigns clip position with potentially inverted Y + const auto assignsClipPos = [this](const TIntermTyped* node) -> bool { + return node->getType().getQualifier().builtIn == EbvPosition && + (language == EShLangVertex || language == EShLangGeometry || language == EShLangTessEvaluation); + }; + const bool isSplitLeft = wasSplit(left) || indexesSplit(left); const bool isSplitRight = wasSplit(right) || indexesSplit(right); @@ -2581,6 +2644,9 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op const int semanticId = (isOutput ? left : right)->getType().getQualifier().layoutLocation; return assignClipCullDistance(loc, op, semanticId, left, right); + } else if (assignsClipPos(left)) { + // Position can require special handling: see comment above assignPosition + return assignPosition(loc, op, left, right); } return intermediate.addAssign(op, left, right, loc); @@ -2665,13 +2731,23 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op // copy from interstage IO built-in if needed subTree = intermediate.addSymbol(*builtInVar); - // Arrayness of builtIn symbols isn't handled by the normal recursion: - // it's been extracted and moved to the built-in. - if (subTree->getType().isArray() && !arrayElement.empty()) { - const TType splitDerefType(subTree->getType(), arrayElement.back()); - subTree = intermediate.addIndex(EOpIndexDirect, subTree, - intermediate.addConstantUnion(arrayElement.back(), loc), loc); - subTree->setType(splitDerefType); + if (subTree->getType().isArray()) { + // Arrayness of builtIn symbols isn't handled by the normal recursion: + // it's been extracted and moved to the built-in. + if (!arrayElement.empty()) { + const TType splitDerefType(subTree->getType(), arrayElement.back()); + subTree = intermediate.addIndex(EOpIndexDirect, subTree, + intermediate.addConstantUnion(arrayElement.back(), loc), loc); + subTree->setType(splitDerefType); + } else if (splitNode->getAsOperator() != nullptr && (splitNode->getAsOperator()->getOp() == EOpIndexIndirect)) { + // This might also be a stage with arrayed outputs, in which case there's an index + // operation we should transfer to the output builtin. + + const TType splitDerefType(subTree->getType(), 0); + subTree = intermediate.addIndex(splitNode->getAsOperator()->getOp(), subTree, + splitNode->getAsBinaryNode()->getRight(), loc); + subTree->setType(splitDerefType); + } } } else if (flattened && !shouldFlatten(derefType, isLeft ? leftStorage : rightStorage, false)) { if (isLeft) @@ -2792,7 +2868,10 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op subSplitLeft, subSplitRight); assignList = intermediate.growAggregate(assignList, clipCullAssign, loc); - + } else if (assignsClipPos(subSplitLeft)) { + // Position can require special handling: see comment above assignPosition + TIntermTyped* positionAssign = assignPosition(loc, op, subSplitLeft, subSplitRight); + assignList = intermediate.growAggregate(assignList, positionAssign, loc); } else if (!shouldFlattenSubsetLeft && !shouldFlattenSubsetRight && !typeL.containsBuiltIn() && !typeR.containsBuiltIn()) { // If this is the final flattening (no nested types below to flatten) @@ -5777,7 +5856,8 @@ void HlslParseContext::handleSemantic(TSourceLoc loc, TQualifier& qualifier, TBu break; } - qualifier.builtIn = builtIn; + if (qualifier.builtIn == EbvNone) + qualifier.builtIn = builtIn; qualifier.semanticName = intermediate.addSemanticName(upperCase); } @@ -9046,7 +9126,7 @@ bool HlslParseContext::isOutputBuiltIn(const TQualifier& qualifier) const return language == EShLangFragment; case EbvLayer: case EbvViewportIndex: - return language == EShLangGeometry; + return language == EShLangGeometry || language == EShLangVertex; case EbvPrimitiveId: return language == EShLangGeometry; case EbvTessLevelInner: diff --git a/3rdparty/glslang/hlsl/hlslParseHelper.h b/3rdparty/glslang/hlsl/hlslParseHelper.h index 67d192d47..a56fc2e41 100755 --- a/3rdparty/glslang/hlsl/hlslParseHelper.h +++ b/3rdparty/glslang/hlsl/hlslParseHelper.h @@ -93,6 +93,7 @@ public: TIntermTyped* handleAssignToMatrixSwizzle(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right); TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermTyped*); TIntermAggregate* assignClipCullDistance(const TSourceLoc&, TOperator, int semanticId, TIntermTyped* left, TIntermTyped* right); + TIntermTyped* assignPosition(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right); void decomposeIntrinsic(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); void decomposeSampleMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); void decomposeStructBufferMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); diff --git a/3rdparty/glslang/known_good.json b/3rdparty/glslang/known_good.json index 25b81a4d4..222d2da07 100644 --- a/3rdparty/glslang/known_good.json +++ b/3rdparty/glslang/known_good.json @@ -5,7 +5,7 @@ "site" : "github", "subrepo" : "KhronosGroup/SPIRV-Tools", "subdir" : "External/spirv-tools", - "commit" : "188cd3780d76256d6bfcbdb216b6368e9b070628" + "commit" : "0f804063154f45af308f8ce31c41f58fae3f18dc" }, { "name" : "spirv-tools/external/spirv-headers",