diff --git a/3rdparty/glslang/.clang-format b/3rdparty/glslang/.clang-format index daf87985e..8c73a52fe 100644 --- a/3rdparty/glslang/.clang-format +++ b/3rdparty/glslang/.clang-format @@ -1,7 +1,8 @@ Language: Cpp IndentWidth: 4 +PointerAlignment: Left BreakBeforeBraces: Custom -BraceWrapping: { AfterFunction: true, AfterControlStatement: true } +BraceWrapping: { AfterFunction: true, AfterControlStatement: false } IndentCaseLabels: false ReflowComments: false ColumnLimit: 120 diff --git a/3rdparty/glslang/StandAlone/StandAlone.cpp b/3rdparty/glslang/StandAlone/StandAlone.cpp index bb37a840e..b7c438771 100644 --- a/3rdparty/glslang/StandAlone/StandAlone.cpp +++ b/3rdparty/glslang/StandAlone/StandAlone.cpp @@ -162,6 +162,7 @@ const char* shaderStageName = nullptr; const char* variableName = nullptr; bool HlslEnable16BitTypes = false; bool HlslDX9compatible = false; +bool DumpBuiltinSymbols = false; std::vector IncludeDirectoryList; // Source environment @@ -494,6 +495,8 @@ void ProcessArguments(std::vector>& workItem Error("--client expects vulkan100 or opengl100"); } bumpArg(); + } else if (lowerword == "dump-builtin-symbols") { + DumpBuiltinSymbols = true; } else if (lowerword == "entry-point") { entryPointName = argv[1]; if (argc <= 1) @@ -833,6 +836,8 @@ void SetMessageOptions(EShMessages& messages) messages = (EShMessages)(messages | EShMsgHlslLegalization); if (HlslDX9compatible) messages = (EShMessages)(messages | EShMsgHlslDX9Compatible); + if (DumpBuiltinSymbols) + messages = (EShMessages)(messages | EShMsgBuiltinSymbolTable); } // @@ -1520,6 +1525,7 @@ void usage() " --auto-map-locations | --aml automatically locate input/output lacking\n" " 'location' (fragile, not cross stage)\n" " --client {vulkan|opengl} see -V and -G\n" + " --dump-builtin-symbols prints builtin symbol table prior each compile\n" " -dumpfullversion | -dumpversion print bare major.minor.patchlevel\n" " --flatten-uniform-arrays | --fua flatten uniform texture/sampler arrays to\n" " scalars\n" diff --git a/3rdparty/glslang/Test/310.comp b/3rdparty/glslang/Test/310.comp index 9ca8eaaa1..33ecbf018 100644 --- a/3rdparty/glslang/Test/310.comp +++ b/3rdparty/glslang/Test/310.comp @@ -106,9 +106,9 @@ layout(r32i) coherent restrict readonly uniform iimage2D qualim2; void passrc() { - passr(qualim1); - passr(qualim2); // ERROR, drops restrict - passr(iimg2D); + passr(qualim1); // ERROR, changing formats + passr(qualim2); // ERROR, drops restrict, ERROR, changing formats + passr(iimg2D); // ERROR, changing formats } highp layout(rg8i) uniform readonly uimage2D i1bad; // ERROR, type mismatch diff --git a/3rdparty/glslang/Test/420.vert b/3rdparty/glslang/Test/420.vert index ab28140e5..c7ffa9027 100644 --- a/3rdparty/glslang/Test/420.vert +++ b/3rdparty/glslang/Test/420.vert @@ -131,9 +131,9 @@ layout(r32i) coherent volatile readonly uniform iimage2D qualim2; void passrc() { - passr(qualim1); - passr(qualim2); // ERROR, drops volatile - passr(iimg2D); + passr(qualim1); // ERROR, changing formats + passr(qualim2); // ERROR, drops volatile, ERROR, changing formats + passr(iimg2D); // ERROR, changing formats } layout(rg8i) uniform uimage2D i1bad; // ERROR, type mismatch diff --git a/3rdparty/glslang/Test/baseResults/310.comp.out b/3rdparty/glslang/Test/baseResults/310.comp.out index 5a926f67f..4b65ea11f 100644 --- a/3rdparty/glslang/Test/baseResults/310.comp.out +++ b/3rdparty/glslang/Test/baseResults/310.comp.out @@ -28,6 +28,10 @@ ERROR: 0:90: 'imageAtomicMax' : no matching overloaded function found ERROR: 0:94: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter ERROR: 0:97: '' : memory qualifiers cannot be used on this type ERROR: 0:98: '' : memory qualifiers cannot be used on this type +ERROR: 0:109: 'format' : image formats must match +ERROR: 0:110: 'restrict' : argument cannot drop memory qualifier when passed to formal parameter +ERROR: 0:110: 'format' : image formats must match +ERROR: 0:111: 'format' : image formats must match ERROR: 0:114: 'image load-store format' : not supported with this profile: es ERROR: 0:114: 'rg8i' : does not apply to unsigned integer images ERROR: 0:115: 'rgba32i' : does not apply to floating point images @@ -83,7 +87,7 @@ WARNING: 0:238: '#define' : names containing consecutive underscores are reserve ERROR: 0:244: 'gl_DeviceIndex' : required extension not requested: GL_EXT_device_group ERROR: 0:245: 'gl_ViewIndex' : undeclared identifier ERROR: 0:255: 'gl_ViewIndex' : undeclared identifier -ERROR: 82 compilation errors. No code generated. +ERROR: 86 compilation errors. No code generated. Shader version: 310 diff --git a/3rdparty/glslang/Test/baseResults/420.vert.out b/3rdparty/glslang/Test/baseResults/420.vert.out index 740c8fe7a..c572d97b7 100644 --- a/3rdparty/glslang/Test/baseResults/420.vert.out +++ b/3rdparty/glslang/Test/baseResults/420.vert.out @@ -38,7 +38,10 @@ ERROR: 0:115: 'imageAtomicMax' : no matching overloaded function found ERROR: 0:119: 'writeonly' : argument cannot drop memory qualifier when passed to formal parameter ERROR: 0:122: '' : memory qualifiers cannot be used on this type ERROR: 0:123: '' : memory qualifiers cannot be used on this type +ERROR: 0:134: 'format' : image formats must match ERROR: 0:135: 'volatile' : argument cannot drop memory qualifier when passed to formal parameter +ERROR: 0:135: 'format' : image formats must match +ERROR: 0:136: 'format' : image formats must match ERROR: 0:139: 'rg8i' : does not apply to unsigned integer images ERROR: 0:140: 'rgba32i' : does not apply to floating point images ERROR: 0:141: 'rgba32f' : does not apply to unsigned integer images @@ -52,7 +55,7 @@ ERROR: 0:157: 'assign' : cannot convert from ' const float' to ' temp int' ERROR: 0:158: 'textureQueryLevels' : no matching overloaded function found ERROR: 0:158: 'assign' : cannot convert from ' const float' to ' temp int' WARNING: 0:161: '[]' : assuming binding count of one for compile-time checking of binding numbers for unsized array -ERROR: 51 compilation errors. No code generated. +ERROR: 54 compilation errors. No code generated. Shader version: 420 diff --git a/3rdparty/glslang/Test/baseResults/specExamples.vert.out b/3rdparty/glslang/Test/baseResults/specExamples.vert.out index 5c8ca391b..3a83f3b7c 100644 --- a/3rdparty/glslang/Test/baseResults/specExamples.vert.out +++ b/3rdparty/glslang/Test/baseResults/specExamples.vert.out @@ -30,8 +30,10 @@ ERROR: 0:132: 'shared' : not supported in this stage: vertex ERROR: 0:134: '' : function does not return a value: funcA ERROR: 0:136: '' : function does not return a value: funcB ERROR: 0:153: '' : function does not return a value: func3 +ERROR: 0:169: 'format' : image formats must match ERROR: 0:170: 'coherent' : argument cannot drop memory qualifier when passed to formal parameter -ERROR: 32 compilation errors. No code generated. +ERROR: 0:170: 'format' : image formats must match +ERROR: 34 compilation errors. No code generated. Shader version: 430 diff --git a/3rdparty/glslang/Test/baseResults/specExamplesConf.vert.out b/3rdparty/glslang/Test/baseResults/specExamplesConf.vert.out index e7217817d..6487de22b 100644 --- a/3rdparty/glslang/Test/baseResults/specExamplesConf.vert.out +++ b/3rdparty/glslang/Test/baseResults/specExamplesConf.vert.out @@ -31,8 +31,10 @@ ERROR: 0:132: 'shared' : not supported in this stage: vertex ERROR: 0:134: '' : function does not return a value: funcA ERROR: 0:136: '' : function does not return a value: funcB ERROR: 0:153: '' : function does not return a value: func3 +ERROR: 0:169: 'format' : image formats must match ERROR: 0:170: 'coherent' : argument cannot drop memory qualifier when passed to formal parameter -ERROR: 33 compilation errors. No code generated. +ERROR: 0:170: 'format' : image formats must match +ERROR: 35 compilation errors. No code generated. Shader version: 430 diff --git a/3rdparty/glslang/Test/baseResults/spv.paramMemory.frag.out b/3rdparty/glslang/Test/baseResults/spv.paramMemory.frag.out index 02a485200..cba2fbd04 100644 --- a/3rdparty/glslang/Test/baseResults/spv.paramMemory.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.paramMemory.frag.out @@ -2,14 +2,14 @@ spv.paramMemory.frag Validation failed // Module Version 10000 // Generated by (magic number): 80007 -// Id's are bound by 69 +// Id's are bound by 64 Capability Shader Capability StorageImageReadWithoutFormat Capability StorageImageWriteWithoutFormat 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 27 66 + EntryPoint Fragment 4 "main" 27 61 ExecutionMode 4 OriginUpperLeft Source ESSL 310 Name 4 "main" @@ -22,39 +22,28 @@ Validation failed Name 22 "data" Name 27 "in_coords" Name 35 "read1" - Name 38 "image1" - Name 39 "param" - Name 42 "read2" - Name 45 "image2" + Name 38 "read2" + Name 43 "image3" Name 46 "param" - Name 49 "image3" - Name 53 "param" - Name 55 "param" - Name 57 "image4" - Name 61 "param" - Name 63 "param" - Name 66 "out_color" + Name 48 "param" + Name 52 "image4" + Name 56 "param" + Name 58 "param" + Name 61 "out_color" Decorate 14(image) Coherent Decorate 14(image) NonWritable Decorate 20(image) Coherent Decorate 20(image) NonReadable Decorate 27(in_coords) Flat Decorate 27(in_coords) Location 0 - Decorate 38(image1) DescriptorSet 0 - Decorate 38(image1) Binding 0 - Decorate 38(image1) Coherent - Decorate 38(image1) NonWritable - Decorate 45(image2) DescriptorSet 0 - Decorate 45(image2) Binding 2 - Decorate 45(image2) NonWritable - Decorate 49(image3) DescriptorSet 0 - Decorate 49(image3) Binding 1 - Decorate 49(image3) Coherent - Decorate 49(image3) NonReadable - Decorate 57(image4) DescriptorSet 0 - Decorate 57(image4) Binding 3 - Decorate 57(image4) NonReadable - Decorate 66(out_color) Location 0 + Decorate 43(image3) DescriptorSet 0 + Decorate 43(image3) Binding 1 + Decorate 43(image3) Coherent + Decorate 43(image3) NonReadable + Decorate 52(image4) DescriptorSet 0 + Decorate 52(image4) Binding 3 + Decorate 52(image4) NonReadable + Decorate 61(out_color) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -69,51 +58,44 @@ Validation failed 19: TypeFunction 2 8(ptr) 11(ptr) 18(ptr) 26: TypePointer Input 10(ivec2) 27(in_coords): 26(ptr) Variable Input - 36: TypeImage 6(float) 2D nonsampled format:Rgba32f - 37: TypePointer UniformConstant 36 - 38(image1): 37(ptr) Variable UniformConstant - 43: TypeImage 6(float) 2D nonsampled format:Rgba16f - 44: TypePointer UniformConstant 43 - 45(image2): 44(ptr) Variable UniformConstant - 49(image3): 37(ptr) Variable UniformConstant - 51: 6(float) Constant 1056964608 - 57(image4): 44(ptr) Variable UniformConstant - 59: 6(float) Constant 1073741824 - 65: TypePointer Output 12(fvec4) - 66(out_color): 65(ptr) Variable Output - 67: 6(float) Constant 0 - 68: 12(fvec4) ConstantComposite 67 67 67 67 + 36: 6(float) Constant 1053609165 + 37: 12(fvec4) ConstantComposite 36 36 36 36 + 39: 6(float) Constant 1056964608 + 40: 12(fvec4) ConstantComposite 39 39 39 39 + 41: TypeImage 6(float) 2D nonsampled format:Rgba32f + 42: TypePointer UniformConstant 41 + 43(image3): 42(ptr) Variable UniformConstant + 50: TypeImage 6(float) 2D nonsampled format:Rgba16f + 51: TypePointer UniformConstant 50 + 52(image4): 51(ptr) Variable UniformConstant + 54: 6(float) Constant 1073741824 + 60: TypePointer Output 12(fvec4) + 61(out_color): 60(ptr) Variable Output + 62: 6(float) Constant 0 + 63: 12(fvec4) ConstantComposite 62 62 62 62 4(main): 2 Function None 3 5: Label 35(read1): 18(ptr) Variable Function - 39(param): 11(ptr) Variable Function - 42(read2): 18(ptr) Variable Function + 38(read2): 18(ptr) Variable Function 46(param): 11(ptr) Variable Function - 53(param): 11(ptr) Variable Function - 55(param): 18(ptr) Variable Function - 61(param): 11(ptr) Variable Function - 63(param): 18(ptr) Variable Function - 40: 10(ivec2) Load 27(in_coords) - Store 39(param) 40 - 41: 12(fvec4) FunctionCall 16(image_load(I21;vi2;) 38(image1) 39(param) - Store 35(read1) 41 + 48(param): 18(ptr) Variable Function + 56(param): 11(ptr) Variable Function + 58(param): 18(ptr) Variable Function + Store 35(read1) 37 + Store 38(read2) 40 + 44: 12(fvec4) Load 35(read1) + 45: 12(fvec4) VectorTimesScalar 44 39 47: 10(ivec2) Load 27(in_coords) Store 46(param) 47 - 48: 12(fvec4) FunctionCall 16(image_load(I21;vi2;) 45(image2) 46(param) - Store 42(read2) 48 - 50: 12(fvec4) Load 35(read1) - 52: 12(fvec4) VectorTimesScalar 50 51 - 54: 10(ivec2) Load 27(in_coords) - Store 53(param) 54 - Store 55(param) 52 - 56: 2 FunctionCall 23(image_store(I21;vi2;vf4;) 49(image3) 53(param) 55(param) - 58: 12(fvec4) Load 42(read2) - 60: 12(fvec4) VectorTimesScalar 58 59 - 62: 10(ivec2) Load 27(in_coords) - Store 61(param) 62 - Store 63(param) 60 - 64: 2 FunctionCall 23(image_store(I21;vi2;vf4;) 57(image4) 61(param) 63(param) - Store 66(out_color) 68 + Store 48(param) 45 + 49: 2 FunctionCall 23(image_store(I21;vi2;vf4;) 43(image3) 46(param) 48(param) + 53: 12(fvec4) Load 38(read2) + 55: 12(fvec4) VectorTimesScalar 53 54 + 57: 10(ivec2) Load 27(in_coords) + Store 56(param) 57 + Store 58(param) 55 + 59: 2 FunctionCall 23(image_store(I21;vi2;vf4;) 52(image4) 56(param) 58(param) + Store 61(out_color) 63 Return FunctionEnd 16(image_load(I21;vi2;): 12(fvec4) Function None 13 diff --git a/3rdparty/glslang/Test/specExamples.vert b/3rdparty/glslang/Test/specExamples.vert index 9df1561fe..64ec7104b 100644 --- a/3rdparty/glslang/Test/specExamples.vert +++ b/3rdparty/glslang/Test/specExamples.vert @@ -166,8 +166,8 @@ void main() v.x = func2(a.x, b.x, c.x, d.x); // precise! func3(a.x * b.x, c.x * d.x, v.x); // precise! - funcA(img1); // OK, adding "restrict" is allowed - funcB(img2); // illegal, stripping "coherent" is not + funcA(img1); // OK, adding "restrict" is allowed, ERROR, changing formats + funcB(img2); // illegal, stripping "coherent" is not, ERROR, changing formats { struct light { diff --git a/3rdparty/glslang/Test/spv.paramMemory.frag b/3rdparty/glslang/Test/spv.paramMemory.frag index 79d2fe579..1d0808148 100644 --- a/3rdparty/glslang/Test/spv.paramMemory.frag +++ b/3rdparty/glslang/Test/spv.paramMemory.frag @@ -1,7 +1,7 @@ #version 310 es -readonly coherent uniform layout(set = 0, binding = 0, rgba32f) highp image2D image1; -readonly uniform layout(set = 0, binding = 2, rgba16f) highp image2D image2; +// readonly coherent uniform layout(set = 0, binding = 0) highp image2D image1; +// readonly uniform layout(set = 0, binding = 2) highp image2D image2; writeonly coherent uniform layout(set = 0, binding = 1, rgba32f) highp image2D image3; writeonly uniform layout(set = 0, binding = 3, rgba16f) highp image2D image4; @@ -20,8 +20,8 @@ void image_store(writeonly coherent highp image2D image, highp ivec2 coords, hig void main() { - highp vec4 read1 = image_load(image1, in_coords); - highp vec4 read2 = image_load(image2, in_coords); + highp vec4 read1 = vec4(0.4); // = image_load(image1, in_coords); + highp vec4 read2 = vec4(0.5); // = image_load(image2, in_coords); image_store(image3, in_coords, read1*0.5); image_store(image4, in_coords, read2*2.0); diff --git a/3rdparty/glslang/glslang/Include/Common.h b/3rdparty/glslang/glslang/Include/Common.h index d82bc1a1e..733a790cf 100644 --- a/3rdparty/glslang/glslang/Include/Common.h +++ b/3rdparty/glslang/glslang/Include/Common.h @@ -37,9 +37,9 @@ #ifndef _COMMON_INCLUDED_ #define _COMMON_INCLUDED_ -#include #if defined(__ANDROID__) || (defined(_MSC_VER) && _MSC_VER < 1700) +#include namespace std { template std::string to_string(const T& val) { @@ -102,6 +102,7 @@ std::string to_string(const T& val) { #include #include #include +#include #include #include "PoolAlloc.h" diff --git a/3rdparty/glslang/glslang/Include/Types.h b/3rdparty/glslang/glslang/Include/Types.h index d0d9b604a..90341dcb2 100644 --- a/3rdparty/glslang/glslang/Include/Types.h +++ b/3rdparty/glslang/glslang/Include/Types.h @@ -2018,7 +2018,7 @@ public: } // Add struct/block members - if (isStruct()) { + if (isStruct() && structure) { appendStr("{"); for (size_t i = 0; i < structure->size(); ++i) { if (! (*structure)[i].type->hiddenMember()) { diff --git a/3rdparty/glslang/glslang/Include/revision.h b/3rdparty/glslang/glslang/Include/revision.h index e4cb35e3c..dad700931 100644 --- a/3rdparty/glslang/glslang/Include/revision.h +++ b/3rdparty/glslang/glslang/Include/revision.h @@ -1,3 +1,3 @@ // This header is generated by the make-revision script. -#define GLSLANG_PATCH_LEVEL 3188 +#define GLSLANG_PATCH_LEVEL 3204 diff --git a/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp b/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp index 5e9c78482..4ec728d0f 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp @@ -410,7 +410,7 @@ TIntermTyped* TIntermediate::addBuiltInFunctionCall(const TSourceLoc& loc, TOper // // This is the safe way to change the operator on an aggregate, as it // does lots of error checking and fixing. Especially for establishing -// a function call's operation on it's set of parameters. Sequences +// a function call's operation on its set of parameters. Sequences // of instructions are also aggregates, but they just directly set // their operator to EOpSequence. // diff --git a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp index e1e2ee91d..8f575fbbb 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -1156,6 +1156,15 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction error(arguments->getLoc(), message, "readonly", ""); if (argQualifier.writeonly && ! formalQualifier.writeonly) error(arguments->getLoc(), message, "writeonly", ""); + if (!builtIn && argQualifier.restrict && ! formalQualifier.restrict) + error(arguments->getLoc(), message, "restrict", ""); + } + if (!builtIn && argQualifier.layoutFormat != formalQualifier.layoutFormat) { + // we have mismatched formats, which should only be allowed if writeonly + // and at least one format is unknown + if (!formalQualifier.writeonly || (formalQualifier.layoutFormat != ElfNone && + argQualifier.layoutFormat != ElfNone)) + error(arguments->getLoc(), "image formats must match", "format", ""); } if (builtIn && arg->getAsTyped()->getType().containsBasicType(EbtFloat16)) diff --git a/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp b/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp index adfe5344a..6f9db0195 100755 --- a/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/ShaderLang.cpp @@ -377,6 +377,8 @@ bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TS infoSink, commonTable, symbolTables); #endif + + return true; } @@ -474,6 +476,16 @@ void SetupBuiltinSymbolTable(int version, EProfile profile, const SpvVersion& sp glslang::ReleaseGlobalLock(); } +// Function to Print all builtins +void DumpBuiltinSymbolTable(TInfoSink& infoSink, const TSymbolTable& symbolTable) +{ + infoSink.debug << "BuiltinSymbolTable {\n"; + + symbolTable.dump(infoSink, true); + + infoSink.debug << "}\n"; +} + // Return true if the shader was correctly specified for version/profile/stage. bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNotFirst, int defaultVersion, EShSource source, int& version, EProfile& profile, const SpvVersion& spvVersion) @@ -905,6 +917,9 @@ bool ProcessDeferred( return false; } + if (messages & EShMsgBuiltinSymbolTable) + DumpBuiltinSymbolTable(compiler->infoSink, *symbolTable); + // // Now we can process the full shader under proper symbols and rules. // diff --git a/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp b/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp index d8d68468b..c0a02e68a 100755 --- a/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.cpp @@ -176,37 +176,77 @@ void TType::buildMangledName(TString& mangledName) const // Dump functions. // -void TVariable::dump(TInfoSink& infoSink) const +void TSymbol::dumpExtensions(TInfoSink& infoSink) const { - infoSink.debug << getName().c_str() << ": " << type.getStorageQualifierString() << " " << type.getBasicTypeString(); - if (type.isArray()) { - infoSink.debug << "[0]"; + int numExtensions = getNumExtensions(); + if (numExtensions) { + infoSink.debug << " <"; + + for (int i = 0; i < numExtensions; i++) + infoSink.debug << getExtensions()[i] << ","; + + infoSink.debug << ">"; } +} + +void TVariable::dump(TInfoSink& infoSink, bool complete) const +{ + if (complete) { + infoSink.debug << getName().c_str() << ": " << type.getCompleteString(); + dumpExtensions(infoSink); + } else { + infoSink.debug << getName().c_str() << ": " << type.getStorageQualifierString() << " " + << type.getBasicTypeString(); + + if (type.isArray()) + infoSink.debug << "[0]"; + } + infoSink.debug << "\n"; } -void TFunction::dump(TInfoSink& infoSink) const +void TFunction::dump(TInfoSink& infoSink, bool complete) const { - infoSink.debug << getName().c_str() << ": " << returnType.getBasicTypeString() << " " << getMangledName().c_str() << "\n"; + if (complete) { + infoSink.debug << getName().c_str() << ": " << returnType.getCompleteString() << " " << getName().c_str() + << "("; + + int numParams = getParamCount(); + for (int i = 0; i < numParams; i++) { + const TParameter ¶m = parameters[i]; + infoSink.debug << param.type->getCompleteString() << " " + << (param.type->isStruct() ? "of " + param.type->getTypeName() + " " : "") + << (param.name ? *param.name : "") << (i < numParams - 1 ? "," : ""); + } + + infoSink.debug << ")"; + dumpExtensions(infoSink); + } else { + infoSink.debug << getName().c_str() << ": " << returnType.getBasicTypeString() << " " + << getMangledName().c_str() << "n"; + } + + infoSink.debug << "\n"; } -void TAnonMember::dump(TInfoSink& TInfoSink) const +void TAnonMember::dump(TInfoSink& TInfoSink, bool complete) const { - TInfoSink.debug << "anonymous member " << getMemberNumber() << " of " << getAnonContainer().getName().c_str() << "\n"; + TInfoSink.debug << "anonymous member " << getMemberNumber() << " of " << getAnonContainer().getName().c_str() + << "\n"; } -void TSymbolTableLevel::dump(TInfoSink &infoSink) const +void TSymbolTableLevel::dump(TInfoSink& infoSink, bool complete) const { tLevel::const_iterator it; for (it = level.begin(); it != level.end(); ++it) - (*it).second->dump(infoSink); + (*it).second->dump(infoSink, complete); } -void TSymbolTable::dump(TInfoSink &infoSink) const +void TSymbolTable::dump(TInfoSink& infoSink, bool complete) const { for (int level = currentLevel(); level >= 0; --level) { infoSink.debug << "LEVEL " << level << "\n"; - table[level]->dump(infoSink); + table[level]->dump(infoSink, complete); } } diff --git a/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h b/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h index f9c190347..f3873cff0 100755 --- a/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h +++ b/3rdparty/glslang/glslang/MachineIndependent/SymbolTable.h @@ -116,7 +116,8 @@ public: } virtual int getNumExtensions() const { return extensions == nullptr ? 0 : (int)extensions->size(); } virtual const char** getExtensions() const { return extensions->data(); } - virtual void dump(TInfoSink &infoSink) const = 0; + virtual void dump(TInfoSink& infoSink, bool complete = false) const = 0; + void dumpExtensions(TInfoSink& infoSink) const; virtual bool isReadOnly() const { return ! writable; } virtual void makeReadOnly() { writable = false; } @@ -192,7 +193,7 @@ public: } virtual const char** getMemberExtensions(int member) const { return (*memberExtensions)[member].data(); } - virtual void dump(TInfoSink &infoSink) const; + virtual void dump(TInfoSink& infoSink, bool complete = false) const; protected: explicit TVariable(const TVariable&); @@ -313,7 +314,7 @@ public: virtual TParameter& operator[](int i) { assert(writable); return parameters[i]; } virtual const TParameter& operator[](int i) const { return parameters[i]; } - virtual void dump(TInfoSink &infoSink) const override; + virtual void dump(TInfoSink& infoSink, bool complete = false) const override; protected: explicit TFunction(const TFunction&); @@ -373,7 +374,7 @@ public: virtual const char** getExtensions() const override { return anonContainer.getMemberExtensions(memberNumber); } virtual int getAnonId() const { return anonId; } - virtual void dump(TInfoSink &infoSink) const override; + virtual void dump(TInfoSink& infoSink, bool complete = false) const override; protected: explicit TAnonMember(const TAnonMember&); @@ -541,7 +542,7 @@ public: void relateToOperator(const char* name, TOperator op); void setFunctionExtensions(const char* name, int num, const char* const extensions[]); - void dump(TInfoSink &infoSink) const; + void dump(TInfoSink& infoSink, bool complete = false) const; TSymbolTableLevel* clone() const; void readOnly(); @@ -842,7 +843,7 @@ public: } int getMaxSymbolId() { return uniqueId; } - void dump(TInfoSink &infoSink) const; + void dump(TInfoSink& infoSink, bool complete = false) const; void copyTable(const TSymbolTable& copyOf); void setPreviousDefaultPrecisions(TPrecisionQualifier *p) { table[currentLevel()]->setPreviousDefaultPrecisions(p); } diff --git a/3rdparty/glslang/glslang/Public/ShaderLang.h b/3rdparty/glslang/glslang/Public/ShaderLang.h index 0c2556976..d6b0bc9d5 100755 --- a/3rdparty/glslang/glslang/Public/ShaderLang.h +++ b/3rdparty/glslang/glslang/Public/ShaderLang.h @@ -234,6 +234,7 @@ enum EShMessages { EShMsgHlslEnable16BitTypes = (1 << 11), // enable use of 16-bit types in SPIR-V for HLSL EShMsgHlslLegalization = (1 << 12), // enable HLSL Legalization messages EShMsgHlslDX9Compatible = (1 << 13), // enable HLSL DX9 compatible mode (right now only for samplers) + EShMsgBuiltinSymbolTable = (1 << 14), // print the builtin symbol table }; //