From 2a6ba4053dacfdb7461f78badcca3a23efe4d2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 3 Feb 2017 19:32:35 -0800 Subject: [PATCH] Updated glslang. --- 3rdparty/glslang/README.md | 2 +- 3rdparty/glslang/SPIRV/CMakeLists.txt | 3 + 3rdparty/glslang/SPIRV/GlslangToSpv.cpp | 4 +- 3rdparty/glslang/SPIRV/SpvBuilder.cpp | 23 ++--- 3rdparty/glslang/SPIRV/SpvBuilder.h | 24 ++--- 3rdparty/glslang/StandAlone/CMakeLists.txt | 5 - 3rdparty/glslang/Test/120.frag | 8 ++ .../glslang/Test/baseResults/120.frag.out | 17 +++- .../Test/baseResults/hlsl.init.frag.out | 20 +++- .../Test/baseResults/hlsl.layout.frag.out | 5 +- .../Test/baseResults/link1.vk.frag.out | 60 ++++++++++++ .../Test/baseResults/spv.float16.frag.out | 23 +++-- .../Test/baseResults/spv.int64.frag.out | 53 +++++----- .../Test/baseResults/spv.specConst.vert.out | 7 +- .../baseResults/spv.specConstant.vert.out | 81 +++++++++------- .../spv.specConstantComposite.vert.out | 28 +++--- .../spv.specConstantOperations.vert.out | 83 ++++++++-------- .../Test/baseResults/vulkan.ast.vert.out | 65 +++++++------ 3rdparty/glslang/Test/hlsl.init.frag | 5 + 3rdparty/glslang/Test/link1.vk.frag | 10 ++ 3rdparty/glslang/Test/link2.vk.frag | 8 ++ 3rdparty/glslang/glslang/CMakeLists.txt | 9 ++ 3rdparty/glslang/glslang/Include/PoolAlloc.h | 2 +- 3rdparty/glslang/glslang/Include/revision.h | 4 +- .../MachineIndependent/Intermediate.cpp | 8 +- .../MachineIndependent/ParseHelper.cpp | 2 +- .../glslang/MachineIndependent/PoolAlloc.cpp | 4 +- .../glslang/MachineIndependent/ShaderLang.cpp | 10 ++ .../glslang/MachineIndependent/iomapper.cpp | 3 + .../MachineIndependent/localintermediate.h | 2 +- 3rdparty/glslang/glslang/Public/ShaderLang.h | 1 + 3rdparty/glslang/gtests/CMakeLists.txt | 1 + 3rdparty/glslang/gtests/Link.FromFile.Vk.cpp | 97 +++++++++++++++++++ 3rdparty/glslang/hlsl/hlslGrammar.cpp | 12 +++ scripts/shaderc.lua | 1 + 35 files changed, 494 insertions(+), 196 deletions(-) create mode 100644 3rdparty/glslang/Test/baseResults/link1.vk.frag.out create mode 100644 3rdparty/glslang/Test/link1.vk.frag create mode 100644 3rdparty/glslang/Test/link2.vk.frag create mode 100644 3rdparty/glslang/gtests/Link.FromFile.Vk.cpp diff --git a/3rdparty/glslang/README.md b/3rdparty/glslang/README.md index 9cfdce183..193e38da8 100644 --- a/3rdparty/glslang/README.md +++ b/3rdparty/glslang/README.md @@ -17,7 +17,7 @@ There are several components: 1. A GLSL/ESSL front-end for reference validation and translation of GLSL/ESSL into an AST. -2. An HLSL front-end for translation of a broad generic HLL into the AST. +2. An HLSL front-end for translation of a broad generic HLL into the AST. See [issue 362](https://github.com/KhronosGroup/glslang/issues/362) and [issue 701](https://github.com/KhronosGroup/glslang/issues/701) for current status. 3. A SPIR-V back end for translating the AST to SPIR-V. diff --git a/3rdparty/glslang/SPIRV/CMakeLists.txt b/3rdparty/glslang/SPIRV/CMakeLists.txt index 3a72c6c2f..aaf117802 100755 --- a/3rdparty/glslang/SPIRV/CMakeLists.txt +++ b/3rdparty/glslang/SPIRV/CMakeLists.txt @@ -41,6 +41,7 @@ endif(ENABLE_NV_EXTENSIONS) add_library(SPIRV STATIC ${SOURCES} ${HEADERS}) set_property(TARGET SPIRV PROPERTY FOLDER glslang) +target_link_libraries(SPIRV glslang) add_library(SPVRemapper STATIC ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS}) set_property(TARGET SPVRemapper PROPERTY FOLDER glslang) @@ -52,3 +53,5 @@ endif(WIN32) install(TARGETS SPIRV SPVRemapper ARCHIVE DESTINATION lib) + +install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION include/SPIRV/) diff --git a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp index 5f4ad326b..0b48dfcdd 100755 --- a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp +++ b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp @@ -4971,7 +4971,9 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TIntermTyped& n return accessChainLoad(sub_tree->getType()); } else if (auto* const_union_array = &sn->getConstArray()){ int nextConst = 0; - return createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true); + spv::Id id = createSpvConstantFromConstUnionArray(sn->getType(), *const_union_array, nextConst, true); + builder.addName(id, sn->getName().c_str()); + return id; } } diff --git a/3rdparty/glslang/SPIRV/SpvBuilder.cpp b/3rdparty/glslang/SPIRV/SpvBuilder.cpp index 1b04a6cf7..c0ca970ff 100644 --- a/3rdparty/glslang/SPIRV/SpvBuilder.cpp +++ b/3rdparty/glslang/SPIRV/SpvBuilder.cpp @@ -819,7 +819,7 @@ Id Builder::makeFloat16Constant(float f16, bool specConstant) } #endif -Id Builder::findCompositeConstant(Op typeClass, std::vector& comps) const +Id Builder::findCompositeConstant(Op typeClass, const std::vector& comps) const { Instruction* constant = 0; bool found = false; @@ -848,7 +848,7 @@ Id Builder::findCompositeConstant(Op typeClass, std::vector& comps) const } // Comments in header -Id Builder::makeCompositeConstant(Id typeId, std::vector& members, bool specConstant) +Id Builder::makeCompositeConstant(Id typeId, const std::vector& members, bool specConstant) { Op opcode = specConstant ? OpSpecConstantComposite : OpConstantComposite; assert(typeId); @@ -1098,7 +1098,7 @@ Id Builder::createLoad(Id lValue) } // Comments in header -Id Builder::createAccessChain(StorageClass storageClass, Id base, std::vector& offsets) +Id Builder::createAccessChain(StorageClass storageClass, Id base, const std::vector& offsets) { // Figure out the final resulting type. spv::Id typeId = getTypeId(base); @@ -1148,7 +1148,7 @@ Id Builder::createCompositeExtract(Id composite, Id typeId, unsigned index) return extract->getResultId(); } -Id Builder::createCompositeExtract(Id composite, Id typeId, std::vector& indexes) +Id Builder::createCompositeExtract(Id composite, Id typeId, const std::vector& indexes) { // Generate code for spec constants if in spec constant operation // generation mode. @@ -1175,7 +1175,7 @@ Id Builder::createCompositeInsert(Id object, Id composite, Id typeId, unsigned i return insert->getResultId(); } -Id Builder::createCompositeInsert(Id object, Id composite, Id typeId, std::vector& indexes) +Id Builder::createCompositeInsert(Id object, Id composite, Id typeId, const std::vector& indexes) { Instruction* insert = new Instruction(getUniqueId(), typeId, OpCompositeInsert); insert->addIdOperand(object); @@ -1326,7 +1326,7 @@ Id Builder::createSpecConstantOp(Op opCode, Id typeId, const std::vector& op return op->getResultId(); } -Id Builder::createFunctionCall(spv::Function* function, std::vector& args) +Id Builder::createFunctionCall(spv::Function* function, const std::vector& args) { Instruction* op = new Instruction(getUniqueId(), function->getReturnType(), OpFunctionCall); op->addIdOperand(function->getId()); @@ -1338,7 +1338,7 @@ Id Builder::createFunctionCall(spv::Function* function, std::vector& ar } // Comments in header -Id Builder::createRvalueSwizzle(Decoration precision, Id typeId, Id source, std::vector& channels) +Id Builder::createRvalueSwizzle(Decoration precision, Id typeId, Id source, const std::vector& channels) { if (channels.size() == 1) return setPrecision(createCompositeExtract(source, typeId, channels.front()), precision); @@ -1360,7 +1360,7 @@ Id Builder::createRvalueSwizzle(Decoration precision, Id typeId, Id source, std: } // Comments in header -Id Builder::createLvalueSwizzle(Id typeId, Id target, Id source, std::vector& channels) +Id Builder::createLvalueSwizzle(Id typeId, Id target, Id source, const std::vector& channels) { if (channels.size() == 1 && getNumComponents(source) == 1) return createCompositeInsert(source, target, typeId, channels.front()); @@ -1446,7 +1446,7 @@ Id Builder::smearScalar(Decoration precision, Id scalar, Id vectorType) } // Comments in header -Id Builder::createBuiltinCall(Id resultType, Id builtins, int entryPoint, std::vector& args) +Id Builder::createBuiltinCall(Id resultType, Id builtins, int entryPoint, const std::vector& args) { Instruction* inst = new Instruction(getUniqueId(), resultType, OpExtInst); inst->addIdOperand(builtins); @@ -1794,7 +1794,7 @@ Id Builder::createCompositeCompare(Decoration precision, Id value1, Id value2, b } // OpCompositeConstruct -Id Builder::createCompositeConstruct(Id typeId, std::vector& constituents) +Id Builder::createCompositeConstruct(Id typeId, const std::vector& constituents) { assert(isAggregateType(typeId) || (getNumTypeConstituents(typeId) > 1 && getNumTypeConstituents(typeId) == (int)constituents.size())); @@ -2011,7 +2011,8 @@ void Builder::If::makeEndIf() } // Comments in header -void Builder::makeSwitch(Id selector, int numSegments, std::vector& caseValues, std::vector& valueIndexToSegment, int defaultSegment, +void Builder::makeSwitch(Id selector, int numSegments, const std::vector& caseValues, + const std::vector& valueIndexToSegment, int defaultSegment, std::vector& segmentBlocks) { Function& function = buildPoint->getParent(); diff --git a/3rdparty/glslang/SPIRV/SpvBuilder.h b/3rdparty/glslang/SPIRV/SpvBuilder.h index a97b44b8b..fe83ac1d0 100755 --- a/3rdparty/glslang/SPIRV/SpvBuilder.h +++ b/3rdparty/glslang/SPIRV/SpvBuilder.h @@ -196,7 +196,7 @@ public: #endif // Turn the array of constants into a proper spv constant of the requested type. - Id makeCompositeConstant(Id type, std::vector& comps, bool specConst = false); + Id makeCompositeConstant(Id type, const std::vector& comps, bool specConst = false); // Methods for adding information outside the CFG. Instruction* addEntryPoint(ExecutionModel, Function*, const char* name); @@ -244,16 +244,16 @@ public: Id createLoad(Id lValue); // Create an OpAccessChain instruction - Id createAccessChain(StorageClass, Id base, std::vector& offsets); + Id createAccessChain(StorageClass, Id base, const std::vector& offsets); // Create an OpArrayLength instruction Id createArrayLength(Id base, unsigned int member); // Create an OpCompositeExtract instruction Id createCompositeExtract(Id composite, Id typeId, unsigned index); - Id createCompositeExtract(Id composite, Id typeId, std::vector& indexes); + Id createCompositeExtract(Id composite, Id typeId, const std::vector& indexes); Id createCompositeInsert(Id object, Id composite, Id typeId, unsigned index); - Id createCompositeInsert(Id object, Id composite, Id typeId, std::vector& indexes); + Id createCompositeInsert(Id object, Id composite, Id typeId, const std::vector& indexes); Id createVectorExtractDynamic(Id vector, Id typeId, Id componentIndex); Id createVectorInsertDynamic(Id vector, Id typeId, Id component, Id componentIndex); @@ -267,18 +267,18 @@ public: Id createBinOp(Op, Id typeId, Id operand1, Id operand2); Id createTriOp(Op, Id typeId, Id operand1, Id operand2, Id operand3); Id createOp(Op, Id typeId, const std::vector& operands); - Id createFunctionCall(spv::Function*, std::vector&); + Id createFunctionCall(spv::Function*, const std::vector&); Id createSpecConstantOp(Op, Id typeId, const std::vector& operands, const std::vector& literals); // Take an rvalue (source) and a set of channels to extract from it to // make a new rvalue, which is returned. - Id createRvalueSwizzle(Decoration precision, Id typeId, Id source, std::vector& channels); + Id createRvalueSwizzle(Decoration precision, Id typeId, Id source, const std::vector& channels); // Take a copy of an lvalue (target) and a source of components, and set the // source components into the lvalue where the 'channels' say to put them. // An updated version of the target is returned. // (No true lvalue or stores are used.) - Id createLvalueSwizzle(Id typeId, Id target, Id source, std::vector& channels); + Id createLvalueSwizzle(Id typeId, Id target, Id source, const std::vector& channels); // If both the id and precision are valid, the id // gets tagged with the requested precision. @@ -311,7 +311,7 @@ public: Id smearScalar(Decoration precision, Id scalarVal, Id vectorType); // Create a call to a built-in function. - Id createBuiltinCall(Id resultType, Id builtins, int entryPoint, std::vector& args); + Id createBuiltinCall(Id resultType, Id builtins, int entryPoint, const std::vector& args); // List of parameters used to create a texture operation struct TextureParameters { @@ -346,7 +346,7 @@ public: Id createCompositeCompare(Decoration precision, Id, Id, bool /* true if for equal, false if for not-equal */); // OpCompositeConstruct - Id createCompositeConstruct(Id typeId, std::vector& constituents); + Id createCompositeConstruct(Id typeId, const std::vector& constituents); // vector or scalar constructor Id createConstructor(Decoration precision, const std::vector& sources, Id resultTypeId); @@ -388,8 +388,8 @@ public: // Returns the right set of basic blocks to start each code segment with, so that the caller's // recursion stack can hold the memory for it. // - void makeSwitch(Id condition, int numSegments, std::vector& caseValues, std::vector& valueToSegment, int defaultSegment, - std::vector& segmentBB); // return argument + void makeSwitch(Id condition, int numSegments, const std::vector& caseValues, + const std::vector& valueToSegment, int defaultSegment, std::vector& segmentBB); // return argument // Add a branch to the innermost switch's merge block. void addSwitchBreak(); @@ -545,7 +545,7 @@ public: Id makeInt64Constant(Id typeId, unsigned long long value, bool specConstant); Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned value) const; Id findScalarConstant(Op typeClass, Op opcode, Id typeId, unsigned v1, unsigned v2) const; - Id findCompositeConstant(Op typeClass, std::vector& comps) const; + Id findCompositeConstant(Op typeClass, const std::vector& comps) const; Id collapseAccessChain(); void transferAccessChainSwizzle(bool dynamic); void simplifyAccessChainSwizzle(); diff --git a/3rdparty/glslang/StandAlone/CMakeLists.txt b/3rdparty/glslang/StandAlone/CMakeLists.txt index 597d81300..2a9a3c47e 100644 --- a/3rdparty/glslang/StandAlone/CMakeLists.txt +++ b/3rdparty/glslang/StandAlone/CMakeLists.txt @@ -20,15 +20,10 @@ glslang_set_link_args(spirv-remap) set(LIBRARIES glslang - OGLCompiler - OSDependent SPIRV SPVRemapper glslang-default-resource-limits) -if(ENABLE_HLSL) - set(LIBRARIES ${LIBRARIES} HLSL) -endif(ENABLE_HLSL) if(WIN32) set(LIBRARIES ${LIBRARIES} psapi) diff --git a/3rdparty/glslang/Test/120.frag b/3rdparty/glslang/Test/120.frag index 9035aed7b..028d30810 100644 --- a/3rdparty/glslang/Test/120.frag +++ b/3rdparty/glslang/Test/120.frag @@ -236,3 +236,11 @@ void foo12111() v = shadow2DRectProjGradARB(s2DRS, v, v2, v2); } + +void voidTernary() +{ + bool b; + b ? foo121111() : foo12111(); + b ? foo121111() : 4; // ERROR + b ? 3 : foo12111(); // ERROR +} \ No newline at end of file diff --git a/3rdparty/glslang/Test/baseResults/120.frag.out b/3rdparty/glslang/Test/baseResults/120.frag.out index 5df3f987b..5028b7514 100644 --- a/3rdparty/glslang/Test/baseResults/120.frag.out +++ b/3rdparty/glslang/Test/baseResults/120.frag.out @@ -50,7 +50,9 @@ ERROR: 0:191: 'shadow2DProjGradARB' : required extension not requested: GL_ARB_s ERROR: 0:209: 'shadow2DRectProjGradARB' : no matching overloaded function found ERROR: 0:209: 'assign' : cannot convert from 'const float' to 'temp 4-component vector of float' ERROR: 0:212: 'sampler2DRect' : Reserved word. -ERROR: 51 compilation errors. No code generated. +ERROR: 0:244: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type 'global void' and a right operand of type 'const int' (or there is no acceptable conversion) +ERROR: 0:245: ':' : wrong operand types: no operation ':' exists that takes a left-hand operand of type 'const int' and a right operand of type 'global void' (or there is no acceptable conversion) +ERROR: 53 compilation errors. No code generated. Shader version: 120 @@ -601,6 +603,19 @@ ERROR: node is still EOpNull! 0:237 'v' (temp 4-component vector of float) 0:237 'v2' (temp 2-component vector of float) 0:237 'v2' (temp 2-component vector of float) +0:240 Function Definition: voidTernary( (global void) +0:240 Function Parameters: +0:? Sequence +0:243 Test condition and select (temp void) +0:243 Condition +0:243 'b' (temp bool) +0:243 true case +0:243 Function Call: foo121111( (global void) +0:243 false case +0:243 Function Call: foo12111( (global void) +0:244 Constant: +0:244 4 (const int) +0:245 Function Call: foo12111( (global void) 0:? Linker Objects 0:? 'lowp' (global float) 0:? 'mediump' (global float) diff --git a/3rdparty/glslang/Test/baseResults/hlsl.init.frag.out b/3rdparty/glslang/Test/baseResults/hlsl.init.frag.out index 42f94caef..c7e5e23fc 100755 --- a/3rdparty/glslang/Test/baseResults/hlsl.init.frag.out +++ b/3rdparty/glslang/Test/baseResults/hlsl.init.frag.out @@ -1,4 +1,7 @@ hlsl.init.frag +WARNING: 0:40: 'typedef' : struct-member initializers ignored +WARNING: 0:40: 'typedef' : struct-member initializers ignored + Shader version: 450 gl_FragCoord origin is upper left 0:? Sequence @@ -152,6 +155,7 @@ gl_FragCoord origin is upper left 0:? 'single2' (global structure{temp 2-component vector of uint v}) 0:? 'single3' (global structure{temp structure{temp int f} s1}) 0:? 'single4' (global structure{temp structure{temp 2-component vector of uint v} s1}) +0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(row_major std140 ) uniform float a, layout(row_major std140 ) uniform float b, layout(row_major std140 ) uniform float c}) Linked fragment stage: @@ -310,10 +314,11 @@ gl_FragCoord origin is upper left 0:? 'single2' (global structure{temp 2-component vector of uint v}) 0:? 'single3' (global structure{temp structure{temp int f} s1}) 0:? 'single4' (global structure{temp structure{temp 2-component vector of uint v} s1}) +0:? 'anon@0' (layout(row_major std140 ) uniform block{layout(row_major std140 ) uniform float a, layout(row_major std140 ) uniform float b, layout(row_major std140 ) uniform float c}) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 97 +// Id's are bound by 100 Capability Shader 1: ExtInstImport "GLSL.std.450" @@ -361,8 +366,18 @@ gl_FragCoord origin is upper left Name 90 "input" Name 95 "c4" Name 96 "b5" + Name 97 "Constants" + MemberName 97(Constants) 0 "a" + MemberName 97(Constants) 1 "b" + MemberName 97(Constants) 2 "c" + Name 99 "" Decorate 88(@entryPointOutput) Location 0 Decorate 90(input) Location 0 + MemberDecorate 97(Constants) 0 Offset 0 + MemberDecorate 97(Constants) 1 Offset 4 + MemberDecorate 97(Constants) 2 Offset 8 + Decorate 97(Constants) Block + Decorate 99 DescriptorSet 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -437,6 +452,9 @@ gl_FragCoord origin is upper left 90(input): 89(ptr) Variable Input 95(c4): 22(ptr) Variable Private 96(b5): 22(ptr) Variable Private + 97(Constants): TypeStruct 6(float) 6(float) 6(float) + 98: TypePointer Uniform 97(Constants) + 99: 98(ptr) Variable Uniform 4(ShaderFunction): 2 Function None 3 5: Label 62(a2): 61(ptr) Variable Function diff --git a/3rdparty/glslang/Test/baseResults/hlsl.layout.frag.out b/3rdparty/glslang/Test/baseResults/hlsl.layout.frag.out index 0c12435a1..65a9f271d 100755 --- a/3rdparty/glslang/Test/baseResults/hlsl.layout.frag.out +++ b/3rdparty/glslang/Test/baseResults/hlsl.layout.frag.out @@ -87,6 +87,7 @@ gl_FragCoord origin is upper left Name 30 "tbufName2" MemberName 30(tbufName2) 0 "v1PostLayout" Name 32 "" + Name 38 "specConst" MemberDecorate 14(tbufName) 0 Offset 16 Decorate 14(tbufName) BufferBlock Decorate 16 DescriptorSet 3 @@ -97,7 +98,7 @@ gl_FragCoord origin is upper left Decorate 30(tbufName2) BufferBlock Decorate 32 DescriptorSet 4 Decorate 32 Binding 7 - Decorate 38 SpecId 17 + Decorate 38(specConst) SpecId 17 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -117,7 +118,7 @@ gl_FragCoord origin is upper left 30(tbufName2): TypeStruct 7(fvec4) 31: TypePointer Uniform 30(tbufName2) 32: 31(ptr) Variable Uniform - 38: 17(int) SpecConstant 10 + 38(specConst): 17(int) SpecConstant 10 4(main): 2 Function None 3 5: Label Return diff --git a/3rdparty/glslang/Test/baseResults/link1.vk.frag.out b/3rdparty/glslang/Test/baseResults/link1.vk.frag.out new file mode 100644 index 000000000..2688e634e --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/link1.vk.frag.out @@ -0,0 +1,60 @@ +link1.vk.frag +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. + +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:7 Function Definition: main( (global void) +0:7 Function Parameters: +0:9 Sequence +0:9 move second child to first child (temp highp 4-component vector of float) +0:9 'color' (out highp 4-component vector of float) +0:9 Function Call: getColor( (global highp 4-component vector of float) +0:? Linker Objects +0:? 'color' (out highp 4-component vector of float) + +link2.vk.frag +Warning, version 450 is not yet complete; most version-specific features are present, but some are missing. + +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:5 Function Definition: getColor( (global highp 4-component vector of float) +0:5 Function Parameters: +0:7 Sequence +0:7 Branch: Return with expression +0:7 texture (global highp 4-component vector of float) +0:7 's2D' (uniform highp sampler2D) +0:7 Constant: +0:7 0.500000 +0:7 0.500000 +0:? Linker Objects +0:? 's2D' (uniform highp sampler2D) + + +Linked fragment stage: + + +Shader version: 450 +gl_FragCoord origin is upper left +0:? Sequence +0:7 Function Definition: main( (global void) +0:7 Function Parameters: +0:9 Sequence +0:9 move second child to first child (temp highp 4-component vector of float) +0:9 'color' (out highp 4-component vector of float) +0:9 Function Call: getColor( (global highp 4-component vector of float) +0:5 Function Definition: getColor( (global highp 4-component vector of float) +0:5 Function Parameters: +0:7 Sequence +0:7 Branch: Return with expression +0:7 texture (global highp 4-component vector of float) +0:7 's2D' (uniform highp sampler2D) +0:7 Constant: +0:7 0.500000 +0:7 0.500000 +0:? Linker Objects +0:? 'color' (out highp 4-component vector of float) +0:? 's2D' (uniform highp sampler2D) + +SPIR-V is not generated for failed compile or link diff --git a/3rdparty/glslang/Test/baseResults/spv.float16.frag.out b/3rdparty/glslang/Test/baseResults/spv.float16.frag.out index 5499b7e8e..78156e40b 100644 --- a/3rdparty/glslang/Test/baseResults/spv.float16.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.float16.frag.out @@ -105,6 +105,9 @@ Warning, version 450 is not yet complete; most version-specific features are pre MemberName 523(B2) 6 "u" MemberName 523(B2) 7 "v" Name 525 "" + Name 526 "sf16" + Name 527 "sf" + Name 528 "sd" Decorate 512 ArrayStride 16 Decorate 513 ArrayStride 32 MemberDecorate 514(S) 0 Offset 0 @@ -145,9 +148,9 @@ Warning, version 450 is not yet complete; most version-specific features are pre MemberDecorate 523(B2) 7 Offset 72 Decorate 523(B2) BufferBlock Decorate 525 DescriptorSet 0 - Decorate 526 SpecId 100 - Decorate 527 SpecId 101 - Decorate 528 SpecId 102 + Decorate 526(sf16) SpecId 100 + Decorate 527(sf) SpecId 101 + Decorate 528(sd) SpecId 102 2: TypeVoid 3: TypeFunction 2 28: TypeFloat 16 @@ -223,14 +226,14 @@ Warning, version 450 is not yet complete; most version-specific features are pre 523(B2): TypeStruct 28(float) 29(fvec2) 151(fvec3) 519 406 520 521(S) 522 524: TypePointer Uniform 523(B2) 525: 524(ptr) Variable Uniform - 526: 28(float) SpecConstant 12288 - 527: 164(float) SpecConstant 1048576000 - 528: 172(float) SpecConstant 0 1071644672 - 529: 164(float) SpecConstantOp 115 526 - 530: 164(float) SpecConstantOp 115 526 + 526(sf16): 28(float) SpecConstant 12288 + 527(sf): 164(float) SpecConstant 1048576000 + 528(sd): 172(float) SpecConstant 0 1071644672 + 529: 164(float) SpecConstantOp 115 526(sf16) + 530: 164(float) SpecConstantOp 115 526(sf16) 531: 172(float) SpecConstantOp 115 530 - 532: 28(float) SpecConstantOp 115 527 - 533: 28(float) SpecConstantOp 115 528 + 532: 28(float) SpecConstantOp 115 527(sf) + 533: 28(float) SpecConstantOp 115 528(sd) 4(main): 2 Function None 3 5: Label Return diff --git a/3rdparty/glslang/Test/baseResults/spv.int64.frag.out b/3rdparty/glslang/Test/baseResults/spv.int64.frag.out index cb5433ec6..df35fea78 100644 --- a/3rdparty/glslang/Test/baseResults/spv.int64.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.int64.frag.out @@ -51,6 +51,11 @@ Warning, version 450 is not yet complete; most version-specific features are pre MemberName 454(Block) 0 "i64v" MemberName 454(Block) 1 "u64" Name 456 "block" + Name 457 "si64" + Name 458 "su64" + Name 459 "si" + Name 460 "su" + Name 461 "sb" MemberDecorate 28(Uniforms) 0 Offset 0 Decorate 28(Uniforms) Block Decorate 30 DescriptorSet 0 @@ -60,11 +65,11 @@ Warning, version 450 is not yet complete; most version-specific features are pre Decorate 454(Block) Block Decorate 456(block) DescriptorSet 0 Decorate 456(block) Binding 1 - Decorate 457 SpecId 100 - Decorate 458 SpecId 101 - Decorate 459 SpecId 102 - Decorate 460 SpecId 103 - Decorate 461 SpecId 104 + Decorate 457(si64) SpecId 100 + Decorate 458(su64) SpecId 101 + Decorate 459(si) SpecId 102 + Decorate 460(su) SpecId 103 + Decorate 461(sb) SpecId 104 2: TypeVoid 3: TypeFunction 2 14: TypeInt 64 0 @@ -148,28 +153,28 @@ Warning, version 450 is not yet complete; most version-specific features are pre 454(Block): TypeStruct 136(ivec3) 14(int) 455: TypePointer Uniform 454(Block) 456(block): 455(ptr) Variable Uniform - 457: 18(int) SpecConstant 4294967286 4294967295 - 458: 14(int) SpecConstant 20 0 - 459: 31(int) SpecConstant 4294967291 - 460: 21(int) SpecConstant 4 - 461: 55(bool) SpecConstantTrue - 462: 55(bool) SpecConstantOp 171 457 69 - 463: 55(bool) SpecConstantOp 171 458 69 - 464: 18(int) SpecConstantOp 169 461 61 60 - 465: 14(int) SpecConstantOp 169 461 70 69 - 466: 31(int) SpecConstantOp 114 457 - 467: 18(int) SpecConstantOp 114 459 - 468: 21(int) SpecConstantOp 113 458 - 469: 14(int) SpecConstantOp 113 460 - 470: 18(int) SpecConstantOp 128 458 69 - 471: 14(int) SpecConstantOp 128 457 69 - 472: 21(int) SpecConstantOp 113 458 + 457(si64): 18(int) SpecConstant 4294967286 4294967295 + 458(su64): 14(int) SpecConstant 20 0 + 459(si): 31(int) SpecConstant 4294967291 + 460(su): 21(int) SpecConstant 4 + 461(sb): 55(bool) SpecConstantTrue + 462: 55(bool) SpecConstantOp 171 457(si64) 69 + 463: 55(bool) SpecConstantOp 171 458(su64) 69 + 464: 18(int) SpecConstantOp 169 461(sb) 61 60 + 465: 14(int) SpecConstantOp 169 461(sb) 70 69 + 466: 31(int) SpecConstantOp 114 457(si64) + 467: 18(int) SpecConstantOp 114 459(si) + 468: 21(int) SpecConstantOp 113 458(su64) + 469: 14(int) SpecConstantOp 113 460(su) + 470: 18(int) SpecConstantOp 128 458(su64) 69 + 471: 14(int) SpecConstantOp 128 457(si64) 69 + 472: 21(int) SpecConstantOp 113 458(su64) 473: 31(int) SpecConstantOp 128 472 219 - 474: 18(int) SpecConstantOp 114 459 + 474: 18(int) SpecConstantOp 114 459(si) 475: 14(int) SpecConstantOp 128 474 69 - 476: 31(int) SpecConstantOp 114 457 + 476: 31(int) SpecConstantOp 114 457(si64) 477: 21(int) SpecConstantOp 128 476 219 - 478: 14(int) SpecConstantOp 113 460 + 478: 14(int) SpecConstantOp 113 460(su) 479: 18(int) SpecConstantOp 128 478 69 4(main): 2 Function None 3 5: Label diff --git a/3rdparty/glslang/Test/baseResults/spv.specConst.vert.out b/3rdparty/glslang/Test/baseResults/spv.specConst.vert.out index 5a7de46fe..5e2020fe0 100755 --- a/3rdparty/glslang/Test/baseResults/spv.specConst.vert.out +++ b/3rdparty/glslang/Test/baseResults/spv.specConst.vert.out @@ -17,6 +17,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre MemberName 11(gl_PerVertex) 2 "gl_ClipDistance" MemberName 11(gl_PerVertex) 3 "gl_CullDistance" Name 13 "" + Name 18 "a" Name 25 "gl_VertexID" Name 26 "gl_InstanceID" MemberDecorate 11(gl_PerVertex) 0 BuiltIn Position @@ -24,7 +25,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre MemberDecorate 11(gl_PerVertex) 2 BuiltIn ClipDistance MemberDecorate 11(gl_PerVertex) 3 BuiltIn CullDistance Decorate 11(gl_PerVertex) Block - Decorate 18 SpecId 11 + Decorate 18(a) SpecId 11 Decorate 25(gl_VertexID) BuiltIn VertexId Decorate 26(gl_InstanceID) BuiltIn InstanceId 2: TypeVoid @@ -41,14 +42,14 @@ Warning, version 450 is not yet complete; most version-specific features are pre 15: 14(int) Constant 0 16: 6(float) Constant 1065353216 17: 7(fvec4) ConstantComposite 16 16 16 16 - 18: 14(int) SpecConstant 8 + 18(a): 14(int) SpecConstant 8 22: TypePointer Output 7(fvec4) 24: TypePointer Input 14(int) 25(gl_VertexID): 24(ptr) Variable Input 26(gl_InstanceID): 24(ptr) Variable Input 4(main): 2 Function None 3 5: Label - 19: 6(float) ConvertSToF 18 + 19: 6(float) ConvertSToF 18(a) 20: 7(fvec4) CompositeConstruct 19 19 19 19 21: 7(fvec4) FDiv 17 20 23: 22(ptr) AccessChain 13 15 diff --git a/3rdparty/glslang/Test/baseResults/spv.specConstant.vert.out b/3rdparty/glslang/Test/baseResults/spv.specConstant.vert.out index dc10e2387..a6750e579 100644 --- a/3rdparty/glslang/Test/baseResults/spv.specConstant.vert.out +++ b/3rdparty/glslang/Test/baseResults/spv.specConstant.vert.out @@ -12,33 +12,44 @@ Warning, version 400 is not yet complete; most version-specific features are pre EntryPoint Vertex 4 "main" 20 22 28 53 Source GLSL 400 Name 4 "main" + Name 9 "arraySize" Name 14 "foo(vf4[s1516];" Name 13 "p" Name 17 "builtin_spec_constant(" Name 20 "color" Name 22 "ucol" Name 28 "size" + Name 30 "spBool" + Name 34 "scale" + Name 39 "spDouble" + Name 40 "spFloat" Name 47 "param" + Name 50 "dupArraySize" Name 53 "dupUcol" + Name 60 "spDupBool" + Name 63 "dupScale" + Name 67 "spDupDouble" + Name 68 "spDupFloat" Name 76 "result" - Decorate 9 SpecId 16 - Decorate 30 SpecId 17 - Decorate 34 SpecId 22 - Decorate 39 SpecId 19 - Decorate 40 SpecId 18 - Decorate 50 SpecId 116 - Decorate 60 SpecId 117 - Decorate 63 SpecId 122 - Decorate 67 SpecId 119 - Decorate 68 SpecId 118 - Decorate 77 SpecId 24 + Name 77 "gl_MaxImageUnits" + Decorate 9(arraySize) SpecId 16 + Decorate 30(spBool) SpecId 17 + Decorate 34(scale) SpecId 22 + Decorate 39(spDouble) SpecId 19 + Decorate 40(spFloat) SpecId 18 + Decorate 50(dupArraySize) SpecId 116 + Decorate 60(spDupBool) SpecId 117 + Decorate 63(dupScale) SpecId 122 + Decorate 67(spDupDouble) SpecId 119 + Decorate 68(spDupFloat) SpecId 118 + Decorate 77(gl_MaxImageUnits) SpecId 24 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 8: TypeInt 32 1 - 9: 8(int) SpecConstant 5 - 10: TypeArray 7(fvec4) 9 + 9(arraySize): 8(int) SpecConstant 5 + 10: TypeArray 7(fvec4) 9(arraySize) 11: TypePointer Function 10 12: TypeFunction 2 11(ptr) 16: TypeFunction 8(int) @@ -51,41 +62,41 @@ Warning, version 400 is not yet complete; most version-specific features are pre 27: TypePointer Output 8(int) 28(size): 27(ptr) Variable Output 29: TypeBool - 30: 29(bool) SpecConstantTrue + 30(spBool): 29(bool) SpecConstantTrue 33: TypeInt 32 0 - 34: 33(int) SpecConstant 2 + 34(scale): 33(int) SpecConstant 2 38: TypeFloat 64 - 39: 38(float) SpecConstant 1413754136 1074340347 - 40: 6(float) SpecConstant 1078523331 - 41: 38(float) SpecConstantOp 115 40 - 50: 8(int) SpecConstant 12 - 51: TypeArray 7(fvec4) 50 + 39(spDouble): 38(float) SpecConstant 1413754136 1074340347 + 40(spFloat): 6(float) SpecConstant 1078523331 + 41: 38(float) SpecConstantOp 115 40(spFloat) +50(dupArraySize): 8(int) SpecConstant 12 + 51: TypeArray 7(fvec4) 50(dupArraySize) 52: TypePointer Input 51 53(dupUcol): 52(ptr) Variable Input - 60: 29(bool) SpecConstantTrue - 63: 33(int) SpecConstant 2 - 67: 38(float) SpecConstant 1413754136 1074340347 - 68: 6(float) SpecConstant 1078523331 - 69: 38(float) SpecConstantOp 115 68 + 60(spDupBool): 29(bool) SpecConstantTrue + 63(dupScale): 33(int) SpecConstant 2 + 67(spDupDouble): 38(float) SpecConstant 1413754136 1074340347 + 68(spDupFloat): 6(float) SpecConstant 1078523331 + 69: 38(float) SpecConstantOp 115 68(spDupFloat) 75: TypePointer Function 8(int) - 77: 8(int) SpecConstant 8 +77(gl_MaxImageUnits): 8(int) SpecConstant 8 4(main): 2 Function None 3 5: Label 47(param): 11(ptr) Variable Function 25: 24(ptr) AccessChain 22(ucol) 23 26: 7(fvec4) Load 25 Store 20(color) 26 - Store 28(size) 9 + Store 28(size) 9(arraySize) SelectionMerge 32 None - BranchConditional 30 31 32 + BranchConditional 30(spBool) 31 32 31: Label - 35: 6(float) ConvertUToF 34 + 35: 6(float) ConvertUToF 34(scale) 36: 7(fvec4) Load 20(color) 37: 7(fvec4) VectorTimesScalar 36 35 Store 20(color) 37 Branch 32 32: Label - 42: 38(float) FDiv 39 41 + 42: 38(float) FDiv 39(spDouble) 41 43: 6(float) FConvert 42 44: 7(fvec4) Load 20(color) 45: 7(fvec4) CompositeConstruct 43 43 43 43 @@ -105,18 +116,18 @@ Warning, version 400 is not yet complete; most version-specific features are pre 57: 7(fvec4) FAdd 56 55 Store 20(color) 57 58: 8(int) Load 28(size) - 59: 8(int) IAdd 58 50 + 59: 8(int) IAdd 58 50(dupArraySize) Store 28(size) 59 SelectionMerge 62 None - BranchConditional 60 61 62 + BranchConditional 60(spDupBool) 61 62 61: Label - 64: 6(float) ConvertUToF 63 + 64: 6(float) ConvertUToF 63(dupScale) 65: 7(fvec4) Load 20(color) 66: 7(fvec4) VectorTimesScalar 65 64 Store 20(color) 66 Branch 62 62: Label - 70: 38(float) FDiv 67 69 + 70: 38(float) FDiv 67(spDupDouble) 69 71: 6(float) FConvert 70 72: 7(fvec4) Load 20(color) 73: 7(fvec4) CompositeConstruct 71 71 71 71 @@ -127,7 +138,7 @@ Warning, version 400 is not yet complete; most version-specific features are pre 17(builtin_spec_constant(): 8(int) Function None 16 18: Label 76(result): 75(ptr) Variable Function - Store 76(result) 77 + Store 76(result) 77(gl_MaxImageUnits) 78: 8(int) Load 76(result) ReturnValue 78 FunctionEnd diff --git a/3rdparty/glslang/Test/baseResults/spv.specConstantComposite.vert.out b/3rdparty/glslang/Test/baseResults/spv.specConstantComposite.vert.out index f8c556edc..9079554ba 100644 --- a/3rdparty/glslang/Test/baseResults/spv.specConstantComposite.vert.out +++ b/3rdparty/glslang/Test/baseResults/spv.specConstantComposite.vert.out @@ -18,29 +18,33 @@ Warning, version 450 is not yet complete; most version-specific features are pre Name 12 "refer_composite_bracket_dereference(" Name 16 "refer_spec_const_array_length(" Name 18 "declare_spec_const_in_func(" + Name 21 "spec_bool" Name 27 "color" + Name 28 "spec_int" Name 33 "len" + Name 37 "spec_float" + Name 39 "spec_double" Name 42 "global_vec4_array_with_spec_length" - Decorate 21 SpecId 203 - Decorate 28 SpecId 200 - Decorate 37 SpecId 201 - Decorate 39 SpecId 202 + Decorate 21(spec_bool) SpecId 203 + Decorate 28(spec_int) SpecId 200 + Decorate 37(spec_float) SpecId 201 + Decorate 39(spec_double) SpecId 202 2: TypeVoid 3: TypeFunction 2 14: TypeInt 32 1 15: TypeFunction 14(int) 20: TypeBool - 21: 20(bool) SpecConstantTrue + 21(spec_bool): 20(bool) SpecConstantTrue 24: TypeFloat 32 25: TypeVector 24(float) 4 26: TypePointer Output 25(fvec4) 27(color): 26(ptr) Variable Output - 28: 14(int) SpecConstant 3 + 28(spec_int): 14(int) SpecConstant 3 32: TypePointer Function 14(int) - 37: 24(float) SpecConstant 1078523331 + 37(spec_float): 24(float) SpecConstant 1078523331 38: TypeFloat 64 - 39: 38(float) SpecConstant 1413754136 1074340347 - 40: TypeArray 25(fvec4) 28 + 39(spec_double): 38(float) SpecConstant 1413754136 1074340347 + 40: TypeArray 25(fvec4) 28(spec_int) 41: TypePointer Input 40 42(global_vec4_array_with_spec_length): 41(ptr) Variable Input 4(main): 2 Function None 3 @@ -50,9 +54,9 @@ Warning, version 450 is not yet complete; most version-specific features are pre 6(refer_primary_spec_const(): 2 Function None 3 7: Label SelectionMerge 23 None - BranchConditional 21 22 23 + BranchConditional 21(spec_bool) 22 23 22: Label - 29: 24(float) ConvertSToF 28 + 29: 24(float) ConvertSToF 28(spec_int) 30: 25(fvec4) Load 27(color) 31: 25(fvec4) VectorTimesScalar 30 29 Store 27(color) 31 @@ -75,7 +79,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre 16(refer_spec_const_array_length(): 14(int) Function None 15 17: Label 33(len): 32(ptr) Variable Function - Store 33(len) 28 + Store 33(len) 28(spec_int) 34: 14(int) Load 33(len) ReturnValue 34 FunctionEnd diff --git a/3rdparty/glslang/Test/baseResults/spv.specConstantOperations.vert.out b/3rdparty/glslang/Test/baseResults/spv.specConstantOperations.vert.out index e2395c82b..d6da726e6 100644 --- a/3rdparty/glslang/Test/baseResults/spv.specConstantOperations.vert.out +++ b/3rdparty/glslang/Test/baseResults/spv.specConstantOperations.vert.out @@ -14,85 +14,90 @@ Warning, version 450 is not yet complete; most version-specific features are pre Name 4 "main" Name 8 "non_const_array_size_from_spec_const(" Name 11 "i" + Name 19 "sp_int" Name 27 "array" - Decorate 19 SpecId 201 - Decorate 40 SpecId 200 - Decorate 42 SpecId 202 - Decorate 43 SpecId 203 - Decorate 45 SpecId 204 + Name 40 "sp_float" + Name 42 "sp_uint" + Name 43 "sp_sint" + Name 45 "sp_double" + Decorate 19(sp_int) SpecId 201 + Decorate 40(sp_float) SpecId 200 + Decorate 42(sp_uint) SpecId 202 + Decorate 43(sp_sint) SpecId 203 + Decorate 45(sp_double) SpecId 204 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 1 7: TypeFunction 6(int) 10: TypePointer Function 6(int) 12: 6(int) Constant 0 - 19: 6(int) SpecConstant 10 + 19(sp_int): 6(int) SpecConstant 10 20: 6(int) Constant 2 - 21: 6(int) SpecConstantOp 128 19 20 + 21: 6(int) SpecConstantOp 128 19(sp_int) 20 22: TypeBool - 24: 6(int) SpecConstantOp 128 19 20 + 24: 6(int) SpecConstantOp 128 19(sp_int) 20 25: TypeArray 6(int) 24 26: TypePointer Function 25 29: 6(int) Constant 1023 32: 6(int) Constant 1 - 34: 6(int) SpecConstantOp 128 19 32 + 34: 6(int) SpecConstantOp 128 19(sp_int) 32 39: TypeFloat 32 - 40: 39(float) SpecConstant 1078530010 + 40(sp_float): 39(float) SpecConstant 1078530010 41: TypeInt 32 0 - 42: 41(int) SpecConstant 100 - 43: 6(int) SpecConstant 4294967286 + 42(sp_uint): 41(int) SpecConstant 100 + 43(sp_sint): 6(int) SpecConstant 4294967286 44: TypeFloat 64 - 45: 44(float) SpecConstant 2333366019 1074118410 - 46: 39(float) SpecConstantOp 115 45 - 47: 44(float) SpecConstantOp 115 40 + 45(sp_double): 44(float) SpecConstant 2333366019 1074118410 + 46: 39(float) SpecConstantOp 115 45(sp_double) + 47: 44(float) SpecConstantOp 115 40(sp_float) 48: 41(int) Constant 0 - 49: 22(bool) SpecConstantOp 171 19 48 - 50: 22(bool) SpecConstantOp 171 42 48 + 49: 22(bool) SpecConstantOp 171 19(sp_int) 48 + 50: 22(bool) SpecConstantOp 171 42(sp_uint) 48 51: 6(int) SpecConstantOp 169 49 32 12 52: 41(int) Constant 1 53: 41(int) SpecConstantOp 169 49 52 48 - 54: 41(int) SpecConstantOp 128 43 48 - 55: 6(int) SpecConstantOp 128 42 48 - 56: 6(int) SpecConstantOp 126 19 - 57: 6(int) SpecConstantOp 200 19 - 58: 6(int) SpecConstantOp 128 19 20 - 59: 6(int) SpecConstantOp 128 19 20 + 54: 41(int) SpecConstantOp 128 43(sp_sint) 48 + 55: 6(int) SpecConstantOp 128 42(sp_uint) 48 + 56: 6(int) SpecConstantOp 126 19(sp_int) + 57: 6(int) SpecConstantOp 200 19(sp_int) + 58: 6(int) SpecConstantOp 128 19(sp_int) 20 + 59: 6(int) SpecConstantOp 128 19(sp_int) 20 60: 6(int) Constant 3 61: 6(int) SpecConstantOp 130 59 60 62: 6(int) Constant 4 63: 6(int) SpecConstantOp 130 58 62 - 64: 6(int) SpecConstantOp 132 43 20 + 64: 6(int) SpecConstantOp 132 43(sp_sint) 20 65: 41(int) Constant 2 - 66: 41(int) SpecConstantOp 132 42 65 + 66: 41(int) SpecConstantOp 132 42(sp_uint) 65 67: 6(int) Constant 5 68: 6(int) SpecConstantOp 135 64 67 69: 41(int) Constant 5 70: 41(int) SpecConstantOp 134 66 69 - 71: 6(int) SpecConstantOp 139 43 62 + 71: 6(int) SpecConstantOp 139 43(sp_sint) 62 72: 41(int) Constant 4 - 73: 41(int) SpecConstantOp 137 42 72 - 74: 6(int) SpecConstantOp 132 43 60 + 73: 41(int) SpecConstantOp 137 42(sp_uint) 72 + 74: 6(int) SpecConstantOp 132 43(sp_sint) 60 75: 6(int) SpecConstantOp 135 74 67 76: 6(int) Constant 10 - 77: 6(int) SpecConstantOp 195 43 76 + 77: 6(int) SpecConstantOp 195 43(sp_sint) 76 78: 6(int) Constant 20 - 79: 41(int) SpecConstantOp 194 42 78 - 80: 6(int) SpecConstantOp 196 43 32 - 81: 41(int) SpecConstantOp 196 42 20 + 79: 41(int) SpecConstantOp 194 42(sp_uint) 78 + 80: 6(int) SpecConstantOp 196 43(sp_sint) 32 + 81: 41(int) SpecConstantOp 196 42(sp_uint) 20 82: 6(int) Constant 256 - 83: 6(int) SpecConstantOp 197 43 82 + 83: 6(int) SpecConstantOp 197 43(sp_sint) 82 84: 41(int) Constant 512 - 85: 41(int) SpecConstantOp 198 42 84 - 86: 22(bool) SpecConstantOp 177 19 43 - 87: 22(bool) SpecConstantOp 170 42 42 - 88: 22(bool) SpecConstantOp 173 19 43 + 85: 41(int) SpecConstantOp 198 42(sp_uint) 84 + 86: 22(bool) SpecConstantOp 177 19(sp_int) 43(sp_sint) + 87: 22(bool) SpecConstantOp 170 42(sp_uint) 42(sp_uint) + 88: 22(bool) SpecConstantOp 173 19(sp_int) 43(sp_sint) 89: 6(int) Constant 30 90: TypeVector 6(int) 4 - 91: 90(ivec4) SpecConstantComposite 78 89 19 19 + 91: 90(ivec4) SpecConstantComposite 78 89 19(sp_int) 19(sp_int) 92: 41(int) Constant 4294967295 93: 41(int) Constant 4294967294 94: TypeVector 41(int) 4 - 95: 94(ivec4) SpecConstantComposite 42 42 92 93 + 95: 94(ivec4) SpecConstantComposite 42(sp_uint) 42(sp_uint) 92 93 96: TypeVector 22(bool) 4 97: 94(ivec4) ConstantComposite 48 48 48 48 98: 96(bvec4) SpecConstantOp 171 91 97 diff --git a/3rdparty/glslang/Test/baseResults/vulkan.ast.vert.out b/3rdparty/glslang/Test/baseResults/vulkan.ast.vert.out index f245585a4..c07656d1c 100755 --- a/3rdparty/glslang/Test/baseResults/vulkan.ast.vert.out +++ b/3rdparty/glslang/Test/baseResults/vulkan.ast.vert.out @@ -269,56 +269,59 @@ Shader version: 450 EntryPoint Vertex 4 "main" Source GLSL 450 Name 4 "main" - Decorate 7 SpecId 200 - Decorate 11 SpecId 201 - Decorate 13 SpecId 202 + Name 7 "scf1" + Name 11 "scbt" + Name 13 "sci2" + Decorate 7(scf1) SpecId 200 + Decorate 11(scbt) SpecId 201 + Decorate 13(sci2) SpecId 202 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 - 7: 6(float) SpecConstant 1065353216 + 7(scf1): 6(float) SpecConstant 1065353216 8: TypeBool 9: 6(float) Constant 0 - 11: 8(bool) SpecConstantTrue + 11(scbt): 8(bool) SpecConstantTrue 12: TypeInt 32 1 - 13: 12(int) SpecConstant 2 + 13(sci2): 12(int) SpecConstant 2 14: TypeInt 32 0 15: 14(int) Constant 0 - 16: 8(bool) SpecConstantOp 171 13 15 + 16: 8(bool) SpecConstantOp 171 13(sci2) 15 17: 6(float) Constant 1065353216 21: 12(int) Constant 0 22: 12(int) Constant 1 - 23: 12(int) SpecConstantOp 169 11 22 21 - 25: 8(bool) SpecConstantOp 166 11 11 - 26: 12(int) SpecConstantOp 132 13 13 - 30: 8(bool) SpecConstantOp 168 11 - 31: 12(int) SpecConstantOp 126 13 - 33: 8(bool) SpecConstantOp 173 13 13 - 35: 8(bool) SpecConstantOp 165 11 11 - 36: 8(bool) SpecConstantOp 171 13 13 + 23: 12(int) SpecConstantOp 169 11(scbt) 22 21 + 25: 8(bool) SpecConstantOp 166 11(scbt) 11(scbt) + 26: 12(int) SpecConstantOp 132 13(sci2) 13(sci2) + 30: 8(bool) SpecConstantOp 168 11(scbt) + 31: 12(int) SpecConstantOp 126 13(sci2) + 33: 8(bool) SpecConstantOp 173 13(sci2) 13(sci2) + 35: 8(bool) SpecConstantOp 165 11(scbt) 11(scbt) + 36: 8(bool) SpecConstantOp 171 13(sci2) 13(sci2) 37: TypeVector 12(int) 2 - 38: 37(ivec2) SpecConstantComposite 13 13 - 39: 37(ivec2) SpecConstantComposite 13 13 - 40: 37(ivec2) SpecConstantComposite 13 13 + 38: 37(ivec2) SpecConstantComposite 13(sci2) 13(sci2) + 39: 37(ivec2) SpecConstantComposite 13(sci2) 13(sci2) + 40: 37(ivec2) SpecConstantComposite 13(sci2) 13(sci2) 41: 14(int) Constant 2 42: TypeArray 37(ivec2) 41 44: TypeVector 6(float) 2 48: TypeArray 44(fvec2) 41 4(main): 2 Function None 3 5: Label - 10: 8(bool) FOrdNotEqual 7 9 - 18: 6(float) Select 11 17 9 - 19: 6(float) ConvertSToF 13 - 20: 12(int) ConvertFToS 7 - 24: 6(float) FMul 7 7 - 27: 6(float) ConvertSToF 13 - 28: 6(float) FAdd 7 27 - 29: 6(float) FNegate 7 - 32: 8(bool) FOrdGreaterThan 7 7 - 34: 8(bool) FOrdNotEqual 7 7 + 10: 8(bool) FOrdNotEqual 7(scf1) 9 + 18: 6(float) Select 11(scbt) 17 9 + 19: 6(float) ConvertSToF 13(sci2) + 20: 12(int) ConvertFToS 7(scf1) + 24: 6(float) FMul 7(scf1) 7(scf1) + 27: 6(float) ConvertSToF 13(sci2) + 28: 6(float) FAdd 7(scf1) 27 + 29: 6(float) FNegate 7(scf1) + 32: 8(bool) FOrdGreaterThan 7(scf1) 7(scf1) + 34: 8(bool) FOrdNotEqual 7(scf1) 7(scf1) 43: 42 CompositeConstruct 39 40 - 45: 44(fvec2) CompositeConstruct 7 7 - 46: 44(fvec2) CompositeConstruct 7 7 - 47: 44(fvec2) CompositeConstruct 7 7 + 45: 44(fvec2) CompositeConstruct 7(scf1) 7(scf1) + 46: 44(fvec2) CompositeConstruct 7(scf1) 7(scf1) + 47: 44(fvec2) CompositeConstruct 7(scf1) 7(scf1) 49: 48 CompositeConstruct 46 47 Return FunctionEnd diff --git a/3rdparty/glslang/Test/hlsl.init.frag b/3rdparty/glslang/Test/hlsl.init.frag index a3f6f0e79..8caf3c7d9 100644 --- a/3rdparty/glslang/Test/hlsl.init.frag +++ b/3rdparty/glslang/Test/hlsl.init.frag @@ -34,3 +34,8 @@ float4 ShaderFunction(float4 input) : COLOR0 return input * a1; } + +cbuffer Constants +{ + float a = 1.0f, b, c = 2.0f; +}; diff --git a/3rdparty/glslang/Test/link1.vk.frag b/3rdparty/glslang/Test/link1.vk.frag new file mode 100644 index 000000000..443a32052 --- /dev/null +++ b/3rdparty/glslang/Test/link1.vk.frag @@ -0,0 +1,10 @@ +#version 450 + +vec4 getColor(); + +out vec4 color; + +void main() +{ + color = getColor(); +} diff --git a/3rdparty/glslang/Test/link2.vk.frag b/3rdparty/glslang/Test/link2.vk.frag new file mode 100644 index 000000000..b1630cb58 --- /dev/null +++ b/3rdparty/glslang/Test/link2.vk.frag @@ -0,0 +1,8 @@ +#version 450 + +uniform sampler2D s2D; + +vec4 getColor() +{ + return texture(s2D, vec2(0.5)); +} diff --git a/3rdparty/glslang/glslang/CMakeLists.txt b/3rdparty/glslang/glslang/CMakeLists.txt index 95d4bdd8f..dac8cb892 100644 --- a/3rdparty/glslang/glslang/CMakeLists.txt +++ b/3rdparty/glslang/glslang/CMakeLists.txt @@ -82,6 +82,10 @@ set(HEADERS add_library(glslang STATIC ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS}) set_property(TARGET glslang PROPERTY FOLDER glslang) +target_link_libraries(glslang OGLCompiler OSDependent) +if(ENABLE_HLSL) + target_link_libraries(glslang HLSL) +endif() if(WIN32) source_group("Public" REGULAR_EXPRESSION "Public/*") @@ -93,3 +97,8 @@ endif(WIN32) install(TARGETS glslang ARCHIVE DESTINATION lib) + +foreach(file ${HEADERS}) + get_filename_component(dir ${file} DIRECTORY) + install(FILES ${file} DESTINATION include/glslang/${dir}) +endforeach() diff --git a/3rdparty/glslang/glslang/Include/PoolAlloc.h b/3rdparty/glslang/glslang/Include/PoolAlloc.h index 100c7d0b5..69bacb156 100644 --- a/3rdparty/glslang/glslang/Include/PoolAlloc.h +++ b/3rdparty/glslang/glslang/Include/PoolAlloc.h @@ -255,7 +255,7 @@ extern TPoolAllocator& GetThreadPoolAllocator(); struct TThreadMemoryPools { - TPoolAllocator* threadPoolAllocator; + TPoolAllocator* threadPoolAllocator; }; void SetThreadPoolAllocator(TPoolAllocator& poolAllocator); diff --git a/3rdparty/glslang/glslang/Include/revision.h b/3rdparty/glslang/glslang/Include/revision.h index 5ef393d39..796f81a9b 100644 --- a/3rdparty/glslang/glslang/Include/revision.h +++ b/3rdparty/glslang/glslang/Include/revision.h @@ -2,5 +2,5 @@ // For the version, it uses the latest git tag followed by the number of commits. // For the date, it uses the current date (when then script is run). -#define GLSLANG_REVISION "Overload400-PrecQual.1773" -#define GLSLANG_DATE "19-Jan-2017" +#define GLSLANG_REVISION "Overload400-PrecQual.1805" +#define GLSLANG_DATE "02-Feb-2017" diff --git a/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp b/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp index 8d68517a3..af3e8119d 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp @@ -1232,7 +1232,7 @@ TIntermAggregate* TIntermediate::makeAggregate(const TSourceLoc& loc) // // Returns the selection node created. // -TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, const TSourceLoc& loc) +TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, const TSourceLoc& loc) { // // Don't prune the false path for compile-time constants; it's needed @@ -1281,6 +1281,12 @@ TIntermTyped* TIntermediate::addMethod(TIntermTyped* object, const TType& type, // TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc& loc) { + // If it's void, go to the if-then-else selection() + if (trueBlock->getBasicType() == EbtVoid && falseBlock->getBasicType() == EbtVoid) { + TIntermNodePair pair = { trueBlock, falseBlock }; + return addSelection(cond, pair, loc); + } + // // Get compatible types. // diff --git a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp index 1c12eddd0..f2ae8efa4 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -3431,9 +3431,9 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT oldType.getQualifier().layoutViewportRelative = newType.getQualifier().layoutViewportRelative; oldType.getQualifier().layoutSecondaryViewportRelativeOffset = newType.getQualifier().layoutSecondaryViewportRelativeOffset; } +#endif if (oldType.isImplicitlySizedArray() && newType.isExplicitlySizedArray()) oldType.changeOuterArraySize(newType.getOuterArraySize()); -#endif // go to next member ++member; diff --git a/3rdparty/glslang/glslang/MachineIndependent/PoolAlloc.cpp b/3rdparty/glslang/glslang/MachineIndependent/PoolAlloc.cpp index 3502e9399..4007c3861 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/PoolAlloc.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/PoolAlloc.cpp @@ -105,8 +105,8 @@ void SetThreadPoolAllocator(TPoolAllocator& poolAllocator) TPoolAllocator::TPoolAllocator(int growthIncrement, int allocationAlignment) : pageSize(growthIncrement), alignment(allocationAlignment), - freeList(0), - inUseList(0), + freeList(nullptr), + inUseList(nullptr), numCalls(0) { // diff --git a/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp b/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp index dadac56a7..b0e55132a 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp @@ -1632,6 +1632,7 @@ TProgram::TProgram() : pool(0), reflection(0), ioMapper(nullptr), linked(false) TProgram::~TProgram() { + delete ioMapper; delete infoSink; delete reflection; @@ -1707,6 +1708,15 @@ bool TProgram::linkStage(EShLanguage stage, EShMessages messages) intermediate[stage] = new TIntermediate(stage, firstIntermediate->getVersion(), firstIntermediate->getProfile()); + + + // The new TIntermediate must use the same origin as the original TIntermediates. + // Otherwise linking will fail due to different coordinate systems. + if (firstIntermediate->getOriginUpperLeft()) { + intermediate[stage]->setOriginUpperLeft(); + } + intermediate[stage]->setSpv(firstIntermediate->getSpv()); + newedIntermediate[stage] = true; } diff --git a/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp b/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp index a2b353183..04868f16a 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp @@ -209,6 +209,9 @@ struct TResolverAdaptor TIoMapResolver& resolver; TInfoSink& infoSink; bool& error; + +private: + TResolverAdaptor& operator=(TResolverAdaptor&); }; /* diff --git a/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h b/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h index ec58d50d4..29efb54c9 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h +++ b/3rdparty/glslang/glslang/MachineIndependent/localintermediate.h @@ -252,7 +252,7 @@ public: TIntermAggregate* makeAggregate(const TSourceLoc&); TIntermTyped* setAggregateOperator(TIntermNode*, TOperator, const TType& type, TSourceLoc); bool areAllChildConst(TIntermAggregate* aggrNode); - TIntermNode* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&); + TIntermTyped* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&); TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&); TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&); TIntermTyped* addMethod(TIntermTyped*, const TType&, const TString*, const TSourceLoc&); diff --git a/3rdparty/glslang/glslang/Public/ShaderLang.h b/3rdparty/glslang/glslang/Public/ShaderLang.h index 6c3fb11cb..d2f4e1b5c 100644 --- a/3rdparty/glslang/glslang/Public/ShaderLang.h +++ b/3rdparty/glslang/glslang/Public/ShaderLang.h @@ -540,6 +540,7 @@ protected: bool linked; private: + TProgram(TProgram&); TProgram& operator=(TProgram&); }; diff --git a/3rdparty/glslang/gtests/CMakeLists.txt b/3rdparty/glslang/gtests/CMakeLists.txt index a06442dfb..c383ca074 100644 --- a/3rdparty/glslang/gtests/CMakeLists.txt +++ b/3rdparty/glslang/gtests/CMakeLists.txt @@ -17,6 +17,7 @@ if (TARGET gmock) ${CMAKE_CURRENT_SOURCE_DIR}/HexFloat.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Hlsl.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/Link.FromFile.Vk.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Pp.FromFile.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Spv.FromFile.cpp # -- Remapper tests diff --git a/3rdparty/glslang/gtests/Link.FromFile.Vk.cpp b/3rdparty/glslang/gtests/Link.FromFile.Vk.cpp new file mode 100644 index 000000000..6ce1fe9f7 --- /dev/null +++ b/3rdparty/glslang/gtests/Link.FromFile.Vk.cpp @@ -0,0 +1,97 @@ +// +// Copyright (C) 2016-2017 Google, Inc. +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// +// Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// +// Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// +// Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#include + +#include + +#include "TestFixture.h" + +namespace glslangtest { +namespace { + +using LinkTestVulkan = GlslangTest< + ::testing::TestWithParam>>; + +TEST_P(LinkTestVulkan, FromFile) +{ + const auto& fileNames = GetParam(); + const size_t fileCount = fileNames.size(); + const EShMessages controls = DeriveOptions(Source::GLSL, Semantics::Vulkan, Target::AST); + GlslangResult result; + + // Compile each input shader file. + std::vector> shaders; + for (size_t i = 0; i < fileCount; ++i) { + std::string contents; + tryLoadFile(GlobalTestSettings.testRoot + "/" + fileNames[i], + "input", &contents); + shaders.emplace_back( + new glslang::TShader(GetShaderStage(GetSuffix(fileNames[i])))); + auto* shader = shaders.back().get(); + compile(shader, contents, "", controls); + result.shaderResults.push_back( + {fileNames[i], shader->getInfoLog(), shader->getInfoDebugLog()}); + } + + // Link all of them. + glslang::TProgram program; + for (const auto& shader : shaders) program.addShader(shader.get()); + program.link(controls); + result.linkingOutput = program.getInfoLog(); + result.linkingError = program.getInfoDebugLog(); + + std::ostringstream stream; + outputResultToStream(&stream, result, controls); + + // Check with expected results. + const std::string expectedOutputFname = + GlobalTestSettings.testRoot + "/baseResults/" + fileNames.front() + ".out"; + std::string expectedOutput; + tryLoadFile(expectedOutputFname, "expected output", &expectedOutput); + + checkEqAndUpdateIfRequested(expectedOutput, stream.str(), expectedOutputFname); +} + +// clang-format off +INSTANTIATE_TEST_CASE_P( + Glsl, LinkTestVulkan, + ::testing::ValuesIn(std::vector>({ + {"link1.vk.frag", "link2.vk.frag"}, + })), +); +// clang-format on + +} // anonymous namespace +} // namespace glslangtest diff --git a/3rdparty/glslang/hlsl/hlslGrammar.cpp b/3rdparty/glslang/hlsl/hlslGrammar.cpp index 6ae7f8002..6c2041375 100755 --- a/3rdparty/glslang/hlsl/hlslGrammar.cpp +++ b/3rdparty/glslang/hlsl/hlslGrammar.cpp @@ -1758,6 +1758,16 @@ bool HlslGrammar::acceptStructDeclarationList(TTypeList*& typeList) acceptPostDecls(member.type->getQualifier()); + // EQUAL assignment_expression + if (acceptTokenClass(EHTokAssign)) { + parseContext.warn(idToken.loc, "struct-member initializers ignored", "typedef", ""); + TIntermTyped* expressionNode = nullptr; + if (! acceptAssignmentExpression(expressionNode)) { + expected("initializer"); + return false; + } + } + // success on seeing the SEMICOLON coming up if (peekTokenClass(EHTokSemicolon)) break; @@ -2319,6 +2329,8 @@ bool HlslGrammar::acceptPostfixExpression(TIntermTyped*& node) tFinalize(HlslParseContext& p) : parseContext(p) { } ~tFinalize() { parseContext.finalizeFlattening(); } HlslParseContext& parseContext; + private: + tFinalize& operator=(tFinalize&) { } } finalize(parseContext); // Initialize the flattening accumulation data, so we can track data across multiple bracket or diff --git a/scripts/shaderc.lua b/scripts/shaderc.lua index f252b656b..319062c98 100644 --- a/scripts/shaderc.lua +++ b/scripts/shaderc.lua @@ -28,6 +28,7 @@ project "glslang" "-Wno-inconsistent-missing-override", "-Wno-missing-field-initializers", "-Wno-reorder", + "-Wno-return-type", "-Wno-shadow", "-Wno-sign-compare", "-Wno-undef",