From f237f9cff729a0b78c8e979a4da7f4428bfeeaf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Fri, 15 Feb 2019 19:40:02 -0800 Subject: [PATCH] Updated glslang. --- 3rdparty/glslang/StandAlone/StandAlone.cpp | 4 + .../glslang/Test/baseResults/cppBad.vert.out | 11 +- .../glslang/Test/baseResults/cppBad3.vert.out | 18 +++ .../baseResults/reflection.linked.options.out | 4 +- .../baseResults/reflection.options.frag.out | 2 +- .../baseResults/reflection.options.geom.out | 25 ++++ .../baseResults/reflection.options.vert.out | 7 +- .../spv.meshShaderBuiltins.mesh.out | 69 +++++----- .../spv.meshShaderRedeclBuiltins.mesh.out | 24 +++- 3rdparty/glslang/Test/cppBad.vert | 3 +- 3rdparty/glslang/Test/cppBad3.vert | 3 + 3rdparty/glslang/Test/reflection.options.geom | 31 +++++ 3rdparty/glslang/Test/reflection.options.vert | 11 +- 3rdparty/glslang/Test/runtests | 8 +- .../glslang/Test/spv.meshShaderBuiltins.mesh | 5 +- .../Test/spv.meshShaderRedeclBuiltins.mesh | 11 +- .../MachineIndependent/ParseHelper.cpp | 125 +++++++++++------ .../glslang/MachineIndependent/ParseHelper.h | 4 +- .../glslang/MachineIndependent/Versions.cpp | 2 +- .../MachineIndependent/preprocessor/Pp.cpp | 4 + .../preprocessor/PpScanner.cpp | 2 +- .../glslang/MachineIndependent/reflection.cpp | 129 +++++++++++++----- 3rdparty/glslang/glslang/Public/ShaderLang.h | 1 + 3rdparty/glslang/gtests/AST.FromFile.cpp | 1 + 3rdparty/glslang/hlsl/hlslGrammar.cpp | 4 +- 3rdparty/glslang/hlsl/hlslParseHelper.cpp | 6 +- 26 files changed, 368 insertions(+), 146 deletions(-) create mode 100755 3rdparty/glslang/Test/baseResults/cppBad3.vert.out create mode 100644 3rdparty/glslang/Test/baseResults/reflection.options.geom.out create mode 100644 3rdparty/glslang/Test/cppBad3.vert create mode 100644 3rdparty/glslang/Test/reflection.options.geom diff --git a/3rdparty/glslang/StandAlone/StandAlone.cpp b/3rdparty/glslang/StandAlone/StandAlone.cpp index 740ec7bde..bb37a840e 100644 --- a/3rdparty/glslang/StandAlone/StandAlone.cpp +++ b/3rdparty/glslang/StandAlone/StandAlone.cpp @@ -534,6 +534,8 @@ void ProcessArguments(std::vector>& workItem ReflectOptions |= EShReflectionSeparateBuffers; } else if (lowerword == "reflect-all-block-variables") { ReflectOptions |= EShReflectionAllBlockVariables; + } else if (lowerword == "reflect-unwrap-io-blocks") { + ReflectOptions |= EShReflectionUnwrapIOBlocks; } else if (lowerword == "resource-set-bindings" || // synonyms lowerword == "resource-set-binding" || lowerword == "rsb") { @@ -1538,6 +1540,8 @@ void usage() " separately to uniforms\n" " --reflect-all-block-variables reflect all variables in blocks, whether\n" " inactive or active\n" + " --reflect-unwrap-io-blocks unwrap input/output blocks the same as\n" + " uniform blocks\n" " --resource-set-binding [stage] name set binding\n" " set descriptor set and binding for\n" " individual resources\n" diff --git a/3rdparty/glslang/Test/baseResults/cppBad.vert.out b/3rdparty/glslang/Test/baseResults/cppBad.vert.out index a5267ff64..13a5fc1ce 100644 --- a/3rdparty/glslang/Test/baseResults/cppBad.vert.out +++ b/3rdparty/glslang/Test/baseResults/cppBad.vert.out @@ -1,9 +1,10 @@ cppBad.vert -ERROR: 0:2: 'preprocessor evaluation' : bad expression -ERROR: 0:2: '#if' : unexpected tokens following directive -ERROR: 0:5: 'string' : End of line in string -ERROR: 0:5: '""' : string literals not supported -ERROR: 0:5: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON +WARNING: 0:1: '#define' : missing space after macro name +ERROR: 0:3: 'preprocessor evaluation' : bad expression +ERROR: 0:3: '#if' : unexpected tokens following directive +ERROR: 0:6: 'string' : End of line in string +ERROR: 0:6: '""' : string literals not supported +ERROR: 0:6: '' : syntax error, unexpected INT, expecting COMMA or SEMICOLON ERROR: 5 compilation errors. No code generated. diff --git a/3rdparty/glslang/Test/baseResults/cppBad3.vert.out b/3rdparty/glslang/Test/baseResults/cppBad3.vert.out new file mode 100755 index 000000000..46f94da09 --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/cppBad3.vert.out @@ -0,0 +1,18 @@ +cppBad3.vert +ERROR: 0:3: 'macro expansion' : End of input in macro y +ERROR: 1 compilation errors. No code generated. + + +Shader version: 100 +ERROR: node is still EOpNull! +0:? Linker Objects + + +Linked vertex stage: + +ERROR: Linking vertex stage: Missing entry point: Each stage requires one entry point + +Shader version: 100 +ERROR: node is still EOpNull! +0:? Linker Objects + diff --git a/3rdparty/glslang/Test/baseResults/reflection.linked.options.out b/3rdparty/glslang/Test/baseResults/reflection.linked.options.out index b121626f6..af07bbd70 100644 --- a/3rdparty/glslang/Test/baseResults/reflection.linked.options.out +++ b/3rdparty/glslang/Test/baseResults/reflection.linked.options.out @@ -14,8 +14,8 @@ Buffer variable reflection: Buffer block reflection: Pipeline input reflection: -vertin: offset 0, type 1406, size 0, index 0, binding -1, stages 1 +vertin: offset 0, type 1406, size 1, index 0, binding -1, stages 1 Pipeline output reflection: -fragout: offset 0, type 1406, size 0, index 0, binding -1, stages 16 +fragout: offset 0, type 1406, size 1, index 0, binding -1, stages 16 diff --git a/3rdparty/glslang/Test/baseResults/reflection.options.frag.out b/3rdparty/glslang/Test/baseResults/reflection.options.frag.out index f3ea4cad6..ec12392fa 100644 --- a/3rdparty/glslang/Test/baseResults/reflection.options.frag.out +++ b/3rdparty/glslang/Test/baseResults/reflection.options.frag.out @@ -8,7 +8,7 @@ Buffer variable reflection: Buffer block reflection: Pipeline input reflection: -inval: offset 0, type 1406, size 0, index 0, binding -1, stages 16 +inval: offset 0, type 1406, size 1, index 0, binding -1, stages 16 Pipeline output reflection: diff --git a/3rdparty/glslang/Test/baseResults/reflection.options.geom.out b/3rdparty/glslang/Test/baseResults/reflection.options.geom.out new file mode 100644 index 000000000..7ffe82ded --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/reflection.options.geom.out @@ -0,0 +1,25 @@ +reflection.options.geom +Uniform reflection: + +Uniform block reflection: + +Buffer variable reflection: + +Buffer block reflection: + +Pipeline input reflection: +gl_PerVertex.gl_Position: offset 0, type 8b52, size 1, index 0, binding -1, stages 8 +gl_PerVertex.gl_PointSize: offset 0, type 1406, size 1, index 0, binding -1, stages 8 +gl_PerVertex.gl_ClipDistance[0]: offset 0, type 1406, size 1, index 0, binding -1, stages 8 +block.Color: offset 0, type 8b50, size 1, index 0, binding -1, stages 8 +block.Texcoord: offset 0, type 8b50, size 1, index 0, binding -1, stages 8 +block.in_a: offset 0, type 8b54, size 1, index 0, binding -1, stages 8 + +Pipeline output reflection: +gl_Position: offset 0, type 8b52, size 1, index 0, binding -1, stages 8 +gl_PointSize: offset 0, type 1406, size 1, index 0, binding -1, stages 8 +gl_ClipDistance[0]: offset 0, type 1406, size 1, index 0, binding -1, stages 8 +block.Color: offset 0, type 8b52, size 1, index 0, binding -1, stages 8 +block.a: offset 0, type 8b52, size 1, index 0, binding -1, stages 8 +block.b[0]: offset 0, type 8b50, size 3, index 0, binding -1, stages 8 + diff --git a/3rdparty/glslang/Test/baseResults/reflection.options.vert.out b/3rdparty/glslang/Test/baseResults/reflection.options.vert.out index 0a3b11886..45a7a875f 100644 --- a/3rdparty/glslang/Test/baseResults/reflection.options.vert.out +++ b/3rdparty/glslang/Test/baseResults/reflection.options.vert.out @@ -33,8 +33,11 @@ VertexCollection: offset -1, type ffffffff, size 400, index -1, binding -1, stag MultipleArrays: offset -1, type ffffffff, size 500, index -1, binding -1, stages 1, numMembers 9 Pipeline input reflection: -gl_InstanceID: offset 0, type 1404, size 0, index 0, binding -1, stages 1 +gl_InstanceID: offset 0, type 1404, size 1, index 0, binding -1, stages 1 Pipeline output reflection: -outval: offset 0, type 1406, size 0, index 0, binding -1, stages 1 +outval.val: offset 0, type 1406, size 1, index 0, binding -1, stages 1 +outval.a: offset 0, type 8b51, size 1, index 0, binding -1, stages 1 +outval.b[0]: offset 0, type 8b50, size 4, index 0, binding -1, stages 1 +outval.c: offset 0, type 8b5a, size 1, index 0, binding -1, stages 1 diff --git a/3rdparty/glslang/Test/baseResults/spv.meshShaderBuiltins.mesh.out b/3rdparty/glslang/Test/baseResults/spv.meshShaderBuiltins.mesh.out index 8090f7bf0..38d363bb3 100644 --- a/3rdparty/glslang/Test/baseResults/spv.meshShaderBuiltins.mesh.out +++ b/3rdparty/glslang/Test/baseResults/spv.meshShaderBuiltins.mesh.out @@ -1,7 +1,7 @@ spv.meshShaderBuiltins.mesh // Module Version 10000 // Generated by (magic number): 80007 -// Id's are bound by 146 +// Id's are bound by 148 Capability ClipDistance Capability CullDistance @@ -14,7 +14,7 @@ spv.meshShaderBuiltins.mesh Extension "SPV_NV_viewport_array2" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint MeshNV 4 "main" 11 17 34 88 128 139 143 + EntryPoint MeshNV 4 "main" 11 17 34 88 129 142 146 ExecutionMode 4 LocalSize 32 1 1 ExecutionMode 4 OutputVertices 81 ExecutionMode 4 OutputPrimitivesNV 32 @@ -43,9 +43,9 @@ spv.meshShaderBuiltins.mesh MemberName 84(gl_MeshPerPrimitiveNV) 4 "gl_LayerPerViewNV" MemberName 84(gl_MeshPerPrimitiveNV) 5 "gl_ViewportMaskPerViewNV" Name 88 "gl_MeshPrimitivesNV" - Name 128 "gl_PrimitiveIndicesNV" - Name 139 "gl_DrawID" - Name 143 "gl_PrimitiveCountNV" + Name 129 "gl_PrimitiveIndicesNV" + Name 142 "gl_DrawID" + Name 146 "gl_PrimitiveCountNV" Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId MemberDecorate 30(gl_MeshPerVertexNV) 0 BuiltIn Position @@ -74,10 +74,10 @@ spv.meshShaderBuiltins.mesh MemberDecorate 84(gl_MeshPerPrimitiveNV) 5 PerViewNV MemberDecorate 84(gl_MeshPerPrimitiveNV) 5 BuiltIn ViewportMaskPerViewNV Decorate 84(gl_MeshPerPrimitiveNV) Block - Decorate 128(gl_PrimitiveIndicesNV) BuiltIn PrimitiveIndicesNV - Decorate 139(gl_DrawID) BuiltIn DrawIndex - Decorate 143(gl_PrimitiveCountNV) BuiltIn PrimitiveCountNV - Decorate 145 BuiltIn WorkgroupSize + Decorate 129(gl_PrimitiveIndicesNV) BuiltIn PrimitiveIndicesNV + Decorate 142(gl_DrawID) BuiltIn DrawIndex + Decorate 146(gl_PrimitiveCountNV) BuiltIn PrimitiveCountNV + Decorate 147 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 @@ -130,17 +130,18 @@ spv.meshShaderBuiltins.mesh 94: 36(int) Constant 7 97: 36(int) Constant 8 100: 36(int) Constant 9 - 126: TypeArray 6(int) 31 - 127: TypePointer Output 126 -128(gl_PrimitiveIndicesNV): 127(ptr) Variable Output - 129: 6(int) Constant 257 - 130: TypePointer Output 6(int) - 138: TypePointer Input 36(int) - 139(gl_DrawID): 138(ptr) Variable Input - 142: 6(int) Constant 16909060 -143(gl_PrimitiveCountNV): 130(ptr) Variable Output - 144: 6(int) Constant 96 - 145: 9(ivec3) ConstantComposite 85 27 27 + 126: 6(int) Constant 96 + 127: TypeArray 6(int) 126 + 128: TypePointer Output 127 +129(gl_PrimitiveIndicesNV): 128(ptr) Variable Output + 130: 6(int) Constant 257 + 131: TypePointer Output 6(int) + 133: 36(int) Constant 95 + 141: TypePointer Input 36(int) + 142(gl_DrawID): 141(ptr) Variable Input + 145: 6(int) Constant 16909060 +146(gl_PrimitiveCountNV): 131(ptr) Variable Output + 147: 9(ivec3) ConstantComposite 85 27 27 4(main): 2 Function None 3 5: Label 8(iid): 7(ptr) Variable Function @@ -239,19 +240,21 @@ spv.meshShaderBuiltins.mesh Store 125 124 MemoryBarrier 27 55 ControlBarrier 56 56 55 - 131: 130(ptr) AccessChain 128(gl_PrimitiveIndicesNV) 37 - Store 131 129 - 132: 6(int) Load 16(gid) - 133: 6(int) Load 16(gid) - 134: 6(int) ISub 133 27 - 135: 130(ptr) AccessChain 128(gl_PrimitiveIndicesNV) 134 - 136: 6(int) Load 135 - 137: 130(ptr) AccessChain 128(gl_PrimitiveIndicesNV) 132 - Store 137 136 - 140: 36(int) Load 139(gl_DrawID) - 141: 6(int) Bitcast 140 - 142: 141 WritePackedPrimitiveIndices4x8NV - Store 143(gl_PrimitiveCountNV) 144 + 132: 131(ptr) AccessChain 129(gl_PrimitiveIndicesNV) 37 + Store 132 130 + 134: 131(ptr) AccessChain 129(gl_PrimitiveIndicesNV) 133 + Store 134 56 + 135: 6(int) Load 16(gid) + 136: 6(int) Load 16(gid) + 137: 6(int) ISub 136 27 + 138: 131(ptr) AccessChain 129(gl_PrimitiveIndicesNV) 137 + 139: 6(int) Load 138 + 140: 131(ptr) AccessChain 129(gl_PrimitiveIndicesNV) 135 + Store 140 139 + 143: 36(int) Load 142(gl_DrawID) + 144: 6(int) Bitcast 143 + 145: 144 WritePackedPrimitiveIndices4x8NV + Store 146(gl_PrimitiveCountNV) 126 MemoryBarrier 27 55 ControlBarrier 56 56 55 Return diff --git a/3rdparty/glslang/Test/baseResults/spv.meshShaderRedeclBuiltins.mesh.out b/3rdparty/glslang/Test/baseResults/spv.meshShaderRedeclBuiltins.mesh.out index f4491c0ec..4afbef9f4 100644 --- a/3rdparty/glslang/Test/baseResults/spv.meshShaderRedeclBuiltins.mesh.out +++ b/3rdparty/glslang/Test/baseResults/spv.meshShaderRedeclBuiltins.mesh.out @@ -1,7 +1,7 @@ spv.meshShaderRedeclBuiltins.mesh // Module Version 10000 // Generated by (magic number): 80007 -// Id's are bound by 120 +// Id's are bound by 129 Capability ClipDistance Capability CullDistance @@ -12,7 +12,7 @@ spv.meshShaderRedeclBuiltins.mesh Extension "SPV_NV_viewport_array2" 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint MeshNV 4 "main" 11 17 28 81 + EntryPoint MeshNV 4 "main" 11 17 28 81 122 127 ExecutionMode 4 LocalSize 32 1 1 ExecutionMode 4 OutputVertices 81 ExecutionMode 4 OutputPrimitivesNV 32 @@ -36,6 +36,8 @@ spv.meshShaderRedeclBuiltins.mesh MemberName 77(gl_MeshPerPrimitiveNV) 2 "gl_ViewportIndex" MemberName 77(gl_MeshPerPrimitiveNV) 3 "gl_ViewportMask" Name 81 "gl_MeshPrimitivesNV" + Name 122 "gl_PrimitiveIndicesNV" + Name 127 "gl_PrimitiveCountNV" Decorate 11(gl_LocalInvocationID) BuiltIn LocalInvocationId Decorate 17(gl_WorkGroupID) BuiltIn WorkgroupId MemberDecorate 24(gl_MeshPerVertexNV) 0 BuiltIn Position @@ -52,7 +54,9 @@ spv.meshShaderRedeclBuiltins.mesh MemberDecorate 77(gl_MeshPerPrimitiveNV) 3 PerPrimitiveNV MemberDecorate 77(gl_MeshPerPrimitiveNV) 3 BuiltIn ViewportMaskNV Decorate 77(gl_MeshPerPrimitiveNV) Block - Decorate 119 BuiltIn WorkgroupSize + Decorate 122(gl_PrimitiveIndicesNV) BuiltIn PrimitiveIndicesNV + Decorate 127(gl_PrimitiveCountNV) BuiltIn PrimitiveCountNV + Decorate 128 BuiltIn WorkgroupSize 2: TypeVoid 3: TypeFunction 2 6: TypeInt 32 0 @@ -98,7 +102,14 @@ spv.meshShaderRedeclBuiltins.mesh 87: 30(int) Constant 7 90: 30(int) Constant 8 93: 30(int) Constant 9 - 119: 9(ivec3) ConstantComposite 78 49 49 + 119: 6(int) Constant 96 + 120: TypeArray 6(int) 119 + 121: TypePointer Output 120 +122(gl_PrimitiveIndicesNV): 121(ptr) Variable Output + 123: TypePointer Output 6(int) + 125: 30(int) Constant 95 +127(gl_PrimitiveCountNV): 123(ptr) Variable Output + 128: 9(ivec3) ConstantComposite 78 49 49 4(main): 2 Function None 3 5: Label 8(iid): 7(ptr) Variable Function @@ -197,5 +208,10 @@ spv.meshShaderRedeclBuiltins.mesh Store 118 117 MemoryBarrier 49 50 ControlBarrier 51 51 50 + 124: 123(ptr) AccessChain 122(gl_PrimitiveIndicesNV) 31 + Store 124 49 + 126: 123(ptr) AccessChain 122(gl_PrimitiveIndicesNV) 125 + Store 126 51 + Store 127(gl_PrimitiveCountNV) 119 Return FunctionEnd diff --git a/3rdparty/glslang/Test/cppBad.vert b/3rdparty/glslang/Test/cppBad.vert index 0044c44fc..c1548c834 100644 --- a/3rdparty/glslang/Test/cppBad.vert +++ b/3rdparty/glslang/Test/cppBad.vert @@ -1,4 +1,5 @@ -#define m#0# +#define n#0# +#define m #0# #if m #endif #define n() diff --git a/3rdparty/glslang/Test/cppBad3.vert b/3rdparty/glslang/Test/cppBad3.vert new file mode 100644 index 000000000..95343db8f --- /dev/null +++ b/3rdparty/glslang/Test/cppBad3.vert @@ -0,0 +1,3 @@ +#define f =y(. +#define y(m) +y(f) \ No newline at end of file diff --git a/3rdparty/glslang/Test/reflection.options.geom b/3rdparty/glslang/Test/reflection.options.geom new file mode 100644 index 000000000..76ba3c049 --- /dev/null +++ b/3rdparty/glslang/Test/reflection.options.geom @@ -0,0 +1,31 @@ +#version 330 core + +precision highp float; + +layout(triangles) in; +layout(triangle_strip, max_vertices = 4) out; + +in block +{ + vec2 Color; + vec2 Texcoord; + flat ivec3 in_a; +} In[]; + +out block +{ + vec4 Color; + vec4 a; + vec2 b[3]; +} Out; + +void main() +{ + for(int i = 0; i < gl_in.length(); ++i) + { + gl_Position = gl_in[i].gl_Position; + Out.Color = vec4(In[i].Color, 0, 1); + EmitVertex(); + } + EndPrimitive(); +} diff --git a/3rdparty/glslang/Test/reflection.options.vert b/3rdparty/glslang/Test/reflection.options.vert index b8ecc8954..38c82ba6d 100644 --- a/3rdparty/glslang/Test/reflection.options.vert +++ b/3rdparty/glslang/Test/reflection.options.vert @@ -26,7 +26,14 @@ uniform UBO { uvec4 unused; } ubo; -out float outval; +struct OutputStruct { + float val; + vec3 a; + vec2 b[4]; + mat2x2 c; +}; + +out OutputStruct outval; void main() { @@ -40,5 +47,5 @@ void main() f += ubo.verts[gl_InstanceID].position[0]; f += ubo.flt[gl_InstanceID]; TriangleInfo tlocal[5] = t; - outval = f; + outval.val = f; } diff --git a/3rdparty/glslang/Test/runtests b/3rdparty/glslang/Test/runtests index f659da4d0..cc3430604 100755 --- a/3rdparty/glslang/Test/runtests +++ b/3rdparty/glslang/Test/runtests @@ -32,15 +32,17 @@ diff -b $BASEDIR/badMacroArgs.frag.out $TARGETDIR/badMacroArgs.frag.out || HASER echo Running reflection... $EXE -l -q -C reflection.vert > $TARGETDIR/reflection.vert.out diff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1 -$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables reflection.options.vert > $TARGETDIR/reflection.options.vert.out +$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks reflection.options.vert > $TARGETDIR/reflection.options.vert.out diff -b $BASEDIR/reflection.options.vert.out $TARGETDIR/reflection.options.vert.out || HASERROR=1 $EXE -l -q -C reflection.frag > $TARGETDIR/reflection.frag.out diff -b $BASEDIR/reflection.frag.out $TARGETDIR/reflection.frag.out || HASERROR=1 -$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables reflection.frag > $TARGETDIR/reflection.options.frag.out +$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks reflection.frag > $TARGETDIR/reflection.options.frag.out diff -b $BASEDIR/reflection.options.frag.out $TARGETDIR/reflection.options.frag.out || HASERROR=1 +$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks reflection.options.geom > $TARGETDIR/reflection.options.geom.out +diff -b $BASEDIR/reflection.options.geom.out $TARGETDIR/reflection.options.geom.out || HASERROR=1 $EXE -l -q -C reflection.linked.vert reflection.linked.frag > $TARGETDIR/reflection.linked.out diff -b $BASEDIR/reflection.linked.out $TARGETDIR/reflection.linked.out || HASERROR=1 -$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables reflection.linked.vert reflection.linked.frag > $TARGETDIR/reflection.linked.options.out +$EXE -l -q -C --reflect-strict-array-suffix --reflect-basic-array-suffix --reflect-intermediate-io --reflect-separate-buffers --reflect-all-block-variables --reflect-unwrap-io-blocks reflection.linked.vert reflection.linked.frag > $TARGETDIR/reflection.linked.options.out diff -b $BASEDIR/reflection.linked.options.out $TARGETDIR/reflection.linked.options.out || HASERROR=1 $EXE -D -Od -e flizv -l -q -C -V -Od hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out diff -b $BASEDIR/hlsl.reflection.vert.out $TARGETDIR/hlsl.reflection.vert.out || HASERROR=1 diff --git a/3rdparty/glslang/Test/spv.meshShaderBuiltins.mesh b/3rdparty/glslang/Test/spv.meshShaderBuiltins.mesh index 8adff3d82..0240a1735 100644 --- a/3rdparty/glslang/Test/spv.meshShaderBuiltins.mesh +++ b/3rdparty/glslang/Test/spv.meshShaderBuiltins.mesh @@ -50,8 +50,9 @@ void main() BARRIER(); - // should truncate 257 -> 1 - gl_PrimitiveIndicesNV[0] = 257; + // check bound limits + gl_PrimitiveIndicesNV[0] = 257; // should truncate 257 -> 1 + gl_PrimitiveIndicesNV[(MAX_PRIM * 3) - 1] = 2; gl_PrimitiveIndicesNV[gid] = gl_PrimitiveIndicesNV[gid-1]; // writes 4 indices at offset gl_DrawID diff --git a/3rdparty/glslang/Test/spv.meshShaderRedeclBuiltins.mesh b/3rdparty/glslang/Test/spv.meshShaderRedeclBuiltins.mesh index 38107b295..1b19a751e 100644 --- a/3rdparty/glslang/Test/spv.meshShaderRedeclBuiltins.mesh +++ b/3rdparty/glslang/Test/spv.meshShaderRedeclBuiltins.mesh @@ -22,14 +22,16 @@ out gl_MeshPerVertexNV { float gl_PointSize; float gl_ClipDistance[4]; float gl_CullDistance[4]; -} gl_MeshVerticesNV[]; +} gl_MeshVerticesNV[MAX_VER]; // explicitly sized to MAX_VER perprimitiveNV out gl_MeshPerPrimitiveNV { int gl_PrimitiveID; int gl_Layer; int gl_ViewportIndex; int gl_ViewportMask[]; -} gl_MeshPrimitivesNV[]; +} gl_MeshPrimitivesNV[]; // implicitly sized to MAX_PRIM + +out uint gl_PrimitiveIndicesNV[MAX_PRIM*3]; // explicitly sized to MAX_PRIM * 3 void main() { @@ -63,4 +65,9 @@ void main() gl_MeshPrimitivesNV[iid+1].gl_ViewportMask[0] = gl_MeshPrimitivesNV[iid].gl_ViewportMask[0]; BARRIER(); + + // check bound limits + gl_PrimitiveIndicesNV[0] = 1; + gl_PrimitiveIndicesNV[(MAX_PRIM * 3) - 1] = 2; + gl_PrimitiveCountNV = MAX_PRIM * 3; } diff --git a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp index 6e3865893..cf40baa14 100755 --- a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp @@ -572,7 +572,7 @@ void TParseContext::handleIoResizeArrayAccess(const TSourceLoc& /*loc*/, TInterm // fix array size, if it can be fixed and needs to be fixed (will allow variable indexing) if (symbolNode->getType().isUnsizedArray()) { - int newSize = getIoArrayImplicitSize(symbolNode->getType().getQualifier().isPerPrimitive()); + int newSize = getIoArrayImplicitSize(symbolNode->getType().getQualifier()); if (newSize > 0) symbolNode->getWritableType().changeOuterArraySize(newSize); } @@ -586,59 +586,80 @@ void TParseContext::handleIoResizeArrayAccess(const TSourceLoc& /*loc*/, TInterm // Types without an array size will be given one. // Types already having a size that is wrong will get an error. // -void TParseContext::checkIoArraysConsistency(const TSourceLoc& loc, bool tailOnly, bool isPerPrimitive) +void TParseContext::checkIoArraysConsistency(const TSourceLoc &loc, bool tailOnly) { - int requiredSize = getIoArrayImplicitSize(isPerPrimitive); - if (requiredSize == 0) - return; + int requiredSize = 0; + TString featureString; + size_t listSize = ioArraySymbolResizeList.size(); + size_t i = 0; - const char* feature; - if (language == EShLangGeometry) - feature = TQualifier::getGeometryString(intermediate.getInputPrimitive()); - else if (language == EShLangTessControl + // If tailOnly = true, only check the last array symbol in the list. + if (tailOnly) { + i = listSize - 1; + } + for (bool firstIteration = true; i < listSize; ++i) { + TType &type = ioArraySymbolResizeList[i]->getWritableType(); + + // As I/O array sizes don't change, fetch requiredSize only once, + // except for mesh shaders which could have different I/O array sizes based on type qualifiers. + if (firstIteration #ifdef NV_EXTENSIONS - || language == EShLangFragment + || (language == EShLangMeshNV) #endif ) + { + requiredSize = getIoArrayImplicitSize(type.getQualifier(), &featureString); + if (requiredSize == 0) + break; + firstIteration = false; + } - feature = "vertices"; -#ifdef NV_EXTENSIONS - else if (language == EShLangMeshNV) { - feature = isPerPrimitive ? "max_primitives" : "max_vertices"; - } -#endif - else - feature = "unknown"; - - if (tailOnly) { - checkIoArrayConsistency(loc, requiredSize, feature, ioArraySymbolResizeList.back()->getWritableType(), ioArraySymbolResizeList.back()->getName()); - return; + checkIoArrayConsistency(loc, requiredSize, featureString.c_str(), type, + ioArraySymbolResizeList[i]->getName()); } - - for (size_t i = 0; i < ioArraySymbolResizeList.size(); ++i) - checkIoArrayConsistency(loc, requiredSize, feature, ioArraySymbolResizeList[i]->getWritableType(), ioArraySymbolResizeList[i]->getName()); } -int TParseContext::getIoArrayImplicitSize(bool isPerPrimitive) const +int TParseContext::getIoArrayImplicitSize(const TQualifier &qualifier, TString *featureString) const { - if (language == EShLangGeometry) - return TQualifier::mapGeometryToSize(intermediate.getInputPrimitive()); - else if (language == EShLangTessControl) - return intermediate.getVertices() != TQualifier::layoutNotSet ? intermediate.getVertices() : 0; + int expectedSize = 0; + TString str = "unknown"; + unsigned int maxVertices = intermediate.getVertices() != TQualifier::layoutNotSet ? intermediate.getVertices() : 0; + + if (language == EShLangGeometry) { + expectedSize = TQualifier::mapGeometryToSize(intermediate.getInputPrimitive()); + str = TQualifier::getGeometryString(intermediate.getInputPrimitive()); + } + else if (language == EShLangTessControl) { + expectedSize = maxVertices; + str = "vertices"; + } #ifdef NV_EXTENSIONS - else if (language == EShLangFragment) - return 3; //Number of vertices for Fragment shader is always three. + else if (language == EShLangFragment) { + // Number of vertices for Fragment shader is always three. + expectedSize = 3; + str = "vertices"; + } else if (language == EShLangMeshNV) { - if (isPerPrimitive) { - return intermediate.getPrimitives() != TQualifier::layoutNotSet ? intermediate.getPrimitives() : 0; - } else { - return intermediate.getVertices() != TQualifier::layoutNotSet ? intermediate.getVertices() : 0; + unsigned int maxPrimitives = + intermediate.getPrimitives() != TQualifier::layoutNotSet ? intermediate.getPrimitives() : 0; + if (qualifier.builtIn == EbvPrimitiveIndicesNV) { + expectedSize = maxPrimitives * TQualifier::mapGeometryToSize(intermediate.getOutputPrimitive()); + str = "max_primitives*"; + str += TQualifier::getGeometryString(intermediate.getOutputPrimitive()); + } + else if (qualifier.isPerPrimitive()) { + expectedSize = maxPrimitives; + str = "max_primitives"; + } + else { + expectedSize = maxVertices; + str = "max_vertices"; } } #endif - - else - return 0; + if (featureString) + *featureString = str; + return expectedSize; } void TParseContext::checkIoArrayConsistency(const TSourceLoc& loc, int requiredSize, const char* feature, TType& type, const TString& name) @@ -1386,7 +1407,7 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction #endif ) { - length = getIoArrayImplicitSize(type.getQualifier().isPerPrimitive()); + length = getIoArrayImplicitSize(type.getQualifier()); } } if (length == 0) { @@ -3730,7 +3751,7 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie if (! symbolTable.atBuiltInLevel()) { if (isIoResizeArray(type)) { ioArraySymbolResizeList.push_back(symbol); - checkIoArraysConsistency(loc, true, type.getQualifier().isPerPrimitive()); + checkIoArraysConsistency(loc, true); } else fixIoArraySize(loc, symbol->getWritableType()); } @@ -3783,7 +3804,7 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie existingType.updateArraySizes(type); if (isIoResizeArray(type)) - checkIoArraysConsistency(loc, false, type.getQualifier().isPerPrimitive()); + checkIoArraysConsistency(loc); } // Policy and error check for needing a runtime sized array. @@ -3939,6 +3960,7 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS #ifdef NV_EXTENSIONS identifier == "gl_SampleMask" || identifier == "gl_Layer" || + identifier == "gl_PrimitiveIndicesNV" || #endif identifier == "gl_TexCoord") { @@ -4018,7 +4040,11 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS error(loc, "all redeclarations must use the same depth layout on", "redeclaration", symbol->getName().c_str()); } } - else if (identifier == "gl_FragStencilRefARB") { + else if ( +#ifdef NV_EXTENSIONS + identifier == "gl_PrimitiveIndicesNV" || +#endif + identifier == "gl_FragStencilRefARB") { if (qualifier.hasLayout()) error(loc, "cannot apply layout qualifier to", "redeclaration", symbol->getName().c_str()); if (qualifier.storage != EvqVaryingOut) @@ -4270,7 +4296,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT // Tracking for implicit sizing of array if (isIoResizeArray(block->getType())) { ioArraySymbolResizeList.push_back(block); - checkIoArraysConsistency(loc, true, block->getType().getQualifier().isPerPrimitive()); + checkIoArraysConsistency(loc, true); } else if (block->getType().isArray()) fixIoArraySize(loc, block->getWritableType()); @@ -7102,7 +7128,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con // fix up if (isIoResizeArray(blockType)) { ioArraySymbolResizeList.push_back(&variable); - checkIoArraysConsistency(loc, true, blockType.getQualifier().isPerPrimitive()); + checkIoArraysConsistency(loc, true); } else fixIoArraySize(loc, variable.getWritableType()); @@ -7685,6 +7711,14 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con else error(loc, "can only apply to 'in'", "derivative_group_linearNV", ""); } + // Check mesh out array sizes, once all the necessary out qualifiers are defined. + if ((language == EShLangMeshNV) && + (intermediate.getVertices() != TQualifier::layoutNotSet) && + (intermediate.getPrimitives() != TQualifier::layoutNotSet) && + (intermediate.getOutputPrimitive() != ElgNone)) + { + checkIoArraysConsistency(loc); + } #endif const TQualifier& qualifier = publicType.qualifier; @@ -7835,3 +7869,4 @@ TIntermNode* TParseContext::addSwitch(const TSourceLoc& loc, TIntermTyped* expre } } // end namespace glslang + diff --git a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h index 5b7d430cc..f61345dc0 100755 --- a/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h +++ b/3rdparty/glslang/glslang/MachineIndependent/ParseHelper.h @@ -299,8 +299,8 @@ public: void fixIoArraySize(const TSourceLoc&, TType&); void ioArrayCheck(const TSourceLoc&, const TType&, const TString& identifier); void handleIoResizeArrayAccess(const TSourceLoc&, TIntermTyped* base); - void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false, bool isPerPrimitive = false); - int getIoArrayImplicitSize(bool isPerPrimitive = false) const; + void checkIoArraysConsistency(const TSourceLoc&, bool tailOnly = false); + int getIoArrayImplicitSize(const TQualifier&, TString* featureString = nullptr) const; void checkIoArrayConsistency(const TSourceLoc&, int requiredSize, const char* feature, TType&, const TString&); TIntermTyped* handleBinaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right); diff --git a/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp b/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp index 708432d1e..f78ffd0a1 100755 --- a/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/Versions.cpp @@ -1025,7 +1025,7 @@ void TParseVersions::float16OpaqueCheck(const TSourceLoc& loc, const char* op, b void TParseVersions::explicitInt16Check(const TSourceLoc& loc, const char* op, bool builtIn) { if (! builtIn) { - const char* const extensions[] = { + const char* const extensions[] = { #if AMD_EXTENSIONS E_GL_AMD_gpu_shader_int16, #endif diff --git a/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp b/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp index 3441948cf..0c5d5fe83 100755 --- a/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp @@ -147,6 +147,10 @@ int TPpContext::CPPdefine(TPpToken* ppToken) } token = scanToken(ppToken); + } else if (token != '\n' && token != EndOfInput && !ppToken->space) { + parseContext.ppWarn(ppToken->loc, "missing space after macro name", "#define", ""); + + return token; } // record the definition of the macro diff --git a/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp index 8dd1036cf..40627f891 100755 --- a/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -1056,7 +1056,7 @@ int TPpContext::tokenize(TPpToken& ppToken) // Handle token-pasting logic token = tokenPaste(token, ppToken); - if (token == EndOfInput) { + if (token == EndOfInput || token == tMarkerInput::marker) { missingEndifCheck(); return EndOfInput; } diff --git a/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp b/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp index df818796d..92fa9685b 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/reflection.cpp @@ -98,46 +98,46 @@ public: } } - void addPipeInput(const TIntermSymbol& base) + void addPipeIOVariable(const TIntermSymbol& base) { if (processedDerefs.find(&base) == processedDerefs.end()) { processedDerefs.insert(&base); const TString &name = base.getName(); const TType &type = base.getType(); + const bool input = base.getQualifier().isPipeInput(); - TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name.c_str()); - if (it == reflection.nameToIndex.end()) { - reflection.nameToIndex[name.c_str()] = (int)reflection.indexToPipeInput.size(); - reflection.indexToPipeInput.push_back(TObjectReflection(name.c_str(), type, 0, mapToGlType(type), 0, 0)); + TReflection::TMapIndexToReflection &ioItems = + input ? reflection.indexToPipeInput : reflection.indexToPipeOutput; - EShLanguageMask& stages = reflection.indexToPipeInput.back().stages; - stages = static_cast(stages | 1 << intermediate.getStage()); + if (reflection.options & EShReflectionUnwrapIOBlocks) { + bool anonymous = IsAnonymous(name); + + TString baseName; + if (type.getBasicType() == EbtBlock) { + baseName = anonymous ? TString() : type.getTypeName(); + } else { + baseName = anonymous ? TString() : name; + } + + // by convention if this is an arrayed block we ignore the array in the reflection + if (type.isArray()) { + blowUpIOAggregate(input, baseName, TType(type, 0)); + } else { + blowUpIOAggregate(input, baseName, type); + } } else { - EShLanguageMask& stages = reflection.indexToPipeInput[it->second].stages; - stages = static_cast(stages | 1 << intermediate.getStage()); - } - } - } + TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name.c_str()); + if (it == reflection.nameToIndex.end()) { + reflection.nameToIndex[name.c_str()] = (int)ioItems.size(); + ioItems.push_back(TObjectReflection(name.c_str(), type, 0, mapToGlType(type), 0, 0)); - void addPipeOutput(const TIntermSymbol& base) - { - if (processedDerefs.find(&base) == processedDerefs.end()) { - processedDerefs.insert(&base); - - const TString &name = base.getName(); - const TType &type = base.getType(); - - TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name.c_str()); - if (it == reflection.nameToIndex.end()) { - reflection.nameToIndex[name.c_str()] = (int)reflection.indexToPipeOutput.size(); - reflection.indexToPipeOutput.push_back(TObjectReflection(name.c_str(), type, 0, mapToGlType(type), 0, 0)); - - EShLanguageMask& stages = reflection.indexToPipeOutput.back().stages; - stages = static_cast(stages | 1 << intermediate.getStage()); - } else { - EShLanguageMask& stages = reflection.indexToPipeOutput[it->second].stages; - stages = static_cast(stages | 1 << intermediate.getStage()); + EShLanguageMask& stages = ioItems.back().stages; + stages = static_cast(stages | 1 << intermediate.getStage()); + } else { + EShLanguageMask& stages = ioItems[it->second].stages; + stages = static_cast(stages | 1 << intermediate.getStage()); + } } } } @@ -473,6 +473,67 @@ public: } } } + + // similar to blowUpActiveAggregate, but with simpler rules and no dereferences to follow. + void blowUpIOAggregate(bool input, const TString &baseName, const TType &type) + { + TString name = baseName; + + // if the type is still too coarse a granularity, this is still an aggregate to expand, expand it... + if (! isReflectionGranularity(type)) { + if (type.isArray()) { + // Visit all the indices of this array, and for each one, + // fully explode the remaining aggregate to dereference + for (int i = 0; i < std::max(type.getOuterArraySize(), 1); ++i) { + TString newBaseName = name; + newBaseName.append(TString("[") + String(i) + "]"); + TType derefType(type, 0); + + blowUpIOAggregate(input, newBaseName, derefType); + } + } else { + // Visit all members of this aggregate, and for each one, + // fully explode the remaining aggregate to dereference + const TTypeList& typeList = *type.getStruct(); + + for (int i = 0; i < (int)typeList.size(); ++i) { + TString newBaseName = name; + if (newBaseName.size() > 0) + newBaseName.append("."); + newBaseName.append(typeList[i].type->getFieldName()); + TType derefType(type, i); + + blowUpIOAggregate(input, newBaseName, derefType); + } + } + + // it was all completed in the recursive calls above + return; + } + + if ((reflection.options & EShReflectionBasicArraySuffix) && type.isArray()) { + name.append(TString("[0]")); + } + + TReflection::TMapIndexToReflection &ioItems = + input ? reflection.indexToPipeInput : reflection.indexToPipeOutput; + + std::string namespacedName = input ? "in " : "out "; + namespacedName += name.c_str(); + + TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(namespacedName); + if (it == reflection.nameToIndex.end()) { + reflection.nameToIndex[namespacedName] = (int)ioItems.size(); + ioItems.push_back( + TObjectReflection(name.c_str(), type, 0, mapToGlType(type), mapToGlArraySize(type), 0)); + + EShLanguageMask& stages = ioItems.back().stages; + stages = static_cast(stages | 1 << intermediate.getStage()); + } else { + EShLanguageMask& stages = ioItems[it->second].stages; + stages = static_cast(stages | 1 << intermediate.getStage()); + } + } // Add a uniform dereference where blocks/struct/arrays are involved in the access. // Handles the situation where the left node is at the correct or too coarse a @@ -1027,11 +1088,9 @@ void TReflectionTraverser::visitSymbol(TIntermSymbol* base) if (base->getQualifier().storage == EvqUniform) addUniform(*base); - if (intermediate.getStage() == reflection.firstStage && base->getQualifier().isPipeInput()) - addPipeInput(*base); - - if (intermediate.getStage() == reflection.lastStage && base->getQualifier().isPipeOutput()) - addPipeOutput(*base); + if ((intermediate.getStage() == reflection.firstStage && base->getQualifier().isPipeInput()) || + (intermediate.getStage() == reflection.lastStage && base->getQualifier().isPipeOutput())) + addPipeIOVariable(*base); } // diff --git a/3rdparty/glslang/glslang/Public/ShaderLang.h b/3rdparty/glslang/glslang/Public/ShaderLang.h index b40acef01..0c2556976 100755 --- a/3rdparty/glslang/glslang/Public/ShaderLang.h +++ b/3rdparty/glslang/glslang/Public/ShaderLang.h @@ -246,6 +246,7 @@ typedef enum { EShReflectionIntermediateIO = (1 << 2), // reflect inputs and outputs to program, even with no vertex shader EShReflectionSeparateBuffers = (1 << 3), // buffer variables and buffer blocks are reflected separately EShReflectionAllBlockVariables = (1 << 4), // reflect all variables in blocks, even if they are inactive + EShReflectionUnwrapIOBlocks = (1 << 5), // unwrap input/output blocks the same as with uniform blocks } EShReflectionOptions; // diff --git a/3rdparty/glslang/gtests/AST.FromFile.cpp b/3rdparty/glslang/gtests/AST.FromFile.cpp index 875524625..2f1f01182 100644 --- a/3rdparty/glslang/gtests/AST.FromFile.cpp +++ b/3rdparty/glslang/gtests/AST.FromFile.cpp @@ -96,6 +96,7 @@ INSTANTIATE_TEST_CASE_P( "cppNest.vert", "cppBad.vert", "cppBad2.vert", + "cppBad3.vert", "cppComplexExpr.vert", "cppDeepNest.frag", "cppPassMacroName.frag", diff --git a/3rdparty/glslang/hlsl/hlslGrammar.cpp b/3rdparty/glslang/hlsl/hlslGrammar.cpp index 277d33a20..45cf5d59c 100755 --- a/3rdparty/glslang/hlsl/hlslGrammar.cpp +++ b/3rdparty/glslang/hlsl/hlslGrammar.cpp @@ -1197,7 +1197,7 @@ bool HlslGrammar::acceptSamplerTypeDX9(TType &type) TSampler sampler; sampler.set(txType.getBasicType(), dim, false, isShadow, false); - if (!parseContext.setTextureReturnType(sampler, txType, token.loc)) + if (!parseContext.setTextureReturnType(sampler, txType, token.loc)) return false; type.shallowCopy(TType(sampler, EvqUniform, arraySizes)); @@ -1489,7 +1489,7 @@ bool HlslGrammar::acceptType(TType& type, TIntermNode*& nodeList) case EHTokSampler3d: // ... case EHTokSamplerCube: // ... if (parseContext.hlslDX9Compatible()) - return acceptSamplerTypeDX9(type); + return acceptSamplerTypeDX9(type); else return acceptSamplerType(type); break; diff --git a/3rdparty/glslang/hlsl/hlslParseHelper.cpp b/3rdparty/glslang/hlsl/hlslParseHelper.cpp index 2634f9117..c31337222 100644 --- a/3rdparty/glslang/hlsl/hlslParseHelper.cpp +++ b/3rdparty/glslang/hlsl/hlslParseHelper.cpp @@ -3255,8 +3255,8 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte if (argAggregate) { if (argAggregate->getSequence().empty()) return; - if (argAggregate->getSequence()[0]) - bufferObj = argAggregate->getSequence()[0]->getAsTyped(); + if (argAggregate->getSequence()[0]) + bufferObj = argAggregate->getSequence()[0]->getAsTyped(); } else { bufferObj = arguments->getAsSymbolNode(); } @@ -3756,7 +3756,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType return; } else { if (argAggregate->getSequence().size() == 0 || - argAggregate->getSequence()[0] == nullptr || + argAggregate->getSequence()[0] == nullptr || argAggregate->getSequence()[0]->getAsTyped()->getBasicType() != EbtSampler) return; }