2
0
Branimir Karadžić 8 жил өмнө
parent
commit
d89a4e0346
46 өөрчлөгдсөн 3274 нэмэгдсэн , 901 устгасан
  1. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.array.frag.out
  2. 215 191
      3rdparty/glslang/Test/baseResults/hlsl.buffer.frag.out
  3. 194 0
      3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.vert.out
  4. 561 0
      3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.vert.out
  5. 229 0
      3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.vert.out
  6. 386 0
      3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.vert.out
  7. 435 0
      3rdparty/glslang/Test/baseResults/hlsl.clipdistance-5.vert.out
  8. 9 8
      3rdparty/glslang/Test/baseResults/hlsl.entry-in.frag.out
  9. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.getsampleposition.dx10.frag.out
  10. 257 226
      3rdparty/glslang/Test/baseResults/hlsl.inoutquals.frag.out
  11. 40 32
      3rdparty/glslang/Test/baseResults/hlsl.intrinsics.double.frag.out
  12. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.intrinsics.evalfns.frag.out
  13. 4 4
      3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.frag.out
  14. 20 16
      3rdparty/glslang/Test/baseResults/hlsl.precedence2.frag.out
  15. 12 20
      3rdparty/glslang/Test/baseResults/hlsl.reflection.vert.out
  16. 100 79
      3rdparty/glslang/Test/baseResults/hlsl.semantic.geom.out
  17. 168 110
      3rdparty/glslang/Test/baseResults/hlsl.semantic.vert.out
  18. 27 24
      3rdparty/glslang/Test/baseResults/hlsl.struct.frag.out
  19. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.struct.split.assign.frag.out
  20. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.fn.frag.out
  21. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.frag.out
  22. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.atomics.frag.out
  23. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.byte.frag.out
  24. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.coherent.frag.out
  25. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn.frag.out
  26. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.frag.out
  27. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.out
  28. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rw.frag.out
  29. 5 4
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rwbyte.frag.out
  30. 10 8
      3rdparty/glslang/Test/baseResults/hlsl.switch.frag.out
  31. 151 0
      3rdparty/glslang/Test/baseResults/hlsl.synthesizeInput.frag.out
  32. 22 17
      3rdparty/glslang/Test/hlsl.buffer.frag
  33. 8 0
      3rdparty/glslang/Test/hlsl.clipdistance-1.vert
  34. 15 0
      3rdparty/glslang/Test/hlsl.clipdistance-2.vert
  35. 13 0
      3rdparty/glslang/Test/hlsl.clipdistance-3.vert
  36. 21 0
      3rdparty/glslang/Test/hlsl.clipdistance-4.vert
  37. 21 0
      3rdparty/glslang/Test/hlsl.clipdistance-5.vert
  38. 3 2
      3rdparty/glslang/Test/hlsl.inoutquals.frag
  39. 9 36
      3rdparty/glslang/Test/hlsl.reflection.vert
  40. 9 0
      3rdparty/glslang/Test/hlsl.synthesizeInput.frag
  41. 20 3
      3rdparty/glslang/glslang/Include/Types.h
  42. 3 1
      3rdparty/glslang/glslang/MachineIndependent/reflection.cpp
  43. 6 0
      3rdparty/glslang/gtests/Hlsl.FromFile.cpp
  44. 28 22
      3rdparty/glslang/hlsl/hlslGrammar.cpp
  45. 206 45
      3rdparty/glslang/hlsl/hlslParseHelper.cpp
  46. 2 1
      3rdparty/glslang/hlsl/hlslParseHelper.h

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.array.frag.out

@@ -57,7 +57,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:8      move second child to first child ( temp int)
 0:?         'i' ( temp int)
-0:?         'i' (layout( location=0) in int)
+0:?         'i' (layout( location=0) flat in int)
 0:8      move second child to first child ( temp 3-element array of 4-component vector of float)
 0:?         'input' ( temp 3-element array of 4-component vector of float)
 0:?         'input' (layout( location=1) in 3-element array of 4-component vector of float)
@@ -69,7 +69,7 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'i' (layout( location=0) in int)
+0:?     'i' (layout( location=0) flat in int)
 0:?     'input' (layout( location=1) in 3-element array of 4-component vector of float)
 
 
@@ -134,7 +134,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:8      move second child to first child ( temp int)
 0:?         'i' ( temp int)
-0:?         'i' (layout( location=0) in int)
+0:?         'i' (layout( location=0) flat in int)
 0:8      move second child to first child ( temp 3-element array of 4-component vector of float)
 0:?         'input' ( temp 3-element array of 4-component vector of float)
 0:?         'input' (layout( location=1) in 3-element array of 4-component vector of float)
@@ -146,7 +146,7 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'i' (layout( location=0) in int)
+0:?     'i' (layout( location=0) flat in int)
 0:?     'input' (layout( location=1) in 3-element array of 4-component vector of float)
 
 // Module Version 10000
@@ -185,6 +185,7 @@ gl_FragCoord origin is upper left
                               MemberDecorate 26($Global) 1 Offset 64
                               Decorate 26($Global) Block
                               Decorate 28 DescriptorSet 0
+                              Decorate 68(i) Flat
                               Decorate 68(i) Location 0
                               Decorate 72(input) Location 1
                               Decorate 75(@entryPointOutput) Location 0

+ 215 - 191
3rdparty/glslang/Test/baseResults/hlsl.buffer.frag.out

@@ -2,49 +2,57 @@ hlsl.buffer.frag
 Shader version: 500
 gl_FragCoord origin is upper left
 0:? Sequence
-0:30  Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
+0:30  Function Definition: foo( ( temp float)
 0:30    Function Parameters: 
-0:30      'input' ( in 4-component vector of float)
 0:?     Sequence
 0:31      Branch: Return with expression
-0:31        add ( temp 4-component vector of float)
-0:31          add ( temp 4-component vector of float)
-0:31            add ( temp 4-component vector of float)
-0:31              add ( temp 4-component vector of float)
-0:31                'input' ( in 4-component vector of float)
-0:31                v1: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
-0:31                  'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
-0:31                  Constant:
-0:31                    0 (const uint)
-0:31              v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
-0:31                'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
-0:31                Constant:
-0:31                  0 (const uint)
-0:31            v3: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
-0:31              'anon@2' (layout( set=10 binding=2 row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
-0:31              Constant:
-0:31                0 (const uint)
-0:31          v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
-0:31            'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
-0:31            Constant:
-0:31              0 (const uint)
-0:30  Function Definition: PixelShaderFunction( ( temp void)
-0:30    Function Parameters: 
+0:31        Constant:
+0:31          1.000000
+0:35  Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
+0:35    Function Parameters: 
+0:35      'input' ( in 4-component vector of float)
+0:?     Sequence
+0:36      Branch: Return with expression
+0:36        vector-scale ( temp 4-component vector of float)
+0:36          add ( temp 4-component vector of float)
+0:36            add ( temp 4-component vector of float)
+0:36              add ( temp 4-component vector of float)
+0:36                add ( temp 4-component vector of float)
+0:36                  'input' ( in 4-component vector of float)
+0:36                  v1: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
+0:36                    'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
+0:36                    Constant:
+0:36                      0 (const uint)
+0:36                v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
+0:36                  'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
+0:36                  Constant:
+0:36                    0 (const uint)
+0:36              v3: direct index for structure (layout( row_major std140 offset=0) uniform 4-component vector of float)
+0:36                'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
+0:36                Constant:
+0:36                  0 (const uint)
+0:36            v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
+0:36              'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4})
+0:36              Constant:
+0:36                0 (const uint)
+0:36          Function Call: foo( ( temp float)
+0:35  Function Definition: PixelShaderFunction( ( temp void)
+0:35    Function Parameters: 
 0:?     Sequence
-0:30      move second child to first child ( temp 4-component vector of float)
+0:35      move second child to first child ( temp 4-component vector of float)
 0:?         'input' ( temp 4-component vector of float)
-0:?         'input' (layout( location=0) in 4-component vector of float)
-0:30      move second child to first child ( temp 4-component vector of float)
+0:?         'input' ( in 4-component vector of float FragCoord)
+0:35      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:30        Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
+0:35        Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
 0:?           'input' ( temp 4-component vector of float)
 0:?   Linker Objects
 0:?     'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
 0:?     'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
-0:?     'anon@2' (layout( set=10 binding=2 row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
-0:?     'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
+0:?     'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
+0:?     'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'input' (layout( location=0) in 4-component vector of float)
+0:?     'input' ( in 4-component vector of float FragCoord)
 
 
 Linked fragment stage:
@@ -53,193 +61,209 @@ Linked fragment stage:
 Shader version: 500
 gl_FragCoord origin is upper left
 0:? Sequence
-0:30  Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
+0:30  Function Definition: foo( ( temp float)
 0:30    Function Parameters: 
-0:30      'input' ( in 4-component vector of float)
 0:?     Sequence
 0:31      Branch: Return with expression
-0:31        add ( temp 4-component vector of float)
-0:31          add ( temp 4-component vector of float)
-0:31            add ( temp 4-component vector of float)
-0:31              add ( temp 4-component vector of float)
-0:31                'input' ( in 4-component vector of float)
-0:31                v1: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
-0:31                  'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
-0:31                  Constant:
-0:31                    0 (const uint)
-0:31              v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
-0:31                'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
-0:31                Constant:
-0:31                  0 (const uint)
-0:31            v3: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
-0:31              'anon@2' (layout( set=10 binding=2 row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
-0:31              Constant:
-0:31                0 (const uint)
-0:31          v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
-0:31            'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
-0:31            Constant:
-0:31              0 (const uint)
-0:30  Function Definition: PixelShaderFunction( ( temp void)
-0:30    Function Parameters: 
+0:31        Constant:
+0:31          1.000000
+0:35  Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
+0:35    Function Parameters: 
+0:35      'input' ( in 4-component vector of float)
 0:?     Sequence
-0:30      move second child to first child ( temp 4-component vector of float)
+0:36      Branch: Return with expression
+0:36        vector-scale ( temp 4-component vector of float)
+0:36          add ( temp 4-component vector of float)
+0:36            add ( temp 4-component vector of float)
+0:36              add ( temp 4-component vector of float)
+0:36                add ( temp 4-component vector of float)
+0:36                  'input' ( in 4-component vector of float)
+0:36                  v1: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
+0:36                    'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
+0:36                    Constant:
+0:36                      0 (const uint)
+0:36                v2: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
+0:36                  'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
+0:36                  Constant:
+0:36                    0 (const uint)
+0:36              v3: direct index for structure (layout( row_major std140 offset=0) uniform 4-component vector of float)
+0:36                'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
+0:36                Constant:
+0:36                  0 (const uint)
+0:36            v4: direct index for structure (layout( row_major std430 offset=16) buffer 4-component vector of float)
+0:36              'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4})
+0:36              Constant:
+0:36                0 (const uint)
+0:36          Function Call: foo( ( temp float)
+0:35  Function Definition: PixelShaderFunction( ( temp void)
+0:35    Function Parameters: 
+0:?     Sequence
+0:35      move second child to first child ( temp 4-component vector of float)
 0:?         'input' ( temp 4-component vector of float)
-0:?         'input' (layout( location=0) in 4-component vector of float)
-0:30      move second child to first child ( temp 4-component vector of float)
+0:?         'input' ( in 4-component vector of float FragCoord)
+0:35      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:30        Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
+0:35        Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float)
 0:?           'input' ( temp 4-component vector of float)
 0:?   Linker Objects
 0:?     'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v1})
 0:?     'anon@1' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float v2})
-0:?     'anon@2' (layout( set=10 binding=2 row_major std140) uniform block{layout( row_major std140) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
-0:?     'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430) buffer float f7, layout( row_major std430) buffer 3X4 matrix of float m1, layout( column_major std430) buffer 3X4 matrix of float m2, layout( row_major std430) buffer 3X4 matrix of float m3, layout( row_major std430) buffer 3X4 matrix of float m4})
+0:?     'anon@2' (layout( row_major std140) uniform block{layout( row_major std140 offset=0) uniform 4-component vector of float v3, layout( row_major std140 offset=20) uniform int i3})
+0:?     'anon@3' (layout( binding=8 row_major std430) readonly buffer block{layout( row_major std430 offset=16) buffer 4-component vector of float v4, layout( row_major std430 offset=48) buffer int i4, layout( row_major std430 offset=60) buffer float f1, layout( row_major std430 offset=64) buffer float f3, layout( row_major std430 offset=68) buffer float f4, layout( row_major std430 offset=72) buffer float f5, layout( row_major std430) buffer float f6, layout( row_major std430 offset=128) buffer float f7, layout( row_major std430 offset=112) buffer 3X4 matrix of float m1, layout( column_major std430 offset=176) buffer 3X4 matrix of float m2, layout( row_major std430 offset=240) buffer 3X4 matrix of float m3, layout( row_major std430 offset=304) buffer 3X4 matrix of float m4})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'input' (layout( location=0) in 4-component vector of float)
+0:?     'input' ( in 4-component vector of float FragCoord)
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 53
+// Id's are bound by 61
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "PixelShaderFunction" 46 49
+                              EntryPoint Fragment 4  "PixelShaderFunction" 54 57
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "PixelShaderFunction"
-                              Name 11  "@PixelShaderFunction(vf4;"
-                              Name 10  "input"
-                              Name 14  ""
-                              MemberName 14 0  "v1"
-                              Name 16  ""
-                              Name 23  ""
-                              MemberName 23 0  "v2"
-                              Name 25  ""
-                              Name 29  "cbufName"
-                              MemberName 29(cbufName) 0  "v3"
-                              MemberName 29(cbufName) 1  "i3"
+                              Name 8  "foo("
+                              Name 14  "@PixelShaderFunction(vf4;"
+                              Name 13  "input"
+                              Name 20  "buf1"
+                              MemberName 20(buf1) 0  "v1"
+                              Name 22  ""
+                              Name 29  "buf2"
+                              MemberName 29(buf2) 0  "v2"
                               Name 31  ""
-                              Name 36  "tbufName"
-                              MemberName 36(tbufName) 0  "v4"
-                              MemberName 36(tbufName) 1  "i4"
-                              MemberName 36(tbufName) 2  "f1"
-                              MemberName 36(tbufName) 3  "f3"
-                              MemberName 36(tbufName) 4  "f4"
-                              MemberName 36(tbufName) 5  "f5"
-                              MemberName 36(tbufName) 6  "f6"
-                              MemberName 36(tbufName) 7  "f7"
-                              MemberName 36(tbufName) 8  "m1"
-                              MemberName 36(tbufName) 9  "m2"
-                              MemberName 36(tbufName) 10  "m3"
-                              MemberName 36(tbufName) 11  "m4"
-                              Name 38  ""
-                              Name 44  "input"
-                              Name 46  "input"
-                              Name 49  "@entryPointOutput"
-                              Name 50  "param"
-                              MemberDecorate 14 0 Offset 0
-                              Decorate 14 Block
-                              Decorate 16 DescriptorSet 0
-                              MemberDecorate 23 0 NonWritable
-                              MemberDecorate 23 0 Offset 0
-                              Decorate 23 BufferBlock
-                              Decorate 25 DescriptorSet 0
-                              MemberDecorate 29(cbufName) 0 Offset 0
-                              MemberDecorate 29(cbufName) 1 Offset 20
-                              Decorate 29(cbufName) Block
-                              Decorate 31 DescriptorSet 10
-                              Decorate 31 Binding 2
-                              MemberDecorate 36(tbufName) 0 NonWritable
-                              MemberDecorate 36(tbufName) 0 Offset 16
-                              MemberDecorate 36(tbufName) 1 NonWritable
-                              MemberDecorate 36(tbufName) 1 Offset 48
-                              MemberDecorate 36(tbufName) 2 NonWritable
-                              MemberDecorate 36(tbufName) 2 Offset 60
-                              MemberDecorate 36(tbufName) 3 NonWritable
-                              MemberDecorate 36(tbufName) 3 Offset 64
-                              MemberDecorate 36(tbufName) 4 NonWritable
-                              MemberDecorate 36(tbufName) 4 Offset 68
-                              MemberDecorate 36(tbufName) 5 NonWritable
-                              MemberDecorate 36(tbufName) 5 Offset 72
-                              MemberDecorate 36(tbufName) 6 NonWritable
-                              MemberDecorate 36(tbufName) 6 Offset 76
-                              MemberDecorate 36(tbufName) 7 NonWritable
-                              MemberDecorate 36(tbufName) 7 Offset 80
-                              MemberDecorate 36(tbufName) 8 RowMajor
-                              MemberDecorate 36(tbufName) 8 NonWritable
-                              MemberDecorate 36(tbufName) 8 Offset 96
-                              MemberDecorate 36(tbufName) 8 MatrixStride 16
-                              MemberDecorate 36(tbufName) 9 ColMajor
-                              MemberDecorate 36(tbufName) 9 NonWritable
-                              MemberDecorate 36(tbufName) 9 Offset 160
-                              MemberDecorate 36(tbufName) 9 MatrixStride 16
-                              MemberDecorate 36(tbufName) 10 RowMajor
-                              MemberDecorate 36(tbufName) 10 NonWritable
-                              MemberDecorate 36(tbufName) 10 Offset 208
-                              MemberDecorate 36(tbufName) 10 MatrixStride 16
-                              MemberDecorate 36(tbufName) 11 RowMajor
-                              MemberDecorate 36(tbufName) 11 NonWritable
-                              MemberDecorate 36(tbufName) 11 Offset 272
-                              MemberDecorate 36(tbufName) 11 MatrixStride 16
-                              Decorate 36(tbufName) BufferBlock
-                              Decorate 38 DescriptorSet 0
-                              Decorate 38 Binding 8
-                              Decorate 46(input) Location 0
-                              Decorate 49(@entryPointOutput) Location 0
+                              Name 35  "cbufName"
+                              MemberName 35(cbufName) 0  "v3"
+                              MemberName 35(cbufName) 1  "i3"
+                              Name 37  ""
+                              Name 42  "tbufName"
+                              MemberName 42(tbufName) 0  "v4"
+                              MemberName 42(tbufName) 1  "i4"
+                              MemberName 42(tbufName) 2  "f1"
+                              MemberName 42(tbufName) 3  "f3"
+                              MemberName 42(tbufName) 4  "f4"
+                              MemberName 42(tbufName) 5  "f5"
+                              MemberName 42(tbufName) 6  "f6"
+                              MemberName 42(tbufName) 7  "f7"
+                              MemberName 42(tbufName) 8  "m1"
+                              MemberName 42(tbufName) 9  "m2"
+                              MemberName 42(tbufName) 10  "m3"
+                              MemberName 42(tbufName) 11  "m4"
+                              Name 44  ""
+                              Name 52  "input"
+                              Name 54  "input"
+                              Name 57  "@entryPointOutput"
+                              Name 58  "param"
+                              MemberDecorate 20(buf1) 0 Offset 0
+                              Decorate 20(buf1) Block
+                              Decorate 22 DescriptorSet 0
+                              MemberDecorate 29(buf2) 0 NonWritable
+                              MemberDecorate 29(buf2) 0 Offset 0
+                              Decorate 29(buf2) BufferBlock
+                              Decorate 31 DescriptorSet 0
+                              MemberDecorate 35(cbufName) 0 Offset 0
+                              MemberDecorate 35(cbufName) 1 Offset 20
+                              Decorate 35(cbufName) Block
+                              Decorate 37 DescriptorSet 0
+                              MemberDecorate 42(tbufName) 0 NonWritable
+                              MemberDecorate 42(tbufName) 0 Offset 16
+                              MemberDecorate 42(tbufName) 1 NonWritable
+                              MemberDecorate 42(tbufName) 1 Offset 48
+                              MemberDecorate 42(tbufName) 2 NonWritable
+                              MemberDecorate 42(tbufName) 2 Offset 60
+                              MemberDecorate 42(tbufName) 3 NonWritable
+                              MemberDecorate 42(tbufName) 3 Offset 64
+                              MemberDecorate 42(tbufName) 4 NonWritable
+                              MemberDecorate 42(tbufName) 4 Offset 68
+                              MemberDecorate 42(tbufName) 5 NonWritable
+                              MemberDecorate 42(tbufName) 5 Offset 72
+                              MemberDecorate 42(tbufName) 6 NonWritable
+                              MemberDecorate 42(tbufName) 6 Offset 76
+                              MemberDecorate 42(tbufName) 7 NonWritable
+                              MemberDecorate 42(tbufName) 7 Offset 128
+                              MemberDecorate 42(tbufName) 8 RowMajor
+                              MemberDecorate 42(tbufName) 8 NonWritable
+                              MemberDecorate 42(tbufName) 8 Offset 112
+                              MemberDecorate 42(tbufName) 8 MatrixStride 16
+                              MemberDecorate 42(tbufName) 9 ColMajor
+                              MemberDecorate 42(tbufName) 9 NonWritable
+                              MemberDecorate 42(tbufName) 9 Offset 176
+                              MemberDecorate 42(tbufName) 9 MatrixStride 16
+                              MemberDecorate 42(tbufName) 10 RowMajor
+                              MemberDecorate 42(tbufName) 10 NonWritable
+                              MemberDecorate 42(tbufName) 10 Offset 240
+                              MemberDecorate 42(tbufName) 10 MatrixStride 16
+                              MemberDecorate 42(tbufName) 11 RowMajor
+                              MemberDecorate 42(tbufName) 11 NonWritable
+                              MemberDecorate 42(tbufName) 11 Offset 304
+                              MemberDecorate 42(tbufName) 11 MatrixStride 16
+                              Decorate 42(tbufName) BufferBlock
+                              Decorate 44 DescriptorSet 0
+                              Decorate 44 Binding 8
+                              Decorate 54(input) BuiltIn FragCoord
+                              Decorate 57(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
-               7:             TypeVector 6(float) 4
-               8:             TypePointer Function 7(fvec4)
-               9:             TypeFunction 7(fvec4) 8(ptr)
-              14:             TypeStruct 7(fvec4)
-              15:             TypePointer Uniform 14(struct)
-              16:     15(ptr) Variable Uniform
-              17:             TypeInt 32 1
-              18:     17(int) Constant 0
-              19:             TypePointer Uniform 7(fvec4)
-              23:             TypeStruct 7(fvec4)
-              24:             TypePointer Uniform 23(struct)
-              25:     24(ptr) Variable Uniform
-    29(cbufName):             TypeStruct 7(fvec4) 17(int)
-              30:             TypePointer Uniform 29(cbufName)
+               7:             TypeFunction 6(float)
+              10:             TypeVector 6(float) 4
+              11:             TypePointer Function 10(fvec4)
+              12:             TypeFunction 10(fvec4) 11(ptr)
+              16:    6(float) Constant 1065353216
+        20(buf1):             TypeStruct 10(fvec4)
+              21:             TypePointer Uniform 20(buf1)
+              22:     21(ptr) Variable Uniform
+              23:             TypeInt 32 1
+              24:     23(int) Constant 0
+              25:             TypePointer Uniform 10(fvec4)
+        29(buf2):             TypeStruct 10(fvec4)
+              30:             TypePointer Uniform 29(buf2)
               31:     30(ptr) Variable Uniform
-              35:             TypeMatrix 7(fvec4) 3
-    36(tbufName):             TypeStruct 7(fvec4) 17(int) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 35 35 35 35
-              37:             TypePointer Uniform 36(tbufName)
-              38:     37(ptr) Variable Uniform
-              45:             TypePointer Input 7(fvec4)
-       46(input):     45(ptr) Variable Input
-              48:             TypePointer Output 7(fvec4)
-49(@entryPointOutput):     48(ptr) Variable Output
+    35(cbufName):             TypeStruct 10(fvec4) 23(int)
+              36:             TypePointer Uniform 35(cbufName)
+              37:     36(ptr) Variable Uniform
+              41:             TypeMatrix 10(fvec4) 3
+    42(tbufName):             TypeStruct 10(fvec4) 23(int) 6(float) 6(float) 6(float) 6(float) 6(float) 6(float) 41 41 41 41
+              43:             TypePointer Uniform 42(tbufName)
+              44:     43(ptr) Variable Uniform
+              53:             TypePointer Input 10(fvec4)
+       54(input):     53(ptr) Variable Input
+              56:             TypePointer Output 10(fvec4)
+57(@entryPointOutput):     56(ptr) Variable Output
 4(PixelShaderFunction):           2 Function None 3
                5:             Label
-       44(input):      8(ptr) Variable Function
-       50(param):      8(ptr) Variable Function
-              47:    7(fvec4) Load 46(input)
-                              Store 44(input) 47
-              51:    7(fvec4) Load 44(input)
-                              Store 50(param) 51
-              52:    7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 50(param)
-                              Store 49(@entryPointOutput) 52
+       52(input):     11(ptr) Variable Function
+       58(param):     11(ptr) Variable Function
+              55:   10(fvec4) Load 54(input)
+                              Store 52(input) 55
+              59:   10(fvec4) Load 52(input)
+                              Store 58(param) 59
+              60:   10(fvec4) FunctionCall 14(@PixelShaderFunction(vf4;) 58(param)
+                              Store 57(@entryPointOutput) 60
                               Return
                               FunctionEnd
-11(@PixelShaderFunction(vf4;):    7(fvec4) Function None 9
-       10(input):      8(ptr) FunctionParameter
-              12:             Label
-              13:    7(fvec4) Load 10(input)
-              20:     19(ptr) AccessChain 16 18
-              21:    7(fvec4) Load 20
-              22:    7(fvec4) FAdd 13 21
-              26:     19(ptr) AccessChain 25 18
-              27:    7(fvec4) Load 26
-              28:    7(fvec4) FAdd 22 27
-              32:     19(ptr) AccessChain 31 18
-              33:    7(fvec4) Load 32
-              34:    7(fvec4) FAdd 28 33
-              39:     19(ptr) AccessChain 38 18
-              40:    7(fvec4) Load 39
-              41:    7(fvec4) FAdd 34 40
-                              ReturnValue 41
+         8(foo():    6(float) Function None 7
+               9:             Label
+                              ReturnValue 16
+                              FunctionEnd
+14(@PixelShaderFunction(vf4;):   10(fvec4) Function None 12
+       13(input):     11(ptr) FunctionParameter
+              15:             Label
+              19:   10(fvec4) Load 13(input)
+              26:     25(ptr) AccessChain 22 24
+              27:   10(fvec4) Load 26
+              28:   10(fvec4) FAdd 19 27
+              32:     25(ptr) AccessChain 31 24
+              33:   10(fvec4) Load 32
+              34:   10(fvec4) FAdd 28 33
+              38:     25(ptr) AccessChain 37 24
+              39:   10(fvec4) Load 38
+              40:   10(fvec4) FAdd 34 39
+              45:     25(ptr) AccessChain 44 24
+              46:   10(fvec4) Load 45
+              47:   10(fvec4) FAdd 40 46
+              48:    6(float) FunctionCall 8(foo()
+              49:   10(fvec4) VectorTimesScalar 47 48
+                              ReturnValue 49
                               FunctionEnd

+ 194 - 0
3rdparty/glslang/Test/baseResults/hlsl.clipdistance-1.vert.out

@@ -0,0 +1,194 @@
+hlsl.clipdistance-1.vert
+Shader version: 500
+0:? Sequence
+0:4  Function Definition: @main(vf4;f1;f1; ( temp void)
+0:4    Function Parameters: 
+0:4      'pos' ( out 4-component vector of float)
+0:4      'clip' ( out float)
+0:4      'cull' ( out float)
+0:?     Sequence
+0:5      move second child to first child ( temp 4-component vector of float)
+0:5        'pos' ( out 4-component vector of float)
+0:5        Constant:
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:6      move second child to first child ( temp float)
+0:6        'clip' ( out float)
+0:6        Constant:
+0:6          0.500000
+0:7      move second child to first child ( temp float)
+0:7        'cull' ( out float)
+0:7        Constant:
+0:7          0.510000
+0:4  Function Definition: main( ( temp void)
+0:4    Function Parameters: 
+0:?     Sequence
+0:4      Function Call: @main(vf4;f1;f1; ( temp void)
+0:?         'pos' ( temp 4-component vector of float)
+0:?         'clip' ( temp float)
+0:?         'cull' ( temp float)
+0:4      move second child to first child ( temp 4-component vector of float)
+0:?         'pos' ( out 4-component vector of float Position)
+0:?         'pos' ( temp 4-component vector of float)
+0:?       Sequence
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'clip' ( out 1-element array of float ClipDistance)
+0:4            Constant:
+0:4              0 (const int)
+0:?           'clip' ( temp float)
+0:?       Sequence
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'cull' ( out 1-element array of float CullDistance)
+0:4            Constant:
+0:4              0 (const int)
+0:?           'cull' ( temp float)
+0:?   Linker Objects
+0:?     'pos' ( out 4-component vector of float Position)
+0:?     'clip' ( out 1-element array of float ClipDistance)
+0:?     'cull' ( out 1-element array of float CullDistance)
+
+
+Linked vertex stage:
+
+
+Shader version: 500
+0:? Sequence
+0:4  Function Definition: @main(vf4;f1;f1; ( temp void)
+0:4    Function Parameters: 
+0:4      'pos' ( out 4-component vector of float)
+0:4      'clip' ( out float)
+0:4      'cull' ( out float)
+0:?     Sequence
+0:5      move second child to first child ( temp 4-component vector of float)
+0:5        'pos' ( out 4-component vector of float)
+0:5        Constant:
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:6      move second child to first child ( temp float)
+0:6        'clip' ( out float)
+0:6        Constant:
+0:6          0.500000
+0:7      move second child to first child ( temp float)
+0:7        'cull' ( out float)
+0:7        Constant:
+0:7          0.510000
+0:4  Function Definition: main( ( temp void)
+0:4    Function Parameters: 
+0:?     Sequence
+0:4      Function Call: @main(vf4;f1;f1; ( temp void)
+0:?         'pos' ( temp 4-component vector of float)
+0:?         'clip' ( temp float)
+0:?         'cull' ( temp float)
+0:4      move second child to first child ( temp 4-component vector of float)
+0:?         'pos' ( out 4-component vector of float Position)
+0:?         'pos' ( temp 4-component vector of float)
+0:?       Sequence
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'clip' ( out 1-element array of float ClipDistance)
+0:4            Constant:
+0:4              0 (const int)
+0:?           'clip' ( temp float)
+0:?       Sequence
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'cull' ( out 1-element array of float CullDistance)
+0:4            Constant:
+0:4              0 (const int)
+0:?           'cull' ( temp float)
+0:?   Linker Objects
+0:?     'pos' ( out 4-component vector of float Position)
+0:?     'clip' ( out 1-element array of float ClipDistance)
+0:?     'cull' ( out 1-element array of float CullDistance)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 46
+
+                              Capability Shader
+                              Capability ClipDistance
+                              Capability CullDistance
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 31 37 43
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 14  "@main(vf4;f1;f1;"
+                              Name 11  "pos"
+                              Name 12  "clip"
+                              Name 13  "cull"
+                              Name 20  "pos"
+                              Name 21  "clip"
+                              Name 22  "cull"
+                              Name 23  "param"
+                              Name 24  "param"
+                              Name 25  "param"
+                              Name 31  "pos"
+                              Name 37  "clip"
+                              Name 43  "cull"
+                              Decorate 31(pos) BuiltIn Position
+                              Decorate 37(clip) BuiltIn ClipDistance
+                              Decorate 43(cull) BuiltIn CullDistance
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypePointer Function 7(fvec4)
+               9:             TypePointer Function 6(float)
+              10:             TypeFunction 2 8(ptr) 9(ptr) 9(ptr)
+              16:    6(float) Constant 1065353216
+              17:    7(fvec4) ConstantComposite 16 16 16 16
+              18:    6(float) Constant 1056964608
+              19:    6(float) Constant 1057132380
+              30:             TypePointer Output 7(fvec4)
+         31(pos):     30(ptr) Variable Output
+              33:             TypeInt 32 0
+              34:     33(int) Constant 1
+              35:             TypeArray 6(float) 34
+              36:             TypePointer Output 35
+        37(clip):     36(ptr) Variable Output
+              38:             TypeInt 32 1
+              39:     38(int) Constant 0
+              41:             TypePointer Output 6(float)
+        43(cull):     36(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+         20(pos):      8(ptr) Variable Function
+        21(clip):      9(ptr) Variable Function
+        22(cull):      9(ptr) Variable Function
+       23(param):      8(ptr) Variable Function
+       24(param):      9(ptr) Variable Function
+       25(param):      9(ptr) Variable Function
+              26:           2 FunctionCall 14(@main(vf4;f1;f1;) 23(param) 24(param) 25(param)
+              27:    7(fvec4) Load 23(param)
+                              Store 20(pos) 27
+              28:    6(float) Load 24(param)
+                              Store 21(clip) 28
+              29:    6(float) Load 25(param)
+                              Store 22(cull) 29
+              32:    7(fvec4) Load 20(pos)
+                              Store 31(pos) 32
+              40:    6(float) Load 21(clip)
+              42:     41(ptr) AccessChain 37(clip) 39
+                              Store 42 40
+              44:    6(float) Load 22(cull)
+              45:     41(ptr) AccessChain 43(cull) 39
+                              Store 45 44
+                              Return
+                              FunctionEnd
+14(@main(vf4;f1;f1;):           2 Function None 10
+         11(pos):      8(ptr) FunctionParameter
+        12(clip):      9(ptr) FunctionParameter
+        13(cull):      9(ptr) FunctionParameter
+              15:             Label
+                              Store 11(pos) 17
+                              Store 12(clip) 18
+                              Store 13(cull) 19
+                              Return
+                              FunctionEnd

+ 561 - 0
3rdparty/glslang/Test/baseResults/hlsl.clipdistance-2.vert.out

@@ -0,0 +1,561 @@
+hlsl.clipdistance-2.vert
+Shader version: 500
+0:? Sequence
+0:4  Function Definition: @main(vf4;vf2[2];vf2[2]; ( temp void)
+0:4    Function Parameters: 
+0:4      'pos' ( out 4-component vector of float)
+0:4      'clip' ( out 2-element array of 2-component vector of float)
+0:4      'cull' ( out 2-element array of 2-component vector of float)
+0:?     Sequence
+0:5      move second child to first child ( temp 4-component vector of float)
+0:5        'pos' ( out 4-component vector of float)
+0:5        Constant:
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:6      move second child to first child ( temp float)
+0:6        direct index ( temp float)
+0:6          direct index ( temp 2-component vector of float)
+0:6            'clip' ( out 2-element array of 2-component vector of float)
+0:6            Constant:
+0:6              0 (const int)
+0:6          Constant:
+0:6            0 (const int)
+0:6        Constant:
+0:6          0.500000
+0:7      move second child to first child ( temp float)
+0:7        direct index ( temp float)
+0:7          direct index ( temp 2-component vector of float)
+0:7            'clip' ( out 2-element array of 2-component vector of float)
+0:7            Constant:
+0:7              0 (const int)
+0:7          Constant:
+0:7            1 (const int)
+0:7        Constant:
+0:7          0.600000
+0:8      move second child to first child ( temp float)
+0:8        direct index ( temp float)
+0:8          direct index ( temp 2-component vector of float)
+0:8            'clip' ( out 2-element array of 2-component vector of float)
+0:8            Constant:
+0:8              1 (const int)
+0:8          Constant:
+0:8            0 (const int)
+0:8        Constant:
+0:8          0.700000
+0:9      move second child to first child ( temp float)
+0:9        direct index ( temp float)
+0:9          direct index ( temp 2-component vector of float)
+0:9            'clip' ( out 2-element array of 2-component vector of float)
+0:9            Constant:
+0:9              1 (const int)
+0:9          Constant:
+0:9            1 (const int)
+0:9        Constant:
+0:9          0.800000
+0:11      move second child to first child ( temp float)
+0:11        direct index ( temp float)
+0:11          direct index ( temp 2-component vector of float)
+0:11            'cull' ( out 2-element array of 2-component vector of float)
+0:11            Constant:
+0:11              0 (const int)
+0:11          Constant:
+0:11            0 (const int)
+0:11        Constant:
+0:11          0.525000
+0:12      move second child to first child ( temp float)
+0:12        direct index ( temp float)
+0:12          direct index ( temp 2-component vector of float)
+0:12            'cull' ( out 2-element array of 2-component vector of float)
+0:12            Constant:
+0:12              0 (const int)
+0:12          Constant:
+0:12            1 (const int)
+0:12        Constant:
+0:12          0.625000
+0:13      move second child to first child ( temp float)
+0:13        direct index ( temp float)
+0:13          direct index ( temp 2-component vector of float)
+0:13            'cull' ( out 2-element array of 2-component vector of float)
+0:13            Constant:
+0:13              1 (const int)
+0:13          Constant:
+0:13            0 (const int)
+0:13        Constant:
+0:13          0.725000
+0:14      move second child to first child ( temp float)
+0:14        direct index ( temp float)
+0:14          direct index ( temp 2-component vector of float)
+0:14            'cull' ( out 2-element array of 2-component vector of float)
+0:14            Constant:
+0:14              1 (const int)
+0:14          Constant:
+0:14            1 (const int)
+0:14        Constant:
+0:14          0.825000
+0:4  Function Definition: main( ( temp void)
+0:4    Function Parameters: 
+0:?     Sequence
+0:4      Function Call: @main(vf4;vf2[2];vf2[2]; ( temp void)
+0:?         'pos' ( temp 4-component vector of float)
+0:?         'clip' ( temp 2-element array of 2-component vector of float)
+0:?         'cull' ( temp 2-element array of 2-component vector of float)
+0:4      move second child to first child ( temp 4-component vector of float)
+0:?         'pos' ( out 4-component vector of float Position)
+0:?         'pos' ( temp 4-component vector of float)
+0:?       Sequence
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'clip' ( out 4-element array of float ClipDistance)
+0:4            Constant:
+0:4              0 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'clip' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                0 (const int)
+0:4            Constant:
+0:4              0 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'clip' ( out 4-element array of float ClipDistance)
+0:4            Constant:
+0:4              1 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'clip' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                0 (const int)
+0:4            Constant:
+0:4              1 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'clip' ( out 4-element array of float ClipDistance)
+0:4            Constant:
+0:4              2 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'clip' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                1 (const int)
+0:4            Constant:
+0:4              0 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'clip' ( out 4-element array of float ClipDistance)
+0:4            Constant:
+0:4              3 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'clip' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                1 (const int)
+0:4            Constant:
+0:4              1 (const int)
+0:?       Sequence
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'cull' ( out 4-element array of float CullDistance)
+0:4            Constant:
+0:4              0 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'cull' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                0 (const int)
+0:4            Constant:
+0:4              0 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'cull' ( out 4-element array of float CullDistance)
+0:4            Constant:
+0:4              1 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'cull' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                0 (const int)
+0:4            Constant:
+0:4              1 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'cull' ( out 4-element array of float CullDistance)
+0:4            Constant:
+0:4              2 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'cull' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                1 (const int)
+0:4            Constant:
+0:4              0 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'cull' ( out 4-element array of float CullDistance)
+0:4            Constant:
+0:4              3 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'cull' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                1 (const int)
+0:4            Constant:
+0:4              1 (const int)
+0:?   Linker Objects
+0:?     'pos' ( out 4-component vector of float Position)
+0:?     'clip' ( out 4-element array of float ClipDistance)
+0:?     'cull' ( out 4-element array of float CullDistance)
+
+
+Linked vertex stage:
+
+
+Shader version: 500
+0:? Sequence
+0:4  Function Definition: @main(vf4;vf2[2];vf2[2]; ( temp void)
+0:4    Function Parameters: 
+0:4      'pos' ( out 4-component vector of float)
+0:4      'clip' ( out 2-element array of 2-component vector of float)
+0:4      'cull' ( out 2-element array of 2-component vector of float)
+0:?     Sequence
+0:5      move second child to first child ( temp 4-component vector of float)
+0:5        'pos' ( out 4-component vector of float)
+0:5        Constant:
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:6      move second child to first child ( temp float)
+0:6        direct index ( temp float)
+0:6          direct index ( temp 2-component vector of float)
+0:6            'clip' ( out 2-element array of 2-component vector of float)
+0:6            Constant:
+0:6              0 (const int)
+0:6          Constant:
+0:6            0 (const int)
+0:6        Constant:
+0:6          0.500000
+0:7      move second child to first child ( temp float)
+0:7        direct index ( temp float)
+0:7          direct index ( temp 2-component vector of float)
+0:7            'clip' ( out 2-element array of 2-component vector of float)
+0:7            Constant:
+0:7              0 (const int)
+0:7          Constant:
+0:7            1 (const int)
+0:7        Constant:
+0:7          0.600000
+0:8      move second child to first child ( temp float)
+0:8        direct index ( temp float)
+0:8          direct index ( temp 2-component vector of float)
+0:8            'clip' ( out 2-element array of 2-component vector of float)
+0:8            Constant:
+0:8              1 (const int)
+0:8          Constant:
+0:8            0 (const int)
+0:8        Constant:
+0:8          0.700000
+0:9      move second child to first child ( temp float)
+0:9        direct index ( temp float)
+0:9          direct index ( temp 2-component vector of float)
+0:9            'clip' ( out 2-element array of 2-component vector of float)
+0:9            Constant:
+0:9              1 (const int)
+0:9          Constant:
+0:9            1 (const int)
+0:9        Constant:
+0:9          0.800000
+0:11      move second child to first child ( temp float)
+0:11        direct index ( temp float)
+0:11          direct index ( temp 2-component vector of float)
+0:11            'cull' ( out 2-element array of 2-component vector of float)
+0:11            Constant:
+0:11              0 (const int)
+0:11          Constant:
+0:11            0 (const int)
+0:11        Constant:
+0:11          0.525000
+0:12      move second child to first child ( temp float)
+0:12        direct index ( temp float)
+0:12          direct index ( temp 2-component vector of float)
+0:12            'cull' ( out 2-element array of 2-component vector of float)
+0:12            Constant:
+0:12              0 (const int)
+0:12          Constant:
+0:12            1 (const int)
+0:12        Constant:
+0:12          0.625000
+0:13      move second child to first child ( temp float)
+0:13        direct index ( temp float)
+0:13          direct index ( temp 2-component vector of float)
+0:13            'cull' ( out 2-element array of 2-component vector of float)
+0:13            Constant:
+0:13              1 (const int)
+0:13          Constant:
+0:13            0 (const int)
+0:13        Constant:
+0:13          0.725000
+0:14      move second child to first child ( temp float)
+0:14        direct index ( temp float)
+0:14          direct index ( temp 2-component vector of float)
+0:14            'cull' ( out 2-element array of 2-component vector of float)
+0:14            Constant:
+0:14              1 (const int)
+0:14          Constant:
+0:14            1 (const int)
+0:14        Constant:
+0:14          0.825000
+0:4  Function Definition: main( ( temp void)
+0:4    Function Parameters: 
+0:?     Sequence
+0:4      Function Call: @main(vf4;vf2[2];vf2[2]; ( temp void)
+0:?         'pos' ( temp 4-component vector of float)
+0:?         'clip' ( temp 2-element array of 2-component vector of float)
+0:?         'cull' ( temp 2-element array of 2-component vector of float)
+0:4      move second child to first child ( temp 4-component vector of float)
+0:?         'pos' ( out 4-component vector of float Position)
+0:?         'pos' ( temp 4-component vector of float)
+0:?       Sequence
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'clip' ( out 4-element array of float ClipDistance)
+0:4            Constant:
+0:4              0 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'clip' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                0 (const int)
+0:4            Constant:
+0:4              0 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'clip' ( out 4-element array of float ClipDistance)
+0:4            Constant:
+0:4              1 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'clip' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                0 (const int)
+0:4            Constant:
+0:4              1 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'clip' ( out 4-element array of float ClipDistance)
+0:4            Constant:
+0:4              2 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'clip' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                1 (const int)
+0:4            Constant:
+0:4              0 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'clip' ( out 4-element array of float ClipDistance)
+0:4            Constant:
+0:4              3 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'clip' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                1 (const int)
+0:4            Constant:
+0:4              1 (const int)
+0:?       Sequence
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'cull' ( out 4-element array of float CullDistance)
+0:4            Constant:
+0:4              0 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'cull' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                0 (const int)
+0:4            Constant:
+0:4              0 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'cull' ( out 4-element array of float CullDistance)
+0:4            Constant:
+0:4              1 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'cull' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                0 (const int)
+0:4            Constant:
+0:4              1 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'cull' ( out 4-element array of float CullDistance)
+0:4            Constant:
+0:4              2 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'cull' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                1 (const int)
+0:4            Constant:
+0:4              0 (const int)
+0:4        move second child to first child ( temp float)
+0:4          direct index ( temp float)
+0:?             'cull' ( out 4-element array of float CullDistance)
+0:4            Constant:
+0:4              3 (const int)
+0:4          direct index ( temp float)
+0:4            direct index ( temp 2-component vector of float)
+0:?               'cull' ( temp 2-element array of 2-component vector of float)
+0:4              Constant:
+0:4                1 (const int)
+0:4            Constant:
+0:4              1 (const int)
+0:?   Linker Objects
+0:?     'pos' ( out 4-component vector of float Position)
+0:?     'clip' ( out 4-element array of float ClipDistance)
+0:?     'cull' ( out 4-element array of float CullDistance)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 89
+
+                              Capability Shader
+                              Capability ClipDistance
+                              Capability CullDistance
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 55 60 76
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 18  "@main(vf4;vf2[2];vf2[2];"
+                              Name 15  "pos"
+                              Name 16  "clip"
+                              Name 17  "cull"
+                              Name 44  "pos"
+                              Name 45  "clip"
+                              Name 46  "cull"
+                              Name 47  "param"
+                              Name 48  "param"
+                              Name 49  "param"
+                              Name 55  "pos"
+                              Name 60  "clip"
+                              Name 76  "cull"
+                              Decorate 55(pos) BuiltIn Position
+                              Decorate 60(clip) BuiltIn ClipDistance
+                              Decorate 76(cull) BuiltIn CullDistance
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypePointer Function 7(fvec4)
+               9:             TypeVector 6(float) 2
+              10:             TypeInt 32 0
+              11:     10(int) Constant 2
+              12:             TypeArray 9(fvec2) 11
+              13:             TypePointer Function 12
+              14:             TypeFunction 2 8(ptr) 13(ptr) 13(ptr)
+              20:    6(float) Constant 1065353216
+              21:    7(fvec4) ConstantComposite 20 20 20 20
+              22:             TypeInt 32 1
+              23:     22(int) Constant 0
+              24:    6(float) Constant 1056964608
+              25:     10(int) Constant 0
+              26:             TypePointer Function 6(float)
+              28:    6(float) Constant 1058642330
+              29:     10(int) Constant 1
+              31:     22(int) Constant 1
+              32:    6(float) Constant 1060320051
+              34:    6(float) Constant 1061997773
+              36:    6(float) Constant 1057384038
+              38:    6(float) Constant 1059061760
+              40:    6(float) Constant 1060739482
+              42:    6(float) Constant 1062417203
+              54:             TypePointer Output 7(fvec4)
+         55(pos):     54(ptr) Variable Output
+              57:     10(int) Constant 4
+              58:             TypeArray 6(float) 57
+              59:             TypePointer Output 58
+        60(clip):     59(ptr) Variable Output
+              63:             TypePointer Output 6(float)
+              68:     22(int) Constant 2
+              72:     22(int) Constant 3
+        76(cull):     59(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+         44(pos):      8(ptr) Variable Function
+        45(clip):     13(ptr) Variable Function
+        46(cull):     13(ptr) Variable Function
+       47(param):      8(ptr) Variable Function
+       48(param):     13(ptr) Variable Function
+       49(param):     13(ptr) Variable Function
+              50:           2 FunctionCall 18(@main(vf4;vf2[2];vf2[2];) 47(param) 48(param) 49(param)
+              51:    7(fvec4) Load 47(param)
+                              Store 44(pos) 51
+              52:          12 Load 48(param)
+                              Store 45(clip) 52
+              53:          12 Load 49(param)
+                              Store 46(cull) 53
+              56:    7(fvec4) Load 44(pos)
+                              Store 55(pos) 56
+              61:     26(ptr) AccessChain 45(clip) 23 25
+              62:    6(float) Load 61
+              64:     63(ptr) AccessChain 60(clip) 23
+                              Store 64 62
+              65:     26(ptr) AccessChain 45(clip) 23 29
+              66:    6(float) Load 65
+              67:     63(ptr) AccessChain 60(clip) 31
+                              Store 67 66
+              69:     26(ptr) AccessChain 45(clip) 31 25
+              70:    6(float) Load 69
+              71:     63(ptr) AccessChain 60(clip) 68
+                              Store 71 70
+              73:     26(ptr) AccessChain 45(clip) 31 29
+              74:    6(float) Load 73
+              75:     63(ptr) AccessChain 60(clip) 72
+                              Store 75 74
+              77:     26(ptr) AccessChain 46(cull) 23 25
+              78:    6(float) Load 77
+              79:     63(ptr) AccessChain 76(cull) 23
+                              Store 79 78
+              80:     26(ptr) AccessChain 46(cull) 23 29
+              81:    6(float) Load 80
+              82:     63(ptr) AccessChain 76(cull) 31
+                              Store 82 81
+              83:     26(ptr) AccessChain 46(cull) 31 25
+              84:    6(float) Load 83
+              85:     63(ptr) AccessChain 76(cull) 68
+                              Store 85 84
+              86:     26(ptr) AccessChain 46(cull) 31 29
+              87:    6(float) Load 86
+              88:     63(ptr) AccessChain 76(cull) 72
+                              Store 88 87
+                              Return
+                              FunctionEnd
+18(@main(vf4;vf2[2];vf2[2];):           2 Function None 14
+         15(pos):      8(ptr) FunctionParameter
+        16(clip):     13(ptr) FunctionParameter
+        17(cull):     13(ptr) FunctionParameter
+              19:             Label
+                              Store 15(pos) 21
+              27:     26(ptr) AccessChain 16(clip) 23 25
+                              Store 27 24
+              30:     26(ptr) AccessChain 16(clip) 23 29
+                              Store 30 28
+              33:     26(ptr) AccessChain 16(clip) 31 25
+                              Store 33 32
+              35:     26(ptr) AccessChain 16(clip) 31 29
+                              Store 35 34
+              37:     26(ptr) AccessChain 17(cull) 23 25
+                              Store 37 36
+              39:     26(ptr) AccessChain 17(cull) 23 29
+                              Store 39 38
+              41:     26(ptr) AccessChain 17(cull) 31 25
+                              Store 41 40
+              43:     26(ptr) AccessChain 17(cull) 31 29
+                              Store 43 42
+                              Return
+                              FunctionEnd

+ 229 - 0
3rdparty/glslang/Test/baseResults/hlsl.clipdistance-3.vert.out

@@ -0,0 +1,229 @@
+hlsl.clipdistance-3.vert
+Shader version: 500
+0:? Sequence
+0:4  Function Definition: @main(vf4;f1[2];f1[2]; ( temp void)
+0:4    Function Parameters: 
+0:4      'pos' ( out 4-component vector of float)
+0:4      'clip' ( out 2-element array of float)
+0:4      'cull' ( out 2-element array of float)
+0:?     Sequence
+0:5      move second child to first child ( temp 4-component vector of float)
+0:5        'pos' ( out 4-component vector of float)
+0:5        Constant:
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:6      move second child to first child ( temp float)
+0:6        direct index ( temp float)
+0:6          'clip' ( out 2-element array of float)
+0:6          Constant:
+0:6            0 (const int)
+0:6        Constant:
+0:6          0.500000
+0:7      move second child to first child ( temp float)
+0:7        direct index ( temp float)
+0:7          'clip' ( out 2-element array of float)
+0:7          Constant:
+0:7            1 (const int)
+0:7        Constant:
+0:7          0.600000
+0:9      move second child to first child ( temp float)
+0:9        direct index ( temp float)
+0:9          'cull' ( out 2-element array of float)
+0:9          Constant:
+0:9            0 (const int)
+0:9        Constant:
+0:9          0.525000
+0:10      move second child to first child ( temp float)
+0:10        direct index ( temp float)
+0:10          'cull' ( out 2-element array of float)
+0:10          Constant:
+0:10            1 (const int)
+0:10        Constant:
+0:10          0.625000
+0:4  Function Definition: main( ( temp void)
+0:4    Function Parameters: 
+0:?     Sequence
+0:4      Function Call: @main(vf4;f1[2];f1[2]; ( temp void)
+0:?         'pos' ( temp 4-component vector of float)
+0:?         'clip' ( temp 2-element array of float)
+0:?         'cull' ( temp 2-element array of float)
+0:4      move second child to first child ( temp 4-component vector of float)
+0:?         'pos' ( out 4-component vector of float Position)
+0:?         'pos' ( temp 4-component vector of float)
+0:?       Sequence
+0:4        move second child to first child ( temp 2-element array of float)
+0:?           'clip' ( out 2-element array of float ClipDistance)
+0:?           'clip' ( temp 2-element array of float)
+0:?       Sequence
+0:4        move second child to first child ( temp 2-element array of float)
+0:?           'cull' ( out 2-element array of float CullDistance)
+0:?           'cull' ( temp 2-element array of float)
+0:?   Linker Objects
+0:?     'pos' ( out 4-component vector of float Position)
+0:?     'clip' ( out 2-element array of float ClipDistance)
+0:?     'cull' ( out 2-element array of float CullDistance)
+
+
+Linked vertex stage:
+
+
+Shader version: 500
+0:? Sequence
+0:4  Function Definition: @main(vf4;f1[2];f1[2]; ( temp void)
+0:4    Function Parameters: 
+0:4      'pos' ( out 4-component vector of float)
+0:4      'clip' ( out 2-element array of float)
+0:4      'cull' ( out 2-element array of float)
+0:?     Sequence
+0:5      move second child to first child ( temp 4-component vector of float)
+0:5        'pos' ( out 4-component vector of float)
+0:5        Constant:
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:5          1.000000
+0:6      move second child to first child ( temp float)
+0:6        direct index ( temp float)
+0:6          'clip' ( out 2-element array of float)
+0:6          Constant:
+0:6            0 (const int)
+0:6        Constant:
+0:6          0.500000
+0:7      move second child to first child ( temp float)
+0:7        direct index ( temp float)
+0:7          'clip' ( out 2-element array of float)
+0:7          Constant:
+0:7            1 (const int)
+0:7        Constant:
+0:7          0.600000
+0:9      move second child to first child ( temp float)
+0:9        direct index ( temp float)
+0:9          'cull' ( out 2-element array of float)
+0:9          Constant:
+0:9            0 (const int)
+0:9        Constant:
+0:9          0.525000
+0:10      move second child to first child ( temp float)
+0:10        direct index ( temp float)
+0:10          'cull' ( out 2-element array of float)
+0:10          Constant:
+0:10            1 (const int)
+0:10        Constant:
+0:10          0.625000
+0:4  Function Definition: main( ( temp void)
+0:4    Function Parameters: 
+0:?     Sequence
+0:4      Function Call: @main(vf4;f1[2];f1[2]; ( temp void)
+0:?         'pos' ( temp 4-component vector of float)
+0:?         'clip' ( temp 2-element array of float)
+0:?         'cull' ( temp 2-element array of float)
+0:4      move second child to first child ( temp 4-component vector of float)
+0:?         'pos' ( out 4-component vector of float Position)
+0:?         'pos' ( temp 4-component vector of float)
+0:?       Sequence
+0:4        move second child to first child ( temp 2-element array of float)
+0:?           'clip' ( out 2-element array of float ClipDistance)
+0:?           'clip' ( temp 2-element array of float)
+0:?       Sequence
+0:4        move second child to first child ( temp 2-element array of float)
+0:?           'cull' ( out 2-element array of float CullDistance)
+0:?           'cull' ( temp 2-element array of float)
+0:?   Linker Objects
+0:?     'pos' ( out 4-component vector of float Position)
+0:?     'clip' ( out 2-element array of float ClipDistance)
+0:?     'cull' ( out 2-element array of float CullDistance)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 51
+
+                              Capability Shader
+                              Capability ClipDistance
+                              Capability CullDistance
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 44 47 49
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 17  "@main(vf4;f1[2];f1[2];"
+                              Name 14  "pos"
+                              Name 15  "clip"
+                              Name 16  "cull"
+                              Name 33  "pos"
+                              Name 34  "clip"
+                              Name 35  "cull"
+                              Name 36  "param"
+                              Name 37  "param"
+                              Name 38  "param"
+                              Name 44  "pos"
+                              Name 47  "clip"
+                              Name 49  "cull"
+                              Decorate 44(pos) BuiltIn Position
+                              Decorate 47(clip) BuiltIn ClipDistance
+                              Decorate 49(cull) BuiltIn CullDistance
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypePointer Function 7(fvec4)
+               9:             TypeInt 32 0
+              10:      9(int) Constant 2
+              11:             TypeArray 6(float) 10
+              12:             TypePointer Function 11
+              13:             TypeFunction 2 8(ptr) 12(ptr) 12(ptr)
+              19:    6(float) Constant 1065353216
+              20:    7(fvec4) ConstantComposite 19 19 19 19
+              21:             TypeInt 32 1
+              22:     21(int) Constant 0
+              23:    6(float) Constant 1056964608
+              24:             TypePointer Function 6(float)
+              26:     21(int) Constant 1
+              27:    6(float) Constant 1058642330
+              29:    6(float) Constant 1057384038
+              31:    6(float) Constant 1059061760
+              43:             TypePointer Output 7(fvec4)
+         44(pos):     43(ptr) Variable Output
+              46:             TypePointer Output 11
+        47(clip):     46(ptr) Variable Output
+        49(cull):     46(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+         33(pos):      8(ptr) Variable Function
+        34(clip):     12(ptr) Variable Function
+        35(cull):     12(ptr) Variable Function
+       36(param):      8(ptr) Variable Function
+       37(param):     12(ptr) Variable Function
+       38(param):     12(ptr) Variable Function
+              39:           2 FunctionCall 17(@main(vf4;f1[2];f1[2];) 36(param) 37(param) 38(param)
+              40:    7(fvec4) Load 36(param)
+                              Store 33(pos) 40
+              41:          11 Load 37(param)
+                              Store 34(clip) 41
+              42:          11 Load 38(param)
+                              Store 35(cull) 42
+              45:    7(fvec4) Load 33(pos)
+                              Store 44(pos) 45
+              48:          11 Load 34(clip)
+                              Store 47(clip) 48
+              50:          11 Load 35(cull)
+                              Store 49(cull) 50
+                              Return
+                              FunctionEnd
+17(@main(vf4;f1[2];f1[2];):           2 Function None 13
+         14(pos):      8(ptr) FunctionParameter
+        15(clip):     12(ptr) FunctionParameter
+        16(cull):     12(ptr) FunctionParameter
+              18:             Label
+                              Store 14(pos) 20
+              25:     24(ptr) AccessChain 15(clip) 22
+                              Store 25 23
+              28:     24(ptr) AccessChain 15(clip) 26
+                              Store 28 27
+              30:     24(ptr) AccessChain 16(cull) 22
+                              Store 30 29
+              32:     24(ptr) AccessChain 16(cull) 26
+                              Store 32 31
+                              Return
+                              FunctionEnd

+ 386 - 0
3rdparty/glslang/Test/baseResults/hlsl.clipdistance-4.vert.out

@@ -0,0 +1,386 @@
+hlsl.clipdistance-4.vert
+Shader version: 500
+0:? Sequence
+0:11  Function Definition: @main(struct-VS_INPUT-vf41; ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11    Function Parameters: 
+0:11      'v' ( const (read only) structure{ temp 4-component vector of float Position})
+0:?     Sequence
+0:13      move second child to first child ( temp 4-component vector of float)
+0:13        Position: direct index for structure ( temp 4-component vector of float)
+0:13          'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:13          Constant:
+0:13            0 (const int)
+0:13        Constant:
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:15      move second child to first child ( temp float)
+0:15        direct index ( temp float)
+0:15          ClipRect: direct index for structure ( temp 4-component vector of float)
+0:15            'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:15            Constant:
+0:15              1 (const int)
+0:15          Constant:
+0:15            0 (const int)
+0:15        Constant:
+0:15          1.000000
+0:16      move second child to first child ( temp float)
+0:16        direct index ( temp float)
+0:16          ClipRect: direct index for structure ( temp 4-component vector of float)
+0:16            'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:16            Constant:
+0:16              1 (const int)
+0:16          Constant:
+0:16            1 (const int)
+0:16        Constant:
+0:16          2.000000
+0:17      move second child to first child ( temp float)
+0:17        direct index ( temp float)
+0:17          ClipRect: direct index for structure ( temp 4-component vector of float)
+0:17            'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:17            Constant:
+0:17              1 (const int)
+0:17          Constant:
+0:17            2 (const int)
+0:17        Constant:
+0:17          3.000000
+0:18      move second child to first child ( temp float)
+0:18        direct index ( temp float)
+0:18          ClipRect: direct index for structure ( temp 4-component vector of float)
+0:18            'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:18            Constant:
+0:18              1 (const int)
+0:18          Constant:
+0:18            3 (const int)
+0:18        Constant:
+0:18          4.000000
+0:20      Branch: Return with expression
+0:20        'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11  Function Definition: main( ( temp void)
+0:11    Function Parameters: 
+0:?     Sequence
+0:11      Sequence
+0:11        move second child to first child ( temp 4-component vector of float)
+0:11          Position: direct index for structure ( temp 4-component vector of float)
+0:?             'v' ( temp structure{ temp 4-component vector of float Position})
+0:11            Constant:
+0:11              0 (const int)
+0:?           'Position' (layout( location=0) in 4-component vector of float)
+0:11      Sequence
+0:11        move second child to first child ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11          'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11          Function Call: @main(struct-VS_INPUT-vf41; ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:?             'v' ( temp structure{ temp 4-component vector of float Position})
+0:11        move second child to first child ( temp 4-component vector of float)
+0:?           '@entryPointOutput_Position' ( out 4-component vector of float Position)
+0:11          Position: direct index for structure ( temp 4-component vector of float)
+0:11            'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11            Constant:
+0:11              0 (const int)
+0:?         Sequence
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            direct index ( temp float)
+0:11              ClipRect: direct index for structure ( temp 4-component vector of float)
+0:11                'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            direct index ( temp float)
+0:11              ClipRect: direct index for structure ( temp 4-component vector of float)
+0:11                'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            direct index ( temp float)
+0:11              ClipRect: direct index for structure ( temp 4-component vector of float)
+0:11                'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                2 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                3 (const int)
+0:11            direct index ( temp float)
+0:11              ClipRect: direct index for structure ( temp 4-component vector of float)
+0:11                'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                3 (const int)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out structure{})
+0:?     'Position' (layout( location=0) in 4-component vector of float)
+
+
+Linked vertex stage:
+
+
+Shader version: 500
+0:? Sequence
+0:11  Function Definition: @main(struct-VS_INPUT-vf41; ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11    Function Parameters: 
+0:11      'v' ( const (read only) structure{ temp 4-component vector of float Position})
+0:?     Sequence
+0:13      move second child to first child ( temp 4-component vector of float)
+0:13        Position: direct index for structure ( temp 4-component vector of float)
+0:13          'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:13          Constant:
+0:13            0 (const int)
+0:13        Constant:
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:15      move second child to first child ( temp float)
+0:15        direct index ( temp float)
+0:15          ClipRect: direct index for structure ( temp 4-component vector of float)
+0:15            'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:15            Constant:
+0:15              1 (const int)
+0:15          Constant:
+0:15            0 (const int)
+0:15        Constant:
+0:15          1.000000
+0:16      move second child to first child ( temp float)
+0:16        direct index ( temp float)
+0:16          ClipRect: direct index for structure ( temp 4-component vector of float)
+0:16            'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:16            Constant:
+0:16              1 (const int)
+0:16          Constant:
+0:16            1 (const int)
+0:16        Constant:
+0:16          2.000000
+0:17      move second child to first child ( temp float)
+0:17        direct index ( temp float)
+0:17          ClipRect: direct index for structure ( temp 4-component vector of float)
+0:17            'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:17            Constant:
+0:17              1 (const int)
+0:17          Constant:
+0:17            2 (const int)
+0:17        Constant:
+0:17          3.000000
+0:18      move second child to first child ( temp float)
+0:18        direct index ( temp float)
+0:18          ClipRect: direct index for structure ( temp 4-component vector of float)
+0:18            'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:18            Constant:
+0:18              1 (const int)
+0:18          Constant:
+0:18            3 (const int)
+0:18        Constant:
+0:18          4.000000
+0:20      Branch: Return with expression
+0:20        'Output' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11  Function Definition: main( ( temp void)
+0:11    Function Parameters: 
+0:?     Sequence
+0:11      Sequence
+0:11        move second child to first child ( temp 4-component vector of float)
+0:11          Position: direct index for structure ( temp 4-component vector of float)
+0:?             'v' ( temp structure{ temp 4-component vector of float Position})
+0:11            Constant:
+0:11              0 (const int)
+0:?           'Position' (layout( location=0) in 4-component vector of float)
+0:11      Sequence
+0:11        move second child to first child ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11          'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11          Function Call: @main(struct-VS_INPUT-vf41; ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:?             'v' ( temp structure{ temp 4-component vector of float Position})
+0:11        move second child to first child ( temp 4-component vector of float)
+0:?           '@entryPointOutput_Position' ( out 4-component vector of float Position)
+0:11          Position: direct index for structure ( temp 4-component vector of float)
+0:11            'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11            Constant:
+0:11              0 (const int)
+0:?         Sequence
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            direct index ( temp float)
+0:11              ClipRect: direct index for structure ( temp 4-component vector of float)
+0:11                'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            direct index ( temp float)
+0:11              ClipRect: direct index for structure ( temp 4-component vector of float)
+0:11                'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            direct index ( temp float)
+0:11              ClipRect: direct index for structure ( temp 4-component vector of float)
+0:11                'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                2 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                3 (const int)
+0:11            direct index ( temp float)
+0:11              ClipRect: direct index for structure ( temp 4-component vector of float)
+0:11                'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 4-component vector of float ClipRect})
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                3 (const int)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out structure{})
+0:?     'Position' (layout( location=0) in 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 75
+
+                              Capability Shader
+                              Capability ClipDistance
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 43 50 56 74
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 8  "VS_INPUT"
+                              MemberName 8(VS_INPUT) 0  "Position"
+                              Name 9  "VS_OUTPUT"
+                              MemberName 9(VS_OUTPUT) 0  "Position"
+                              MemberName 9(VS_OUTPUT) 1  "ClipRect"
+                              Name 12  "@main(struct-VS_INPUT-vf41;"
+                              Name 11  "v"
+                              Name 15  "Output"
+                              Name 41  "v"
+                              Name 43  "Position"
+                              Name 46  "flattenTemp"
+                              Name 50  "@entryPointOutput_Position"
+                              Name 56  "@entryPointOutput_ClipRect"
+                              Name 72  "VS_OUTPUT"
+                              Name 74  "@entryPointOutput"
+                              Decorate 43(Position) Location 0
+                              Decorate 50(@entryPointOutput_Position) BuiltIn Position
+                              Decorate 56(@entryPointOutput_ClipRect) BuiltIn ClipDistance
+                              Decorate 74(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+     8(VS_INPUT):             TypeStruct 7(fvec4)
+    9(VS_OUTPUT):             TypeStruct 7(fvec4) 7(fvec4)
+              10:             TypeFunction 9(VS_OUTPUT) 8(VS_INPUT)
+              14:             TypePointer Function 9(VS_OUTPUT)
+              16:             TypeInt 32 1
+              17:     16(int) Constant 0
+              18:    6(float) Constant 0
+              19:    7(fvec4) ConstantComposite 18 18 18 18
+              20:             TypePointer Function 7(fvec4)
+              22:     16(int) Constant 1
+              23:    6(float) Constant 1065353216
+              24:             TypeInt 32 0
+              25:     24(int) Constant 0
+              26:             TypePointer Function 6(float)
+              28:    6(float) Constant 1073741824
+              29:     24(int) Constant 1
+              31:    6(float) Constant 1077936128
+              32:     24(int) Constant 2
+              34:    6(float) Constant 1082130432
+              35:     24(int) Constant 3
+              40:             TypePointer Function 8(VS_INPUT)
+              42:             TypePointer Input 7(fvec4)
+    43(Position):     42(ptr) Variable Input
+              49:             TypePointer Output 7(fvec4)
+50(@entryPointOutput_Position):     49(ptr) Variable Output
+              53:     24(int) Constant 4
+              54:             TypeArray 6(float) 53
+              55:             TypePointer Output 54
+56(@entryPointOutput_ClipRect):     55(ptr) Variable Output
+              59:             TypePointer Output 6(float)
+              64:     16(int) Constant 2
+              68:     16(int) Constant 3
+   72(VS_OUTPUT):             TypeStruct
+              73:             TypePointer Output 72(VS_OUTPUT)
+74(@entryPointOutput):     73(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+           41(v):     40(ptr) Variable Function
+ 46(flattenTemp):     14(ptr) Variable Function
+              44:    7(fvec4) Load 43(Position)
+              45:     20(ptr) AccessChain 41(v) 17
+                              Store 45 44
+              47: 8(VS_INPUT) Load 41(v)
+              48:9(VS_OUTPUT) FunctionCall 12(@main(struct-VS_INPUT-vf41;) 47
+                              Store 46(flattenTemp) 48
+              51:     20(ptr) AccessChain 46(flattenTemp) 17
+              52:    7(fvec4) Load 51
+                              Store 50(@entryPointOutput_Position) 52
+              57:     26(ptr) AccessChain 46(flattenTemp) 22 25
+              58:    6(float) Load 57
+              60:     59(ptr) AccessChain 56(@entryPointOutput_ClipRect) 17
+                              Store 60 58
+              61:     26(ptr) AccessChain 46(flattenTemp) 22 29
+              62:    6(float) Load 61
+              63:     59(ptr) AccessChain 56(@entryPointOutput_ClipRect) 22
+                              Store 63 62
+              65:     26(ptr) AccessChain 46(flattenTemp) 22 32
+              66:    6(float) Load 65
+              67:     59(ptr) AccessChain 56(@entryPointOutput_ClipRect) 64
+                              Store 67 66
+              69:     26(ptr) AccessChain 46(flattenTemp) 22 35
+              70:    6(float) Load 69
+              71:     59(ptr) AccessChain 56(@entryPointOutput_ClipRect) 68
+                              Store 71 70
+                              Return
+                              FunctionEnd
+12(@main(struct-VS_INPUT-vf41;):9(VS_OUTPUT) Function None 10
+           11(v): 8(VS_INPUT) FunctionParameter
+              13:             Label
+      15(Output):     14(ptr) Variable Function
+              21:     20(ptr) AccessChain 15(Output) 17
+                              Store 21 19
+              27:     26(ptr) AccessChain 15(Output) 22 25
+                              Store 27 23
+              30:     26(ptr) AccessChain 15(Output) 22 29
+                              Store 30 28
+              33:     26(ptr) AccessChain 15(Output) 22 32
+                              Store 33 31
+              36:     26(ptr) AccessChain 15(Output) 22 35
+                              Store 36 34
+              37:9(VS_OUTPUT) Load 15(Output)
+                              ReturnValue 37
+                              FunctionEnd

+ 435 - 0
3rdparty/glslang/Test/baseResults/hlsl.clipdistance-5.vert.out

@@ -0,0 +1,435 @@
+hlsl.clipdistance-5.vert
+Shader version: 500
+0:? Sequence
+0:11  Function Definition: @main(struct-VS_INPUT-vf41; ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11    Function Parameters: 
+0:11      'v' ( const (read only) structure{ temp 4-component vector of float Position})
+0:?     Sequence
+0:13      move second child to first child ( temp 4-component vector of float)
+0:13        Position: direct index for structure ( temp 4-component vector of float)
+0:13          'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:13          Constant:
+0:13            0 (const int)
+0:13        Constant:
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:15      move second child to first child ( temp float)
+0:15        direct index ( temp float)
+0:15          direct index ( temp 2-component vector of float)
+0:15            ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:15              'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:15              Constant:
+0:15                1 (const int)
+0:15            Constant:
+0:15              0 (const int)
+0:15          Constant:
+0:15            0 (const int)
+0:15        Constant:
+0:15          1.000000
+0:16      move second child to first child ( temp float)
+0:16        direct index ( temp float)
+0:16          direct index ( temp 2-component vector of float)
+0:16            ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:16              'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:16              Constant:
+0:16                1 (const int)
+0:16            Constant:
+0:16              0 (const int)
+0:16          Constant:
+0:16            1 (const int)
+0:16        Constant:
+0:16          2.000000
+0:17      move second child to first child ( temp float)
+0:17        direct index ( temp float)
+0:17          direct index ( temp 2-component vector of float)
+0:17            ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:17              'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:17              Constant:
+0:17                1 (const int)
+0:17            Constant:
+0:17              1 (const int)
+0:17          Constant:
+0:17            0 (const int)
+0:17        Constant:
+0:17          3.000000
+0:18      move second child to first child ( temp float)
+0:18        direct index ( temp float)
+0:18          direct index ( temp 2-component vector of float)
+0:18            ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:18              'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:18              Constant:
+0:18                1 (const int)
+0:18            Constant:
+0:18              1 (const int)
+0:18          Constant:
+0:18            1 (const int)
+0:18        Constant:
+0:18          4.000000
+0:20      Branch: Return with expression
+0:20        'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11  Function Definition: main( ( temp void)
+0:11    Function Parameters: 
+0:?     Sequence
+0:11      Sequence
+0:11        move second child to first child ( temp 4-component vector of float)
+0:11          Position: direct index for structure ( temp 4-component vector of float)
+0:?             'v' ( temp structure{ temp 4-component vector of float Position})
+0:11            Constant:
+0:11              0 (const int)
+0:?           'Position' (layout( location=0) in 4-component vector of float)
+0:11      Sequence
+0:11        move second child to first child ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11          'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11          Function Call: @main(struct-VS_INPUT-vf41; ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:?             'v' ( temp structure{ temp 4-component vector of float Position})
+0:11        move second child to first child ( temp 4-component vector of float)
+0:?           '@entryPointOutput_Position' ( out 4-component vector of float Position)
+0:11          Position: direct index for structure ( temp 4-component vector of float)
+0:11            'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11            Constant:
+0:11              0 (const int)
+0:?         Sequence
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            direct index ( temp float)
+0:11              direct index ( temp 2-component vector of float)
+0:11                ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:11                  'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11                  Constant:
+0:11                    1 (const int)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            direct index ( temp float)
+0:11              direct index ( temp 2-component vector of float)
+0:11                ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:11                  'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11                  Constant:
+0:11                    1 (const int)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            direct index ( temp float)
+0:11              direct index ( temp 2-component vector of float)
+0:11                ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:11                  'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11                  Constant:
+0:11                    1 (const int)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                3 (const int)
+0:11            direct index ( temp float)
+0:11              direct index ( temp 2-component vector of float)
+0:11                ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:11                  'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11                  Constant:
+0:11                    1 (const int)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out structure{})
+0:?     'Position' (layout( location=0) in 4-component vector of float)
+
+
+Linked vertex stage:
+
+
+Shader version: 500
+0:? Sequence
+0:11  Function Definition: @main(struct-VS_INPUT-vf41; ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11    Function Parameters: 
+0:11      'v' ( const (read only) structure{ temp 4-component vector of float Position})
+0:?     Sequence
+0:13      move second child to first child ( temp 4-component vector of float)
+0:13        Position: direct index for structure ( temp 4-component vector of float)
+0:13          'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:13          Constant:
+0:13            0 (const int)
+0:13        Constant:
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:15      move second child to first child ( temp float)
+0:15        direct index ( temp float)
+0:15          direct index ( temp 2-component vector of float)
+0:15            ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:15              'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:15              Constant:
+0:15                1 (const int)
+0:15            Constant:
+0:15              0 (const int)
+0:15          Constant:
+0:15            0 (const int)
+0:15        Constant:
+0:15          1.000000
+0:16      move second child to first child ( temp float)
+0:16        direct index ( temp float)
+0:16          direct index ( temp 2-component vector of float)
+0:16            ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:16              'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:16              Constant:
+0:16                1 (const int)
+0:16            Constant:
+0:16              0 (const int)
+0:16          Constant:
+0:16            1 (const int)
+0:16        Constant:
+0:16          2.000000
+0:17      move second child to first child ( temp float)
+0:17        direct index ( temp float)
+0:17          direct index ( temp 2-component vector of float)
+0:17            ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:17              'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:17              Constant:
+0:17                1 (const int)
+0:17            Constant:
+0:17              1 (const int)
+0:17          Constant:
+0:17            0 (const int)
+0:17        Constant:
+0:17          3.000000
+0:18      move second child to first child ( temp float)
+0:18        direct index ( temp float)
+0:18          direct index ( temp 2-component vector of float)
+0:18            ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:18              'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:18              Constant:
+0:18                1 (const int)
+0:18            Constant:
+0:18              1 (const int)
+0:18          Constant:
+0:18            1 (const int)
+0:18        Constant:
+0:18          4.000000
+0:20      Branch: Return with expression
+0:20        'Output' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11  Function Definition: main( ( temp void)
+0:11    Function Parameters: 
+0:?     Sequence
+0:11      Sequence
+0:11        move second child to first child ( temp 4-component vector of float)
+0:11          Position: direct index for structure ( temp 4-component vector of float)
+0:?             'v' ( temp structure{ temp 4-component vector of float Position})
+0:11            Constant:
+0:11              0 (const int)
+0:?           'Position' (layout( location=0) in 4-component vector of float)
+0:11      Sequence
+0:11        move second child to first child ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11          'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11          Function Call: @main(struct-VS_INPUT-vf41; ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:?             'v' ( temp structure{ temp 4-component vector of float Position})
+0:11        move second child to first child ( temp 4-component vector of float)
+0:?           '@entryPointOutput_Position' ( out 4-component vector of float Position)
+0:11          Position: direct index for structure ( temp 4-component vector of float)
+0:11            'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11            Constant:
+0:11              0 (const int)
+0:?         Sequence
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                0 (const int)
+0:11            direct index ( temp float)
+0:11              direct index ( temp 2-component vector of float)
+0:11                ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:11                  'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11                  Constant:
+0:11                    1 (const int)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                1 (const int)
+0:11            direct index ( temp float)
+0:11              direct index ( temp 2-component vector of float)
+0:11                ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:11                  'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11                  Constant:
+0:11                    1 (const int)
+0:11                Constant:
+0:11                  0 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                2 (const int)
+0:11            direct index ( temp float)
+0:11              direct index ( temp 2-component vector of float)
+0:11                ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:11                  'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11                  Constant:
+0:11                    1 (const int)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                0 (const int)
+0:11          move second child to first child ( temp float)
+0:11            direct index ( temp float)
+0:?               '@entryPointOutput_ClipRect' ( out 4-element array of float ClipDistance)
+0:11              Constant:
+0:11                3 (const int)
+0:11            direct index ( temp float)
+0:11              direct index ( temp 2-component vector of float)
+0:11                ClipRect: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:11                  'flattenTemp' ( temp structure{ temp 4-component vector of float Position,  temp 2-element array of 2-component vector of float ClipRect})
+0:11                  Constant:
+0:11                    1 (const int)
+0:11                Constant:
+0:11                  1 (const int)
+0:11              Constant:
+0:11                1 (const int)
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out structure{})
+0:?     'Position' (layout( location=0) in 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 76
+
+                              Capability Shader
+                              Capability ClipDistance
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 44 51 57 75
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 8  "VS_INPUT"
+                              MemberName 8(VS_INPUT) 0  "Position"
+                              Name 13  "VS_OUTPUT"
+                              MemberName 13(VS_OUTPUT) 0  "Position"
+                              MemberName 13(VS_OUTPUT) 1  "ClipRect"
+                              Name 16  "@main(struct-VS_INPUT-vf41;"
+                              Name 15  "v"
+                              Name 19  "Output"
+                              Name 42  "v"
+                              Name 44  "Position"
+                              Name 47  "flattenTemp"
+                              Name 51  "@entryPointOutput_Position"
+                              Name 57  "@entryPointOutput_ClipRect"
+                              Name 73  "VS_OUTPUT"
+                              Name 75  "@entryPointOutput"
+                              Decorate 44(Position) Location 0
+                              Decorate 51(@entryPointOutput_Position) BuiltIn Position
+                              Decorate 57(@entryPointOutput_ClipRect) BuiltIn ClipDistance
+                              Decorate 75(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+     8(VS_INPUT):             TypeStruct 7(fvec4)
+               9:             TypeVector 6(float) 2
+              10:             TypeInt 32 0
+              11:     10(int) Constant 2
+              12:             TypeArray 9(fvec2) 11
+   13(VS_OUTPUT):             TypeStruct 7(fvec4) 12
+              14:             TypeFunction 13(VS_OUTPUT) 8(VS_INPUT)
+              18:             TypePointer Function 13(VS_OUTPUT)
+              20:             TypeInt 32 1
+              21:     20(int) Constant 0
+              22:    6(float) Constant 0
+              23:    7(fvec4) ConstantComposite 22 22 22 22
+              24:             TypePointer Function 7(fvec4)
+              26:     20(int) Constant 1
+              27:    6(float) Constant 1065353216
+              28:     10(int) Constant 0
+              29:             TypePointer Function 6(float)
+              31:    6(float) Constant 1073741824
+              32:     10(int) Constant 1
+              34:    6(float) Constant 1077936128
+              36:    6(float) Constant 1082130432
+              41:             TypePointer Function 8(VS_INPUT)
+              43:             TypePointer Input 7(fvec4)
+    44(Position):     43(ptr) Variable Input
+              50:             TypePointer Output 7(fvec4)
+51(@entryPointOutput_Position):     50(ptr) Variable Output
+              54:     10(int) Constant 4
+              55:             TypeArray 6(float) 54
+              56:             TypePointer Output 55
+57(@entryPointOutput_ClipRect):     56(ptr) Variable Output
+              60:             TypePointer Output 6(float)
+              65:     20(int) Constant 2
+              69:     20(int) Constant 3
+   73(VS_OUTPUT):             TypeStruct
+              74:             TypePointer Output 73(VS_OUTPUT)
+75(@entryPointOutput):     74(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+           42(v):     41(ptr) Variable Function
+ 47(flattenTemp):     18(ptr) Variable Function
+              45:    7(fvec4) Load 44(Position)
+              46:     24(ptr) AccessChain 42(v) 21
+                              Store 46 45
+              48: 8(VS_INPUT) Load 42(v)
+              49:13(VS_OUTPUT) FunctionCall 16(@main(struct-VS_INPUT-vf41;) 48
+                              Store 47(flattenTemp) 49
+              52:     24(ptr) AccessChain 47(flattenTemp) 21
+              53:    7(fvec4) Load 52
+                              Store 51(@entryPointOutput_Position) 53
+              58:     29(ptr) AccessChain 47(flattenTemp) 26 21 28
+              59:    6(float) Load 58
+              61:     60(ptr) AccessChain 57(@entryPointOutput_ClipRect) 21
+                              Store 61 59
+              62:     29(ptr) AccessChain 47(flattenTemp) 26 21 32
+              63:    6(float) Load 62
+              64:     60(ptr) AccessChain 57(@entryPointOutput_ClipRect) 26
+                              Store 64 63
+              66:     29(ptr) AccessChain 47(flattenTemp) 26 26 28
+              67:    6(float) Load 66
+              68:     60(ptr) AccessChain 57(@entryPointOutput_ClipRect) 65
+                              Store 68 67
+              70:     29(ptr) AccessChain 47(flattenTemp) 26 26 32
+              71:    6(float) Load 70
+              72:     60(ptr) AccessChain 57(@entryPointOutput_ClipRect) 69
+                              Store 72 71
+                              Return
+                              FunctionEnd
+16(@main(struct-VS_INPUT-vf41;):13(VS_OUTPUT) Function None 14
+           15(v): 8(VS_INPUT) FunctionParameter
+              17:             Label
+      19(Output):     18(ptr) Variable Function
+              25:     24(ptr) AccessChain 19(Output) 21
+                              Store 25 23
+              30:     29(ptr) AccessChain 19(Output) 26 21 28
+                              Store 30 27
+              33:     29(ptr) AccessChain 19(Output) 26 21 32
+                              Store 33 31
+              35:     29(ptr) AccessChain 19(Output) 26 26 28
+                              Store 35 34
+              37:     29(ptr) AccessChain 19(Output) 26 26 32
+                              Store 37 36
+              38:13(VS_OUTPUT) Load 19(Output)
+                              ReturnValue 38
+                              FunctionEnd

+ 9 - 8
3rdparty/glslang/Test/baseResults/hlsl.entry-in.frag.out

@@ -58,7 +58,7 @@ gl_FragCoord origin is upper left
 0:13            Constant:
 0:13              0 (const int)
 0:13          v: direct index for structure ( temp 2-component vector of float)
-0:13            'i' (layout( location=0) in structure{ temp 2-component vector of float v,  temp 2-component vector of int i2})
+0:13            'i' (layout( location=0) in structure{ temp 2-component vector of float v,  flat temp 2-component vector of int i2})
 0:13            Constant:
 0:13              0 (const int)
 0:13        move second child to first child ( temp 4-component vector of float)
@@ -72,8 +72,8 @@ gl_FragCoord origin is upper left
 0:?             'i' ( temp structure{ temp 2-component vector of float v,  temp 4-component vector of float fragCoord,  temp 2-component vector of int i2})
 0:13            Constant:
 0:13              2 (const int)
-0:13          i2: direct index for structure ( temp 2-component vector of int)
-0:13            'i' (layout( location=0) in structure{ temp 2-component vector of float v,  temp 2-component vector of int i2})
+0:13          i2: direct index for structure ( flat temp 2-component vector of int)
+0:13            'i' (layout( location=0) in structure{ temp 2-component vector of float v,  flat temp 2-component vector of int i2})
 0:13            Constant:
 0:13              1 (const int)
 0:13      move second child to first child ( temp 4-component vector of float)
@@ -82,7 +82,7 @@ gl_FragCoord origin is upper left
 0:?           'i' ( temp structure{ temp 2-component vector of float v,  temp 4-component vector of float fragCoord,  temp 2-component vector of int i2})
 0:?   Linker Objects
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'i' (layout( location=0) in structure{ temp 2-component vector of float v,  temp 2-component vector of int i2})
+0:?     'i' (layout( location=0) in structure{ temp 2-component vector of float v,  flat temp 2-component vector of int i2})
 0:?     'i_fragCoord' ( in 4-component vector of float FragCoord)
 
 
@@ -148,7 +148,7 @@ gl_FragCoord origin is upper left
 0:13            Constant:
 0:13              0 (const int)
 0:13          v: direct index for structure ( temp 2-component vector of float)
-0:13            'i' (layout( location=0) in structure{ temp 2-component vector of float v,  temp 2-component vector of int i2})
+0:13            'i' (layout( location=0) in structure{ temp 2-component vector of float v,  flat temp 2-component vector of int i2})
 0:13            Constant:
 0:13              0 (const int)
 0:13        move second child to first child ( temp 4-component vector of float)
@@ -162,8 +162,8 @@ gl_FragCoord origin is upper left
 0:?             'i' ( temp structure{ temp 2-component vector of float v,  temp 4-component vector of float fragCoord,  temp 2-component vector of int i2})
 0:13            Constant:
 0:13              2 (const int)
-0:13          i2: direct index for structure ( temp 2-component vector of int)
-0:13            'i' (layout( location=0) in structure{ temp 2-component vector of float v,  temp 2-component vector of int i2})
+0:13          i2: direct index for structure ( flat temp 2-component vector of int)
+0:13            'i' (layout( location=0) in structure{ temp 2-component vector of float v,  flat temp 2-component vector of int i2})
 0:13            Constant:
 0:13              1 (const int)
 0:13      move second child to first child ( temp 4-component vector of float)
@@ -172,7 +172,7 @@ gl_FragCoord origin is upper left
 0:?           'i' ( temp structure{ temp 2-component vector of float v,  temp 4-component vector of float fragCoord,  temp 2-component vector of int i2})
 0:?   Linker Objects
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'i' (layout( location=0) in structure{ temp 2-component vector of float v,  temp 2-component vector of int i2})
+0:?     'i' (layout( location=0) in structure{ temp 2-component vector of float v,  flat temp 2-component vector of int i2})
 0:?     'i_fragCoord' ( in 4-component vector of float FragCoord)
 
 // Module Version 10000
@@ -207,6 +207,7 @@ gl_FragCoord origin is upper left
                               Name 63  "i_fragCoord"
                               Name 73  "@entryPointOutput"
                               Name 74  "param"
+                              MemberDecorate 54(InParam) 1 Flat
                               Decorate 56(i) Location 0
                               Decorate 63(i_fragCoord) BuiltIn FragCoord
                               Decorate 73(@entryPointOutput) Location 0

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.getsampleposition.dx10.frag.out

@@ -260,7 +260,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:13      move second child to first child ( temp int)
 0:?         'sample' ( temp int)
-0:?         'sample' (layout( location=0) in int)
+0:?         'sample' (layout( location=0) flat in int)
 0:13      Sequence
 0:13        move second child to first child ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
 0:13          'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
@@ -284,7 +284,7 @@ gl_FragCoord origin is upper left
 0:?     'g_tTex2dmsf4a' ( uniform texture2DMSArray)
 0:?     'Color' (layout( location=0) out 4-component vector of float)
 0:?     'Depth' ( out float FragDepth)
-0:?     'sample' (layout( location=0) in int)
+0:?     'sample' (layout( location=0) flat in int)
 
 
 Linked fragment stage:
@@ -551,7 +551,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:13      move second child to first child ( temp int)
 0:?         'sample' ( temp int)
-0:?         'sample' (layout( location=0) in int)
+0:?         'sample' (layout( location=0) flat in int)
 0:13      Sequence
 0:13        move second child to first child ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
 0:13          'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
@@ -575,7 +575,7 @@ gl_FragCoord origin is upper left
 0:?     'g_tTex2dmsf4a' ( uniform texture2DMSArray)
 0:?     'Color' (layout( location=0) out 4-component vector of float)
 0:?     'Depth' ( out float FragDepth)
-0:?     'sample' (layout( location=0) in int)
+0:?     'sample' (layout( location=0) flat in int)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -619,6 +619,7 @@ gl_FragCoord origin is upper left
                               Name 220  "g_sSamp"
                               Decorate 23(g_tTex2dmsf4) DescriptorSet 0
                               Decorate 142(g_tTex2dmsf4a) DescriptorSet 0
+                              Decorate 204(sample) Flat
                               Decorate 204(sample) Location 0
                               Decorate 211(Color) Location 0
                               Decorate 215(Depth) BuiltIn FragDepth

+ 257 - 226
3rdparty/glslang/Test/baseResults/hlsl.inoutquals.frag.out

@@ -2,11 +2,12 @@ hlsl.inoutquals.frag
 Shader version: 500
 gl_FragCoord origin is upper left
 0:? Sequence
-0:8  Function Definition: MyFunc(f1;f1;f1; ( temp void)
+0:8  Function Definition: MyFunc(f1;f1;f1;f1; ( temp void)
 0:8    Function Parameters: 
 0:8      'x' ( in float)
 0:8      'y' ( out float)
 0:8      'z' ( inout float)
+0:8      'w' ( inout float)
 0:?     Sequence
 0:9      move second child to first child ( temp float)
 0:9        'y' ( out float)
@@ -18,71 +19,79 @@ gl_FragCoord origin is upper left
 0:11        'x' ( in float)
 0:11        Constant:
 0:11          -1.000000
-0:15  Function Definition: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15    Function Parameters: 
-0:15      'inpos' ( in 4-component vector of float)
-0:15      'sampleMask' ( out int)
+0:12      multiply second child into first child ( temp float)
+0:12        'w' ( inout float)
+0:12        Constant:
+0:12          1.000000
+0:16  Function Definition: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16    Function Parameters: 
+0:16      'inpos' ( in 4-component vector of float)
+0:16      'sampleMask' ( out int)
 0:?     Sequence
-0:18      Sequence
-0:18        move second child to first child ( temp float)
-0:18          'x' ( temp float)
-0:18          Constant:
-0:18            7.000000
-0:18        move second child to first child ( temp float)
-0:18          'z' ( temp float)
-0:18          Constant:
-0:18            3.000000
-0:19      Function Call: MyFunc(f1;f1;f1; ( temp void)
-0:19        'x' ( temp float)
-0:19        'y' ( temp float)
-0:19        'z' ( temp float)
-0:21      move second child to first child ( temp 4-component vector of float)
-0:21        Color: direct index for structure ( temp 4-component vector of float)
-0:21          'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:21          Constant:
-0:21            0 (const int)
-0:?         Construct vec4 ( temp 4-component vector of float)
-0:21          'x' ( temp float)
-0:21          'y' ( temp float)
-0:21          'z' ( temp float)
-0:21          Constant:
-0:21            1.000000
-0:22      move second child to first child ( temp float)
-0:22        Depth: direct index for structure ( temp float)
+0:19      Sequence
+0:19        move second child to first child ( temp float)
+0:19          'x' ( temp float)
+0:19          Constant:
+0:19            7.000000
+0:19        move second child to first child ( temp float)
+0:19          'z' ( temp float)
+0:19          Constant:
+0:19            3.000000
+0:20      Function Call: MyFunc(f1;f1;f1;f1; ( temp void)
+0:20        'x' ( temp float)
+0:20        'y' ( temp float)
+0:20        'z' ( temp float)
+0:20        direct index ( temp float)
+0:20          'inpos' ( in 4-component vector of float)
+0:20          Constant:
+0:20            3 (const int)
+0:22      move second child to first child ( temp 4-component vector of float)
+0:22        Color: direct index for structure ( temp 4-component vector of float)
 0:22          'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
 0:22          Constant:
-0:22            1 (const int)
-0:22        direct index ( temp float)
-0:22          'inpos' ( in 4-component vector of float)
+0:22            0 (const int)
+0:?         Construct vec4 ( temp 4-component vector of float)
+0:22          'x' ( temp float)
+0:22          'y' ( temp float)
+0:22          'z' ( temp float)
 0:22          Constant:
-0:22            3 (const int)
-0:24      Branch: Return with expression
-0:24        'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15  Function Definition: main( ( temp void)
-0:15    Function Parameters: 
+0:22            1.000000
+0:23      move second child to first child ( temp float)
+0:23        Depth: direct index for structure ( temp float)
+0:23          'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:23          Constant:
+0:23            1 (const int)
+0:23        direct index ( temp float)
+0:23          'inpos' ( in 4-component vector of float)
+0:23          Constant:
+0:23            3 (const int)
+0:25      Branch: Return with expression
+0:25        'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16  Function Definition: main( ( temp void)
+0:16    Function Parameters: 
 0:?     Sequence
-0:15      move second child to first child ( temp 4-component vector of float)
+0:16      move second child to first child ( temp 4-component vector of float)
 0:?         'inpos' ( temp 4-component vector of float)
 0:?         'inpos' ( noperspective in 4-component vector of float FragCoord)
-0:15      Sequence
-0:15        move second child to first child ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15          'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15          Function Call: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16      Sequence
+0:16        move second child to first child ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16          'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16          Function Call: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
 0:?             'inpos' ( temp 4-component vector of float)
 0:?             'sampleMask' ( temp int)
-0:15        move second child to first child ( temp 4-component vector of float)
+0:16        move second child to first child ( temp 4-component vector of float)
 0:?           'Color' (layout( location=0) out 4-component vector of float)
-0:15          Color: direct index for structure ( temp 4-component vector of float)
-0:15            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15            Constant:
-0:15              0 (const int)
-0:15        move second child to first child ( temp float)
+0:16          Color: direct index for structure ( temp 4-component vector of float)
+0:16            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16            Constant:
+0:16              0 (const int)
+0:16        move second child to first child ( temp float)
 0:?           'Depth' ( out float FragDepth)
-0:15          Depth: direct index for structure ( temp float)
-0:15            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15            Constant:
-0:15              1 (const int)
-0:15      move second child to first child ( temp int)
+0:16          Depth: direct index for structure ( temp float)
+0:16            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16            Constant:
+0:16              1 (const int)
+0:16      move second child to first child ( temp int)
 0:?         'sampleMask' ( out int SampleMaskIn)
 0:?         'sampleMask' ( temp int)
 0:?   Linker Objects
@@ -98,11 +107,12 @@ Linked fragment stage:
 Shader version: 500
 gl_FragCoord origin is upper left
 0:? Sequence
-0:8  Function Definition: MyFunc(f1;f1;f1; ( temp void)
+0:8  Function Definition: MyFunc(f1;f1;f1;f1; ( temp void)
 0:8    Function Parameters: 
 0:8      'x' ( in float)
 0:8      'y' ( out float)
 0:8      'z' ( inout float)
+0:8      'w' ( inout float)
 0:?     Sequence
 0:9      move second child to first child ( temp float)
 0:9        'y' ( out float)
@@ -114,71 +124,79 @@ gl_FragCoord origin is upper left
 0:11        'x' ( in float)
 0:11        Constant:
 0:11          -1.000000
-0:15  Function Definition: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15    Function Parameters: 
-0:15      'inpos' ( in 4-component vector of float)
-0:15      'sampleMask' ( out int)
+0:12      multiply second child into first child ( temp float)
+0:12        'w' ( inout float)
+0:12        Constant:
+0:12          1.000000
+0:16  Function Definition: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16    Function Parameters: 
+0:16      'inpos' ( in 4-component vector of float)
+0:16      'sampleMask' ( out int)
 0:?     Sequence
-0:18      Sequence
-0:18        move second child to first child ( temp float)
-0:18          'x' ( temp float)
-0:18          Constant:
-0:18            7.000000
-0:18        move second child to first child ( temp float)
-0:18          'z' ( temp float)
-0:18          Constant:
-0:18            3.000000
-0:19      Function Call: MyFunc(f1;f1;f1; ( temp void)
-0:19        'x' ( temp float)
-0:19        'y' ( temp float)
-0:19        'z' ( temp float)
-0:21      move second child to first child ( temp 4-component vector of float)
-0:21        Color: direct index for structure ( temp 4-component vector of float)
-0:21          'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:21          Constant:
-0:21            0 (const int)
-0:?         Construct vec4 ( temp 4-component vector of float)
-0:21          'x' ( temp float)
-0:21          'y' ( temp float)
-0:21          'z' ( temp float)
-0:21          Constant:
-0:21            1.000000
-0:22      move second child to first child ( temp float)
-0:22        Depth: direct index for structure ( temp float)
+0:19      Sequence
+0:19        move second child to first child ( temp float)
+0:19          'x' ( temp float)
+0:19          Constant:
+0:19            7.000000
+0:19        move second child to first child ( temp float)
+0:19          'z' ( temp float)
+0:19          Constant:
+0:19            3.000000
+0:20      Function Call: MyFunc(f1;f1;f1;f1; ( temp void)
+0:20        'x' ( temp float)
+0:20        'y' ( temp float)
+0:20        'z' ( temp float)
+0:20        direct index ( temp float)
+0:20          'inpos' ( in 4-component vector of float)
+0:20          Constant:
+0:20            3 (const int)
+0:22      move second child to first child ( temp 4-component vector of float)
+0:22        Color: direct index for structure ( temp 4-component vector of float)
 0:22          'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
 0:22          Constant:
-0:22            1 (const int)
-0:22        direct index ( temp float)
-0:22          'inpos' ( in 4-component vector of float)
+0:22            0 (const int)
+0:?         Construct vec4 ( temp 4-component vector of float)
+0:22          'x' ( temp float)
+0:22          'y' ( temp float)
+0:22          'z' ( temp float)
 0:22          Constant:
-0:22            3 (const int)
-0:24      Branch: Return with expression
-0:24        'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15  Function Definition: main( ( temp void)
-0:15    Function Parameters: 
+0:22            1.000000
+0:23      move second child to first child ( temp float)
+0:23        Depth: direct index for structure ( temp float)
+0:23          'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:23          Constant:
+0:23            1 (const int)
+0:23        direct index ( temp float)
+0:23          'inpos' ( in 4-component vector of float)
+0:23          Constant:
+0:23            3 (const int)
+0:25      Branch: Return with expression
+0:25        'psout' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16  Function Definition: main( ( temp void)
+0:16    Function Parameters: 
 0:?     Sequence
-0:15      move second child to first child ( temp 4-component vector of float)
+0:16      move second child to first child ( temp 4-component vector of float)
 0:?         'inpos' ( temp 4-component vector of float)
 0:?         'inpos' ( noperspective in 4-component vector of float FragCoord)
-0:15      Sequence
-0:15        move second child to first child ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15          'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15          Function Call: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16      Sequence
+0:16        move second child to first child ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16          'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16          Function Call: @main(vf4;i1; ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
 0:?             'inpos' ( temp 4-component vector of float)
 0:?             'sampleMask' ( temp int)
-0:15        move second child to first child ( temp 4-component vector of float)
+0:16        move second child to first child ( temp 4-component vector of float)
 0:?           'Color' (layout( location=0) out 4-component vector of float)
-0:15          Color: direct index for structure ( temp 4-component vector of float)
-0:15            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15            Constant:
-0:15              0 (const int)
-0:15        move second child to first child ( temp float)
+0:16          Color: direct index for structure ( temp 4-component vector of float)
+0:16            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16            Constant:
+0:16              0 (const int)
+0:16        move second child to first child ( temp float)
 0:?           'Depth' ( out float FragDepth)
-0:15          Depth: direct index for structure ( temp float)
-0:15            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
-0:15            Constant:
-0:15              1 (const int)
-0:15      move second child to first child ( temp int)
+0:16          Depth: direct index for structure ( temp float)
+0:16            'flattenTemp' ( temp structure{ temp 4-component vector of float Color,  temp float Depth})
+0:16            Constant:
+0:16              1 (const int)
+0:16      move second child to first child ( temp int)
 0:?         'sampleMask' ( out int SampleMaskIn)
 0:?         'sampleMask' ( temp int)
 0:?   Linker Objects
@@ -189,144 +207,157 @@ gl_FragCoord origin is upper left
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 80
+// Id's are bound by 88
 
                               Capability Shader
                               Capability SampleRateShading
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 60 70 74 78
+                              EntryPoint Fragment 4  "main" 68 78 82 86
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
-                              Name 12  "MyFunc(f1;f1;f1;"
+                              Name 13  "MyFunc(f1;f1;f1;f1;"
                               Name 9  "x"
                               Name 10  "y"
                               Name 11  "z"
-                              Name 18  "PS_OUTPUT"
-                              MemberName 18(PS_OUTPUT) 0  "Color"
-                              MemberName 18(PS_OUTPUT) 1  "Depth"
-                              Name 22  "@main(vf4;i1;"
-                              Name 20  "inpos"
-                              Name 21  "sampleMask"
-                              Name 27  "x"
-                              Name 29  "z"
-                              Name 31  "y"
-                              Name 32  "param"
-                              Name 34  "param"
-                              Name 35  "param"
-                              Name 41  "psout"
-                              Name 58  "inpos"
-                              Name 60  "inpos"
-                              Name 62  "flattenTemp"
-                              Name 63  "sampleMask"
-                              Name 64  "param"
-                              Name 66  "param"
-                              Name 70  "Color"
-                              Name 74  "Depth"
-                              Name 78  "sampleMask"
-                              Decorate 60(inpos) NoPerspective
-                              Decorate 60(inpos) BuiltIn FragCoord
-                              Decorate 70(Color) Location 0
-                              Decorate 74(Depth) BuiltIn FragDepth
-                              Decorate 78(sampleMask) BuiltIn SampleMask
+                              Name 12  "w"
+                              Name 19  "PS_OUTPUT"
+                              MemberName 19(PS_OUTPUT) 0  "Color"
+                              MemberName 19(PS_OUTPUT) 1  "Depth"
+                              Name 23  "@main(vf4;i1;"
+                              Name 21  "inpos"
+                              Name 22  "sampleMask"
+                              Name 31  "x"
+                              Name 33  "z"
+                              Name 35  "y"
+                              Name 36  "param"
+                              Name 38  "param"
+                              Name 39  "param"
+                              Name 41  "param"
+                              Name 52  "psout"
+                              Name 66  "inpos"
+                              Name 68  "inpos"
+                              Name 70  "flattenTemp"
+                              Name 71  "sampleMask"
+                              Name 72  "param"
+                              Name 74  "param"
+                              Name 78  "Color"
+                              Name 82  "Depth"
+                              Name 86  "sampleMask"
+                              Decorate 68(inpos) NoPerspective
+                              Decorate 68(inpos) BuiltIn FragCoord
+                              Decorate 78(Color) Location 0
+                              Decorate 82(Depth) BuiltIn FragDepth
+                              Decorate 86(sampleMask) BuiltIn SampleMask
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
                7:             TypePointer Function 6(float)
-               8:             TypeFunction 2 7(ptr) 7(ptr) 7(ptr)
-              14:             TypeVector 6(float) 4
-              15:             TypePointer Function 14(fvec4)
-              16:             TypeInt 32 1
-              17:             TypePointer Function 16(int)
-   18(PS_OUTPUT):             TypeStruct 14(fvec4) 6(float)
-              19:             TypeFunction 18(PS_OUTPUT) 15(ptr) 17(ptr)
-              26:    6(float) Constant 3212836864
-              28:    6(float) Constant 1088421888
-              30:    6(float) Constant 1077936128
-              40:             TypePointer Function 18(PS_OUTPUT)
-              42:     16(int) Constant 0
-              46:    6(float) Constant 1065353216
-              49:     16(int) Constant 1
-              50:             TypeInt 32 0
-              51:     50(int) Constant 3
-              59:             TypePointer Input 14(fvec4)
-       60(inpos):     59(ptr) Variable Input
-              69:             TypePointer Output 14(fvec4)
-       70(Color):     69(ptr) Variable Output
-              73:             TypePointer Output 6(float)
-       74(Depth):     73(ptr) Variable Output
-              77:             TypePointer Output 16(int)
-  78(sampleMask):     77(ptr) Variable Output
+               8:             TypeFunction 2 7(ptr) 7(ptr) 7(ptr) 7(ptr)
+              15:             TypeVector 6(float) 4
+              16:             TypePointer Function 15(fvec4)
+              17:             TypeInt 32 1
+              18:             TypePointer Function 17(int)
+   19(PS_OUTPUT):             TypeStruct 15(fvec4) 6(float)
+              20:             TypeFunction 19(PS_OUTPUT) 16(ptr) 18(ptr)
+              27:    6(float) Constant 3212836864
+              28:    6(float) Constant 1065353216
+              32:    6(float) Constant 1088421888
+              34:    6(float) Constant 1077936128
+              42:             TypeInt 32 0
+              43:     42(int) Constant 3
+              51:             TypePointer Function 19(PS_OUTPUT)
+              53:     17(int) Constant 0
+              59:     17(int) Constant 1
+              67:             TypePointer Input 15(fvec4)
+       68(inpos):     67(ptr) Variable Input
+              77:             TypePointer Output 15(fvec4)
+       78(Color):     77(ptr) Variable Output
+              81:             TypePointer Output 6(float)
+       82(Depth):     81(ptr) Variable Output
+              85:             TypePointer Output 17(int)
+  86(sampleMask):     85(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-       58(inpos):     15(ptr) Variable Function
- 62(flattenTemp):     40(ptr) Variable Function
-  63(sampleMask):     17(ptr) Variable Function
-       64(param):     15(ptr) Variable Function
-       66(param):     17(ptr) Variable Function
-              61:   14(fvec4) Load 60(inpos)
-                              Store 58(inpos) 61
-              65:   14(fvec4) Load 58(inpos)
-                              Store 64(param) 65
-              67:18(PS_OUTPUT) FunctionCall 22(@main(vf4;i1;) 64(param) 66(param)
-              68:     16(int) Load 66(param)
-                              Store 63(sampleMask) 68
-                              Store 62(flattenTemp) 67
-              71:     15(ptr) AccessChain 62(flattenTemp) 42
-              72:   14(fvec4) Load 71
-                              Store 70(Color) 72
-              75:      7(ptr) AccessChain 62(flattenTemp) 49
-              76:    6(float) Load 75
-                              Store 74(Depth) 76
-              79:     16(int) Load 63(sampleMask)
-                              Store 78(sampleMask) 79
+       66(inpos):     16(ptr) Variable Function
+ 70(flattenTemp):     51(ptr) Variable Function
+  71(sampleMask):     18(ptr) Variable Function
+       72(param):     16(ptr) Variable Function
+       74(param):     18(ptr) Variable Function
+              69:   15(fvec4) Load 68(inpos)
+                              Store 66(inpos) 69
+              73:   15(fvec4) Load 66(inpos)
+                              Store 72(param) 73
+              75:19(PS_OUTPUT) FunctionCall 23(@main(vf4;i1;) 72(param) 74(param)
+              76:     17(int) Load 74(param)
+                              Store 71(sampleMask) 76
+                              Store 70(flattenTemp) 75
+              79:     16(ptr) AccessChain 70(flattenTemp) 53
+              80:   15(fvec4) Load 79
+                              Store 78(Color) 80
+              83:      7(ptr) AccessChain 70(flattenTemp) 59
+              84:    6(float) Load 83
+                              Store 82(Depth) 84
+              87:     17(int) Load 71(sampleMask)
+                              Store 86(sampleMask) 87
                               Return
                               FunctionEnd
-12(MyFunc(f1;f1;f1;):           2 Function None 8
+13(MyFunc(f1;f1;f1;f1;):           2 Function None 8
             9(x):      7(ptr) FunctionParameter
            10(y):      7(ptr) FunctionParameter
            11(z):      7(ptr) FunctionParameter
-              13:             Label
-              24:    6(float) Load 9(x)
-                              Store 10(y) 24
-              25:    6(float) Load 10(y)
-                              Store 11(z) 25
-                              Store 9(x) 26
+           12(w):      7(ptr) FunctionParameter
+              14:             Label
+              25:    6(float) Load 9(x)
+                              Store 10(y) 25
+              26:    6(float) Load 10(y)
+                              Store 11(z) 26
+                              Store 9(x) 27
+              29:    6(float) Load 12(w)
+              30:    6(float) FMul 29 28
+                              Store 12(w) 30
                               Return
                               FunctionEnd
-22(@main(vf4;i1;):18(PS_OUTPUT) Function None 19
-       20(inpos):     15(ptr) FunctionParameter
-  21(sampleMask):     17(ptr) FunctionParameter
-              23:             Label
-           27(x):      7(ptr) Variable Function
-           29(z):      7(ptr) Variable Function
-           31(y):      7(ptr) Variable Function
-       32(param):      7(ptr) Variable Function
-       34(param):      7(ptr) Variable Function
-       35(param):      7(ptr) Variable Function
-       41(psout):     40(ptr) Variable Function
-                              Store 27(x) 28
-                              Store 29(z) 30
-              33:    6(float) Load 27(x)
-                              Store 32(param) 33
-              36:    6(float) Load 29(z)
-                              Store 35(param) 36
-              37:           2 FunctionCall 12(MyFunc(f1;f1;f1;) 32(param) 34(param) 35(param)
-              38:    6(float) Load 34(param)
-                              Store 31(y) 38
-              39:    6(float) Load 35(param)
-                              Store 29(z) 39
-              43:    6(float) Load 27(x)
-              44:    6(float) Load 31(y)
-              45:    6(float) Load 29(z)
-              47:   14(fvec4) CompositeConstruct 43 44 45 46
-              48:     15(ptr) AccessChain 41(psout) 42
-                              Store 48 47
-              52:      7(ptr) AccessChain 20(inpos) 51
-              53:    6(float) Load 52
-              54:      7(ptr) AccessChain 41(psout) 49
-                              Store 54 53
-              55:18(PS_OUTPUT) Load 41(psout)
-                              ReturnValue 55
+23(@main(vf4;i1;):19(PS_OUTPUT) Function None 20
+       21(inpos):     16(ptr) FunctionParameter
+  22(sampleMask):     18(ptr) FunctionParameter
+              24:             Label
+           31(x):      7(ptr) Variable Function
+           33(z):      7(ptr) Variable Function
+           35(y):      7(ptr) Variable Function
+       36(param):      7(ptr) Variable Function
+       38(param):      7(ptr) Variable Function
+       39(param):      7(ptr) Variable Function
+       41(param):      7(ptr) Variable Function
+       52(psout):     51(ptr) Variable Function
+                              Store 31(x) 32
+                              Store 33(z) 34
+              37:    6(float) Load 31(x)
+                              Store 36(param) 37
+              40:    6(float) Load 33(z)
+                              Store 39(param) 40
+              44:      7(ptr) AccessChain 21(inpos) 43
+              45:    6(float) Load 44
+                              Store 41(param) 45
+              46:           2 FunctionCall 13(MyFunc(f1;f1;f1;f1;) 36(param) 38(param) 39(param) 41(param)
+              47:    6(float) Load 38(param)
+                              Store 35(y) 47
+              48:    6(float) Load 39(param)
+                              Store 33(z) 48
+              49:    6(float) Load 41(param)
+              50:      7(ptr) AccessChain 21(inpos) 43
+                              Store 50 49
+              54:    6(float) Load 31(x)
+              55:    6(float) Load 35(y)
+              56:    6(float) Load 33(z)
+              57:   15(fvec4) CompositeConstruct 54 55 56 28
+              58:     16(ptr) AccessChain 52(psout) 53
+                              Store 58 57
+              60:      7(ptr) AccessChain 21(inpos) 43
+              61:    6(float) Load 60
+              62:      7(ptr) AccessChain 52(psout) 59
+                              Store 62 61
+              63:19(PS_OUTPUT) Load 52(psout)
+                              ReturnValue 63
                               FunctionEnd

+ 40 - 32
3rdparty/glslang/Test/baseResults/hlsl.intrinsics.double.frag.out

@@ -35,28 +35,28 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:5      move second child to first child ( temp double)
 0:?         'inDV1a' ( temp double)
-0:?         'inDV1a' (layout( location=0) in double)
+0:?         'inDV1a' (layout( location=0) flat in double)
 0:5      move second child to first child ( temp double)
 0:?         'inDV1b' ( temp double)
-0:?         'inDV1b' (layout( location=1) in double)
+0:?         'inDV1b' (layout( location=1) flat in double)
 0:5      move second child to first child ( temp double)
 0:?         'inDV1c' ( temp double)
-0:?         'inDV1c' (layout( location=2) in double)
+0:?         'inDV1c' (layout( location=2) flat in double)
 0:5      move second child to first child ( temp 2-component vector of double)
 0:?         'inDV2' ( temp 2-component vector of double)
-0:?         'inDV2' (layout( location=3) in 2-component vector of double)
+0:?         'inDV2' (layout( location=3) flat in 2-component vector of double)
 0:5      move second child to first child ( temp 3-component vector of double)
 0:?         'inDV3' ( temp 3-component vector of double)
-0:?         'inDV3' (layout( location=4) in 3-component vector of double)
+0:?         'inDV3' (layout( location=4) flat in 3-component vector of double)
 0:5      move second child to first child ( temp 4-component vector of double)
 0:?         'inDV4' ( temp 4-component vector of double)
-0:?         'inDV4' (layout( location=6) in 4-component vector of double)
+0:?         'inDV4' (layout( location=6) flat in 4-component vector of double)
 0:5      move second child to first child ( temp uint)
 0:?         'inU1a' ( temp uint)
-0:?         'inU1a' (layout( location=8) in uint)
+0:?         'inU1a' (layout( location=8) flat in uint)
 0:5      move second child to first child ( temp uint)
 0:?         'inU1b' ( temp uint)
-0:?         'inU1b' (layout( location=9) in uint)
+0:?         'inU1b' (layout( location=9) flat in uint)
 0:5      move second child to first child ( temp float)
 0:?         '@entryPointOutput' (layout( location=0) out float)
 0:5        Function Call: @PixelShaderFunction(d1;d1;d1;vd2;vd3;vd4;u1;u1; ( temp float)
@@ -70,14 +70,14 @@ gl_FragCoord origin is upper left
 0:?           'inU1b' ( temp uint)
 0:?   Linker Objects
 0:?     '@entryPointOutput' (layout( location=0) out float)
-0:?     'inDV1a' (layout( location=0) in double)
-0:?     'inDV1b' (layout( location=1) in double)
-0:?     'inDV1c' (layout( location=2) in double)
-0:?     'inDV2' (layout( location=3) in 2-component vector of double)
-0:?     'inDV3' (layout( location=4) in 3-component vector of double)
-0:?     'inDV4' (layout( location=6) in 4-component vector of double)
-0:?     'inU1a' (layout( location=8) in uint)
-0:?     'inU1b' (layout( location=9) in uint)
+0:?     'inDV1a' (layout( location=0) flat in double)
+0:?     'inDV1b' (layout( location=1) flat in double)
+0:?     'inDV1c' (layout( location=2) flat in double)
+0:?     'inDV2' (layout( location=3) flat in 2-component vector of double)
+0:?     'inDV3' (layout( location=4) flat in 3-component vector of double)
+0:?     'inDV4' (layout( location=6) flat in 4-component vector of double)
+0:?     'inU1a' (layout( location=8) flat in uint)
+0:?     'inU1b' (layout( location=9) flat in uint)
 
 
 Linked fragment stage:
@@ -119,28 +119,28 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:5      move second child to first child ( temp double)
 0:?         'inDV1a' ( temp double)
-0:?         'inDV1a' (layout( location=0) in double)
+0:?         'inDV1a' (layout( location=0) flat in double)
 0:5      move second child to first child ( temp double)
 0:?         'inDV1b' ( temp double)
-0:?         'inDV1b' (layout( location=1) in double)
+0:?         'inDV1b' (layout( location=1) flat in double)
 0:5      move second child to first child ( temp double)
 0:?         'inDV1c' ( temp double)
-0:?         'inDV1c' (layout( location=2) in double)
+0:?         'inDV1c' (layout( location=2) flat in double)
 0:5      move second child to first child ( temp 2-component vector of double)
 0:?         'inDV2' ( temp 2-component vector of double)
-0:?         'inDV2' (layout( location=3) in 2-component vector of double)
+0:?         'inDV2' (layout( location=3) flat in 2-component vector of double)
 0:5      move second child to first child ( temp 3-component vector of double)
 0:?         'inDV3' ( temp 3-component vector of double)
-0:?         'inDV3' (layout( location=4) in 3-component vector of double)
+0:?         'inDV3' (layout( location=4) flat in 3-component vector of double)
 0:5      move second child to first child ( temp 4-component vector of double)
 0:?         'inDV4' ( temp 4-component vector of double)
-0:?         'inDV4' (layout( location=6) in 4-component vector of double)
+0:?         'inDV4' (layout( location=6) flat in 4-component vector of double)
 0:5      move second child to first child ( temp uint)
 0:?         'inU1a' ( temp uint)
-0:?         'inU1a' (layout( location=8) in uint)
+0:?         'inU1a' (layout( location=8) flat in uint)
 0:5      move second child to first child ( temp uint)
 0:?         'inU1b' ( temp uint)
-0:?         'inU1b' (layout( location=9) in uint)
+0:?         'inU1b' (layout( location=9) flat in uint)
 0:5      move second child to first child ( temp float)
 0:?         '@entryPointOutput' (layout( location=0) out float)
 0:5        Function Call: @PixelShaderFunction(d1;d1;d1;vd2;vd3;vd4;u1;u1; ( temp float)
@@ -154,14 +154,14 @@ gl_FragCoord origin is upper left
 0:?           'inU1b' ( temp uint)
 0:?   Linker Objects
 0:?     '@entryPointOutput' (layout( location=0) out float)
-0:?     'inDV1a' (layout( location=0) in double)
-0:?     'inDV1b' (layout( location=1) in double)
-0:?     'inDV1c' (layout( location=2) in double)
-0:?     'inDV2' (layout( location=3) in 2-component vector of double)
-0:?     'inDV3' (layout( location=4) in 3-component vector of double)
-0:?     'inDV4' (layout( location=6) in 4-component vector of double)
-0:?     'inU1a' (layout( location=8) in uint)
-0:?     'inU1b' (layout( location=9) in uint)
+0:?     'inDV1a' (layout( location=0) flat in double)
+0:?     'inDV1b' (layout( location=1) flat in double)
+0:?     'inDV1c' (layout( location=2) flat in double)
+0:?     'inDV2' (layout( location=3) flat in 2-component vector of double)
+0:?     'inDV3' (layout( location=4) flat in 3-component vector of double)
+0:?     'inDV4' (layout( location=6) flat in 4-component vector of double)
+0:?     'inU1a' (layout( location=8) flat in uint)
+0:?     'inU1b' (layout( location=9) flat in uint)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -211,13 +211,21 @@ gl_FragCoord origin is upper left
                               Name 83  "param"
                               Name 85  "param"
                               Name 87  "param"
+                              Decorate 44(inDV1a) Flat
                               Decorate 44(inDV1a) Location 0
+                              Decorate 47(inDV1b) Flat
                               Decorate 47(inDV1b) Location 1
+                              Decorate 50(inDV1c) Flat
                               Decorate 50(inDV1c) Location 2
+                              Decorate 54(inDV2) Flat
                               Decorate 54(inDV2) Location 3
+                              Decorate 58(inDV3) Flat
                               Decorate 58(inDV3) Location 4
+                              Decorate 62(inDV4) Flat
                               Decorate 62(inDV4) Location 6
+                              Decorate 66(inU1a) Flat
                               Decorate 66(inU1a) Location 8
+                              Decorate 69(inU1b) Flat
                               Decorate 69(inU1b) Location 9
                               Decorate 72(@entryPointOutput) Location 0
                2:             TypeVoid

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.intrinsics.evalfns.frag.out

@@ -60,7 +60,7 @@ gl_FragCoord origin is upper left
 0:?         'inF4' (layout( location=3) in 4-component vector of float)
 0:3      move second child to first child ( temp 2-component vector of int)
 0:?         'inI2' ( temp 2-component vector of int)
-0:?         'inI2' (layout( location=4) in 2-component vector of int)
+0:?         'inI2' (layout( location=4) flat in 2-component vector of int)
 0:3      Function Call: @main(f1;vf2;vf3;vf4;vi2; ( temp void)
 0:?         'inF1' ( temp float)
 0:?         'inF2' ( temp 2-component vector of float)
@@ -72,7 +72,7 @@ gl_FragCoord origin is upper left
 0:?     'inF2' (layout( location=1) in 2-component vector of float)
 0:?     'inF3' (layout( location=2) in 3-component vector of float)
 0:?     'inF4' (layout( location=3) in 4-component vector of float)
-0:?     'inI2' (layout( location=4) in 2-component vector of int)
+0:?     'inI2' (layout( location=4) flat in 2-component vector of int)
 
 
 Linked fragment stage:
@@ -139,7 +139,7 @@ gl_FragCoord origin is upper left
 0:?         'inF4' (layout( location=3) in 4-component vector of float)
 0:3      move second child to first child ( temp 2-component vector of int)
 0:?         'inI2' ( temp 2-component vector of int)
-0:?         'inI2' (layout( location=4) in 2-component vector of int)
+0:?         'inI2' (layout( location=4) flat in 2-component vector of int)
 0:3      Function Call: @main(f1;vf2;vf3;vf4;vi2; ( temp void)
 0:?         'inF1' ( temp float)
 0:?         'inF2' ( temp 2-component vector of float)
@@ -151,7 +151,7 @@ gl_FragCoord origin is upper left
 0:?     'inF2' (layout( location=1) in 2-component vector of float)
 0:?     'inF3' (layout( location=2) in 3-component vector of float)
 0:?     'inF4' (layout( location=3) in 4-component vector of float)
-0:?     'inI2' (layout( location=4) in 2-component vector of int)
+0:?     'inI2' (layout( location=4) flat in 2-component vector of int)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -190,6 +190,7 @@ gl_FragCoord origin is upper left
                               Decorate 55(inF2) Location 1
                               Decorate 59(inF3) Location 2
                               Decorate 63(inF4) Location 3
+                              Decorate 67(inI2) Flat
                               Decorate 67(inI2) Location 4
                2:             TypeVoid
                3:             TypeFunction 2

+ 4 - 4
3rdparty/glslang/Test/baseResults/hlsl.intrinsics.negative.frag.out

@@ -374,7 +374,7 @@ ERROR: node is still EOpNull!
 0:?         'inF2' (layout( location=2) in 4-component vector of float)
 0:80      move second child to first child ( temp 4-component vector of int)
 0:?         'inI0' ( temp 4-component vector of int)
-0:?         'inI0' (layout( location=3) in 4-component vector of int)
+0:?         'inI0' (layout( location=3) flat in 4-component vector of int)
 0:80      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:80        Function Call: @PixelShaderFunction(vf4;vf4;vf4;vi4; ( temp 4-component vector of float)
@@ -518,7 +518,7 @@ ERROR: node is still EOpNull!
 0:?     'inF0' (layout( location=0) in 4-component vector of float)
 0:?     'inF1' (layout( location=1) in 4-component vector of float)
 0:?     'inF2' (layout( location=2) in 4-component vector of float)
-0:?     'inI0' (layout( location=3) in 4-component vector of int)
+0:?     'inI0' (layout( location=3) flat in 4-component vector of int)
 
 
 Linked fragment stage:
@@ -837,7 +837,7 @@ ERROR: node is still EOpNull!
 0:?         'inF2' (layout( location=2) in 4-component vector of float)
 0:80      move second child to first child ( temp 4-component vector of int)
 0:?         'inI0' ( temp 4-component vector of int)
-0:?         'inI0' (layout( location=3) in 4-component vector of int)
+0:?         'inI0' (layout( location=3) flat in 4-component vector of int)
 0:80      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:80        Function Call: @PixelShaderFunction(vf4;vf4;vf4;vi4; ( temp 4-component vector of float)
@@ -981,6 +981,6 @@ ERROR: node is still EOpNull!
 0:?     'inF0' (layout( location=0) in 4-component vector of float)
 0:?     'inF1' (layout( location=1) in 4-component vector of float)
 0:?     'inF2' (layout( location=2) in 4-component vector of float)
-0:?     'inI0' (layout( location=3) in 4-component vector of int)
+0:?     'inI0' (layout( location=3) flat in 4-component vector of int)
 
 SPIR-V is not generated for failed compile or link

+ 20 - 16
3rdparty/glslang/Test/baseResults/hlsl.precedence2.frag.out

@@ -30,16 +30,16 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:7      move second child to first child ( temp int)
 0:?         'a1' ( temp int)
-0:?         'a1' (layout( location=0) in int)
+0:?         'a1' (layout( location=0) flat in int)
 0:7      move second child to first child ( temp int)
 0:?         'a2' ( temp int)
-0:?         'a2' (layout( location=1) in int)
+0:?         'a2' (layout( location=1) flat in int)
 0:7      move second child to first child ( temp int)
 0:?         'a3' ( temp int)
-0:?         'a3' (layout( location=2) in int)
+0:?         'a3' (layout( location=2) flat in int)
 0:7      move second child to first child ( temp int)
 0:?         'a4' ( temp int)
-0:?         'a4' (layout( location=3) in int)
+0:?         'a4' (layout( location=3) flat in int)
 0:7      move second child to first child ( temp int)
 0:?         '@entryPointOutput' (layout( location=0) out int)
 0:7        Function Call: @PixelShaderFunction(i1;i1;i1;i1; ( temp int)
@@ -49,10 +49,10 @@ gl_FragCoord origin is upper left
 0:?           'a4' ( temp int)
 0:?   Linker Objects
 0:?     '@entryPointOutput' (layout( location=0) out int)
-0:?     'a1' (layout( location=0) in int)
-0:?     'a2' (layout( location=1) in int)
-0:?     'a3' (layout( location=2) in int)
-0:?     'a4' (layout( location=3) in int)
+0:?     'a1' (layout( location=0) flat in int)
+0:?     'a2' (layout( location=1) flat in int)
+0:?     'a3' (layout( location=2) flat in int)
+0:?     'a4' (layout( location=3) flat in int)
 
 
 Linked fragment stage:
@@ -89,16 +89,16 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:7      move second child to first child ( temp int)
 0:?         'a1' ( temp int)
-0:?         'a1' (layout( location=0) in int)
+0:?         'a1' (layout( location=0) flat in int)
 0:7      move second child to first child ( temp int)
 0:?         'a2' ( temp int)
-0:?         'a2' (layout( location=1) in int)
+0:?         'a2' (layout( location=1) flat in int)
 0:7      move second child to first child ( temp int)
 0:?         'a3' ( temp int)
-0:?         'a3' (layout( location=2) in int)
+0:?         'a3' (layout( location=2) flat in int)
 0:7      move second child to first child ( temp int)
 0:?         'a4' ( temp int)
-0:?         'a4' (layout( location=3) in int)
+0:?         'a4' (layout( location=3) flat in int)
 0:7      move second child to first child ( temp int)
 0:?         '@entryPointOutput' (layout( location=0) out int)
 0:7        Function Call: @PixelShaderFunction(i1;i1;i1;i1; ( temp int)
@@ -108,10 +108,10 @@ gl_FragCoord origin is upper left
 0:?           'a4' ( temp int)
 0:?   Linker Objects
 0:?     '@entryPointOutput' (layout( location=0) out int)
-0:?     'a1' (layout( location=0) in int)
-0:?     'a2' (layout( location=1) in int)
-0:?     'a3' (layout( location=2) in int)
-0:?     'a4' (layout( location=3) in int)
+0:?     'a1' (layout( location=0) flat in int)
+0:?     'a2' (layout( location=1) flat in int)
+0:?     'a3' (layout( location=2) flat in int)
+0:?     'a4' (layout( location=3) flat in int)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -142,9 +142,13 @@ gl_FragCoord origin is upper left
                               Name 49  "param"
                               Name 51  "param"
                               Name 53  "param"
+                              Decorate 34(a1) Flat
                               Decorate 34(a1) Location 0
+                              Decorate 37(a2) Flat
                               Decorate 37(a2) Location 1
+                              Decorate 40(a3) Flat
                               Decorate 40(a3) Location 2
+                              Decorate 43(a4) Flat
                               Decorate 43(a4) Location 3
                               Decorate 46(@entryPointOutput) Location 0
                2:             TypeVoid

+ 12 - 20
3rdparty/glslang/Test/baseResults/hlsl.reflection.vert.out

@@ -2,26 +2,19 @@ hlsl.reflection.vert
 Uniform reflection:
 anonMember3: offset 80, type 8b52, size 1, index 0, binding -1
 s.a: offset 0, type 1404, size 1, index 1, binding -1
-ablock.scalar: offset 12, type 1404, size 1, index 2, binding -1
 m23: offset 16, type 8b67, size 1, index 0, binding -1
 scalarAfterm23: offset 48, type 1404, size 1, index 0, binding -1
-c_m23: offset 16, type 8b67, size 1, index 3, binding -1
-c_scalarAfterm23: offset 48, type 1404, size 1, index 3, binding -1
+c_m23: offset 16, type 8b67, size 1, index 2, binding -1
+c_scalarAfterm23: offset 48, type 1404, size 1, index 2, binding -1
 scalarBeforeArray: offset 96, type 1404, size 1, index 0, binding -1
 floatArray: offset 112, type 1406, size 5, index 0, binding -1
 scalarAfterArray: offset 192, type 1404, size 1, index 0, binding -1
-ablock.memfloat2: offset 48, type 8b50, size 1, index 2, binding -1
-ablock.memf1: offset 56, type 1406, size 1, index 2, binding -1
-ablock.memf2: offset 60, type 8b56, size 1, index 2, binding -1
-ablock.memf3: offset 64, type 1404, size 1, index 2, binding -1
-ablock.memfloat2a: offset 72, type 8b50, size 1, index 2, binding -1
-ablock.m22: offset 80, type 8b5a, size 7, index 2, binding -1
+m22: offset 208, type 8b5a, size 9, index 0, binding -1
 dm22: offset 32, type 8b5a, size 4, index 1, binding -1
-m22: offset 208, type 8b5a, size 3, index 0, binding -1
-nest.foo.n1.a: offset 0, type 1406, size 1, index 4, binding -1
-nest.foo.n2.b: offset 16, type 1406, size 1, index 4, binding -1
-nest.foo.n2.c: offset 20, type 1406, size 1, index 4, binding -1
-nest.foo.n2.d: offset 24, type 1406, size 1, index 4, binding -1
+foo.n1.a: offset 0, type 1406, size 1, index 3, binding -1
+foo.n2.b: offset 16, type 1406, size 1, index 3, binding -1
+foo.n2.c: offset 20, type 1406, size 1, index 3, binding -1
+foo.n2.d: offset 24, type 1406, size 1, index 3, binding -1
 deepA.d2.d1[2].va: offset 376, type 8b50, size 2, index 1, binding -1
 deepB.d2.d1.va: offset 984, type 8b50, size 2, index 1, binding -1
 deepB.d2.d1[0].va: offset 984, type 8b50, size 2, index 1, binding -1
@@ -61,19 +54,18 @@ deepD[1].d2.d1[2].b: offset 2480, type 8b56, size 1, index 1, binding -1
 deepD[1].d2.d1[3].va: offset 2480, type 8b50, size 3, index 1, binding -1
 deepD[1].d2.d1[3].b: offset 2480, type 8b56, size 1, index 1, binding -1
 deepD[1].v3: offset 2480, type 8b54, size 1, index 1, binding -1
-arrBl.foo: offset 0, type 1406, size 1, index 5, binding -1
-arrBl2.foo: offset 0, type 1406, size 1, index 6, binding -1
+foo1: offset 0, type 1406, size 1, index 4, binding -1
+foo2: offset 0, type 1406, size 1, index 5, binding -1
 anonMember1: offset 0, type 8b51, size 1, index 0, binding -1
 uf1: offset 16, type 1406, size 1, index 1, binding -1
 
 Uniform block reflection:
 nameless: offset -1, type ffffffff, size 496, index -1, binding -1
 $Global: offset -1, type ffffffff, size 3088, index -1, binding -1
-ablock: offset -1, type ffffffff, size 304, index -1, binding -1
 c_nameless: offset -1, type ffffffff, size 96, index -1, binding -1
-nest: offset -1, type ffffffff, size 32, index -1, binding -1
-arrBl: offset -1, type ffffffff, size 4, index -1, binding -1
-arrBl2: offset -1, type ffffffff, size 4, index -1, binding -1
+nested: offset -1, type ffffffff, size 32, index -1, binding -1
+abl: offset -1, type ffffffff, size 4, index -1, binding -1
+abl2: offset -1, type ffffffff, size 4, index -1, binding -1
 
 Vertex attribute reflection:
 attributeFloat: offset 0, type 1406, size 0, index 0, binding -1

+ 100 - 79
3rdparty/glslang/Test/baseResults/hlsl.semantic.geom.out

@@ -24,18 +24,26 @@ output primitive = line_strip
 0:12          Function Call: @main(u1[3];struct-S-f1-f1-u1-u1-i11; ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
 0:?             'VertexID' ( temp 3-element array of uint)
 0:?             'OutputStream' ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
-0:12        move second child to first child ( temp float)
-0:?           'OutputStream_clip0' ( out float ClipDistance)
-0:12          clip0: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
-0:12            Constant:
-0:12              0 (const int)
-0:12        move second child to first child ( temp float)
-0:?           'OutputStream_cull0' ( out float CullDistance)
-0:12          cull0: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
-0:12            Constant:
-0:12              1 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               'OutputStream_clip0' ( out 1-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            clip0: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
+0:12              Constant:
+0:12                0 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               'OutputStream_cull0' ( out 1-element array of float CullDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            cull0: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
+0:12              Constant:
+0:12                1 (const int)
 0:12        move second child to first child ( temp uint)
 0:?           'OutputStream_vpai' ( out uint ViewportIndex)
 0:12          vpai: direct index for structure ( temp uint)
@@ -92,18 +100,26 @@ output primitive = line_strip
 0:12          Function Call: @main(u1[3];struct-S-f1-f1-u1-u1-i11; ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
 0:?             'VertexID' ( temp 3-element array of uint)
 0:?             'OutputStream' ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
-0:12        move second child to first child ( temp float)
-0:?           'OutputStream_clip0' ( out float ClipDistance)
-0:12          clip0: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
-0:12            Constant:
-0:12              0 (const int)
-0:12        move second child to first child ( temp float)
-0:?           'OutputStream_cull0' ( out float CullDistance)
-0:12          cull0: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
-0:12            Constant:
-0:12              1 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               'OutputStream_clip0' ( out 1-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            clip0: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
+0:12              Constant:
+0:12                0 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               'OutputStream_cull0' ( out 1-element array of float CullDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            cull0: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip0,  temp float cull0,  temp uint vpai,  temp uint rtai,  temp int ii})
+0:12              Constant:
+0:12                1 (const int)
 0:12        move second child to first child ( temp uint)
 0:?           'OutputStream_vpai' ( out uint ViewportIndex)
 0:12          vpai: direct index for structure ( temp uint)
@@ -133,7 +149,7 @@ output primitive = line_strip
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 66
+// Id's are bound by 71
 
                               Capability Geometry
                               Capability ClipDistance
@@ -141,7 +157,7 @@ output primitive = line_strip
                               Capability MultiViewport
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Geometry 4  "main" 25 35 40 45 50 56 65
+                              EntryPoint Geometry 4  "main" 25 37 44 50 55 61 70
                               ExecutionMode 4 Triangles
                               ExecutionMode 4 Invocations 1
                               ExecutionMode 4 OutputLineStrip
@@ -164,23 +180,23 @@ output primitive = line_strip
                               Name 28  "OutputStream"
                               Name 29  "param"
                               Name 31  "param"
-                              Name 35  "OutputStream_clip0"
-                              Name 40  "OutputStream_cull0"
-                              Name 45  "OutputStream_vpai"
-                              Name 50  "OutputStream_rtai"
-                              Name 54  "S"
-                              MemberName 54(S) 0  "ii"
-                              Name 56  "@entryPointOutput"
-                              Name 63  "S"
-                              MemberName 63(S) 0  "ii"
-                              Name 65  "OutputStream"
+                              Name 37  "OutputStream_clip0"
+                              Name 44  "OutputStream_cull0"
+                              Name 50  "OutputStream_vpai"
+                              Name 55  "OutputStream_rtai"
+                              Name 59  "S"
+                              MemberName 59(S) 0  "ii"
+                              Name 61  "@entryPointOutput"
+                              Name 68  "S"
+                              MemberName 68(S) 0  "ii"
+                              Name 70  "OutputStream"
                               Decorate 25(VertexID) Location 0
-                              Decorate 35(OutputStream_clip0) BuiltIn ClipDistance
-                              Decorate 40(OutputStream_cull0) BuiltIn CullDistance
-                              Decorate 45(OutputStream_vpai) BuiltIn ViewportIndex
-                              Decorate 50(OutputStream_rtai) BuiltIn Layer
-                              Decorate 56(@entryPointOutput) Location 0
-                              Decorate 65(OutputStream) Location 1
+                              Decorate 37(OutputStream_clip0) BuiltIn ClipDistance
+                              Decorate 44(OutputStream_cull0) BuiltIn CullDistance
+                              Decorate 50(OutputStream_vpai) BuiltIn ViewportIndex
+                              Decorate 55(OutputStream_rtai) BuiltIn Layer
+                              Decorate 61(@entryPointOutput) Location 0
+                              Decorate 70(OutputStream) Location 1
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 0
@@ -194,27 +210,30 @@ output primitive = line_strip
               14:             TypeFunction 12(S) 9(ptr) 13(ptr)
               24:             TypePointer Input 8
     25(VertexID):     24(ptr) Variable Input
-              34:             TypePointer Output 10(float)
-35(OutputStream_clip0):     34(ptr) Variable Output
-              36:     11(int) Constant 0
-              37:             TypePointer Function 10(float)
-40(OutputStream_cull0):     34(ptr) Variable Output
-              41:     11(int) Constant 1
-              44:             TypePointer Output 6(int)
-45(OutputStream_vpai):     44(ptr) Variable Output
-              46:     11(int) Constant 2
-              47:             TypePointer Function 6(int)
-50(OutputStream_rtai):     44(ptr) Variable Output
-              51:     11(int) Constant 3
-           54(S):             TypeStruct 11(int)
-              55:             TypePointer Output 54(S)
-56(@entryPointOutput):     55(ptr) Variable Output
-              57:     11(int) Constant 4
-              58:             TypePointer Function 11(int)
-              61:             TypePointer Output 11(int)
-           63(S):             TypeStruct 11(int)
-              64:             TypePointer Output 63(S)
-65(OutputStream):     64(ptr) Variable Output
+              34:      6(int) Constant 1
+              35:             TypeArray 10(float) 34
+              36:             TypePointer Output 35
+37(OutputStream_clip0):     36(ptr) Variable Output
+              38:     11(int) Constant 0
+              39:             TypePointer Function 10(float)
+              42:             TypePointer Output 10(float)
+44(OutputStream_cull0):     36(ptr) Variable Output
+              45:     11(int) Constant 1
+              49:             TypePointer Output 6(int)
+50(OutputStream_vpai):     49(ptr) Variable Output
+              51:     11(int) Constant 2
+              52:             TypePointer Function 6(int)
+55(OutputStream_rtai):     49(ptr) Variable Output
+              56:     11(int) Constant 3
+           59(S):             TypeStruct 11(int)
+              60:             TypePointer Output 59(S)
+61(@entryPointOutput):     60(ptr) Variable Output
+              62:     11(int) Constant 4
+              63:             TypePointer Function 11(int)
+              66:             TypePointer Output 11(int)
+           68(S):             TypeStruct 11(int)
+              69:             TypePointer Output 68(S)
+70(OutputStream):     69(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
     23(VertexID):      9(ptr) Variable Function
@@ -230,22 +249,24 @@ output primitive = line_strip
               33:       12(S) Load 31(param)
                               Store 28(OutputStream) 33
                               Store 27(flattenTemp) 32
-              38:     37(ptr) AccessChain 27(flattenTemp) 36
-              39:   10(float) Load 38
-                              Store 35(OutputStream_clip0) 39
-              42:     37(ptr) AccessChain 27(flattenTemp) 41
-              43:   10(float) Load 42
-                              Store 40(OutputStream_cull0) 43
-              48:     47(ptr) AccessChain 27(flattenTemp) 46
-              49:      6(int) Load 48
-                              Store 45(OutputStream_vpai) 49
-              52:     47(ptr) AccessChain 27(flattenTemp) 51
-              53:      6(int) Load 52
-                              Store 50(OutputStream_rtai) 53
-              59:     58(ptr) AccessChain 27(flattenTemp) 57
-              60:     11(int) Load 59
-              62:     61(ptr) AccessChain 56(@entryPointOutput) 36
-                              Store 62 60
+              40:     39(ptr) AccessChain 27(flattenTemp) 38
+              41:   10(float) Load 40
+              43:     42(ptr) AccessChain 37(OutputStream_clip0) 38
+                              Store 43 41
+              46:     39(ptr) AccessChain 27(flattenTemp) 45
+              47:   10(float) Load 46
+              48:     42(ptr) AccessChain 44(OutputStream_cull0) 38
+                              Store 48 47
+              53:     52(ptr) AccessChain 27(flattenTemp) 51
+              54:      6(int) Load 53
+                              Store 50(OutputStream_vpai) 54
+              57:     52(ptr) AccessChain 27(flattenTemp) 56
+              58:      6(int) Load 57
+                              Store 55(OutputStream_rtai) 58
+              64:     63(ptr) AccessChain 27(flattenTemp) 62
+              65:     11(int) Load 64
+              67:     66(ptr) AccessChain 61(@entryPointOutput) 38
+                              Store 67 65
                               Return
                               FunctionEnd
 17(@main(u1[3];struct-S-f1-f1-u1-u1-i11;):       12(S) Function None 14

+ 168 - 110
3rdparty/glslang/Test/baseResults/hlsl.semantic.vert.out

@@ -58,42 +58,66 @@ Shader version: 500
 0:12          'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
 0:12          Function Call: @main(struct-S-f1-f1-f1-f1-f1-f1-i11; ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
 0:?             'ins' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_clip7' ( out float ClipDistance)
-0:12          clip: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              0 (const int)
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_clip7' ( out float ClipDistance)
-0:12          clip0: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              1 (const int)
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_clip7' ( out float ClipDistance)
-0:12          clip7: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              2 (const int)
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_cull5' ( out float CullDistance)
-0:12          cull: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              3 (const int)
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_cull5' ( out float CullDistance)
-0:12          cull2: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              4 (const int)
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_cull5' ( out float CullDistance)
-0:12          cull5: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              5 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_clip7' ( out 1-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            clip: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                0 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_clip7' ( out 1-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            clip0: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                1 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_clip7' ( out 1-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            clip7: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                2 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_cull5' ( out 1-element array of float CullDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            cull: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                3 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_cull5' ( out 1-element array of float CullDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            cull2: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                4 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_cull5' ( out 1-element array of float CullDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            cull5: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                5 (const int)
 0:12        move second child to first child ( temp int)
 0:12          ii: direct index for structure ( temp int)
 0:12            '@entryPointOutput' (layout( location=0) out structure{ temp int ii})
@@ -176,42 +200,66 @@ Shader version: 500
 0:12          'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
 0:12          Function Call: @main(struct-S-f1-f1-f1-f1-f1-f1-i11; ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
 0:?             'ins' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_clip7' ( out float ClipDistance)
-0:12          clip: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              0 (const int)
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_clip7' ( out float ClipDistance)
-0:12          clip0: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              1 (const int)
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_clip7' ( out float ClipDistance)
-0:12          clip7: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              2 (const int)
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_cull5' ( out float CullDistance)
-0:12          cull: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              3 (const int)
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_cull5' ( out float CullDistance)
-0:12          cull2: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              4 (const int)
-0:12        move second child to first child ( temp float)
-0:?           '@entryPointOutput_cull5' ( out float CullDistance)
-0:12          cull5: direct index for structure ( temp float)
-0:12            'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
-0:12            Constant:
-0:12              5 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_clip7' ( out 1-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            clip: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                0 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_clip7' ( out 1-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            clip0: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                1 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_clip7' ( out 1-element array of float ClipDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            clip7: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                2 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_cull5' ( out 1-element array of float CullDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            cull: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                3 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_cull5' ( out 1-element array of float CullDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            cull2: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                4 (const int)
+0:?         Sequence
+0:12          move second child to first child ( temp float)
+0:12            direct index ( temp float)
+0:?               '@entryPointOutput_cull5' ( out 1-element array of float CullDistance)
+0:12              Constant:
+0:12                0 (const int)
+0:12            cull5: direct index for structure ( temp float)
+0:12              'flattenTemp' ( temp structure{ temp float clip,  temp float clip0,  temp float clip7,  temp float cull,  temp float cull2,  temp float cull5,  temp int ii})
+0:12              Constant:
+0:12                5 (const int)
 0:12        move second child to first child ( temp int)
 0:12          ii: direct index for structure ( temp int)
 0:12            '@entryPointOutput' (layout( location=0) out structure{ temp int ii})
@@ -233,14 +281,14 @@ Shader version: 500
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 77
+// Id's are bound by 87
 
                               Capability Shader
                               Capability ClipDistance
                               Capability CullDistance
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 21 26 30 34 38 42 47 56 63 72
+                              EntryPoint Vertex 4  "main" 21 26 30 34 38 42 47 59 70 82
                               Source HLSL 500
                               Name 4  "main"
                               Name 8  "S"
@@ -264,11 +312,11 @@ Shader version: 500
                               Name 47  "ii"
                               Name 51  "flattenTemp"
                               Name 52  "param"
-                              Name 56  "@entryPointOutput_clip7"
-                              Name 63  "@entryPointOutput_cull5"
-                              Name 70  "S"
-                              MemberName 70(S) 0  "ii"
-                              Name 72  "@entryPointOutput"
+                              Name 59  "@entryPointOutput_clip7"
+                              Name 70  "@entryPointOutput_cull5"
+                              Name 80  "S"
+                              MemberName 80(S) 0  "ii"
+                              Name 82  "@entryPointOutput"
                               Decorate 21(clip) Location 0
                               Decorate 26(clip0) Location 1
                               Decorate 30(clip7) Location 2
@@ -276,9 +324,9 @@ Shader version: 500
                               Decorate 38(cull2) Location 4
                               Decorate 42(cull5) Location 5
                               Decorate 47(ii) BuiltIn InstanceIndex
-                              Decorate 56(@entryPointOutput_clip7) BuiltIn ClipDistance
-                              Decorate 63(@entryPointOutput_cull5) BuiltIn CullDistance
-                              Decorate 72(@entryPointOutput) Location 0
+                              Decorate 59(@entryPointOutput_clip7) BuiltIn ClipDistance
+                              Decorate 70(@entryPointOutput_cull5) BuiltIn CullDistance
+                              Decorate 82(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -304,13 +352,17 @@ Shader version: 500
               46:             TypePointer Input 7(int)
           47(ii):     46(ptr) Variable Input
               49:             TypePointer Function 7(int)
-              55:             TypePointer Output 6(float)
-56(@entryPointOutput_clip7):     55(ptr) Variable Output
-63(@entryPointOutput_cull5):     55(ptr) Variable Output
-           70(S):             TypeStruct 7(int)
-              71:             TypePointer Output 70(S)
-72(@entryPointOutput):     71(ptr) Variable Output
-              75:             TypePointer Output 7(int)
+              55:             TypeInt 32 0
+              56:     55(int) Constant 1
+              57:             TypeArray 6(float) 56
+              58:             TypePointer Output 57
+59(@entryPointOutput_clip7):     58(ptr) Variable Output
+              62:             TypePointer Output 6(float)
+70(@entryPointOutput_cull5):     58(ptr) Variable Output
+           80(S):             TypeStruct 7(int)
+              81:             TypePointer Output 80(S)
+82(@entryPointOutput):     81(ptr) Variable Output
+              85:             TypePointer Output 7(int)
          4(main):           2 Function None 3
                5:             Label
          18(ins):      9(ptr) Variable Function
@@ -341,28 +393,34 @@ Shader version: 500
                               Store 52(param) 53
               54:        8(S) FunctionCall 12(@main(struct-S-f1-f1-f1-f1-f1-f1-i11;) 52(param)
                               Store 51(flattenTemp) 54
-              57:     23(ptr) AccessChain 51(flattenTemp) 19
-              58:    6(float) Load 57
-                              Store 56(@entryPointOutput_clip7) 58
-              59:     23(ptr) AccessChain 51(flattenTemp) 25
-              60:    6(float) Load 59
-                              Store 56(@entryPointOutput_clip7) 60
-              61:     23(ptr) AccessChain 51(flattenTemp) 29
-              62:    6(float) Load 61
-                              Store 56(@entryPointOutput_clip7) 62
-              64:     23(ptr) AccessChain 51(flattenTemp) 33
+              60:     23(ptr) AccessChain 51(flattenTemp) 19
+              61:    6(float) Load 60
+              63:     62(ptr) AccessChain 59(@entryPointOutput_clip7) 19
+                              Store 63 61
+              64:     23(ptr) AccessChain 51(flattenTemp) 25
               65:    6(float) Load 64
-                              Store 63(@entryPointOutput_cull5) 65
-              66:     23(ptr) AccessChain 51(flattenTemp) 37
-              67:    6(float) Load 66
-                              Store 63(@entryPointOutput_cull5) 67
-              68:     23(ptr) AccessChain 51(flattenTemp) 41
-              69:    6(float) Load 68
-                              Store 63(@entryPointOutput_cull5) 69
-              73:     49(ptr) AccessChain 51(flattenTemp) 45
-              74:      7(int) Load 73
-              76:     75(ptr) AccessChain 72(@entryPointOutput) 19
-                              Store 76 74
+              66:     62(ptr) AccessChain 59(@entryPointOutput_clip7) 19
+                              Store 66 65
+              67:     23(ptr) AccessChain 51(flattenTemp) 29
+              68:    6(float) Load 67
+              69:     62(ptr) AccessChain 59(@entryPointOutput_clip7) 19
+                              Store 69 68
+              71:     23(ptr) AccessChain 51(flattenTemp) 33
+              72:    6(float) Load 71
+              73:     62(ptr) AccessChain 70(@entryPointOutput_cull5) 19
+                              Store 73 72
+              74:     23(ptr) AccessChain 51(flattenTemp) 37
+              75:    6(float) Load 74
+              76:     62(ptr) AccessChain 70(@entryPointOutput_cull5) 19
+                              Store 76 75
+              77:     23(ptr) AccessChain 51(flattenTemp) 41
+              78:    6(float) Load 77
+              79:     62(ptr) AccessChain 70(@entryPointOutput_cull5) 19
+                              Store 79 78
+              83:     49(ptr) AccessChain 51(flattenTemp) 45
+              84:      7(int) Load 83
+              86:     85(ptr) AccessChain 82(@entryPointOutput) 19
+                              Store 86 84
                               Return
                               FunctionEnd
 12(@main(struct-S-f1-f1-f1-f1-f1-f1-i11;):        8(S) Function None 10

+ 27 - 24
3rdparty/glslang/Test/baseResults/hlsl.struct.frag.out

@@ -44,7 +44,7 @@ gl_FragCoord origin is upper left
 0:40            Constant:
 0:40              0 (const int)
 0:40          a: direct index for structure ( smooth temp 4-component vector of float)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              0 (const int)
 0:40        move second child to first child ( temp bool)
@@ -53,7 +53,7 @@ gl_FragCoord origin is upper left
 0:40            Constant:
 0:40              1 (const int)
 0:40          b: direct index for structure ( flat temp bool)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              1 (const int)
 0:40        move second child to first child ( temp 1-component vector of float)
@@ -62,7 +62,7 @@ gl_FragCoord origin is upper left
 0:40            Constant:
 0:40              2 (const int)
 0:40          c: direct index for structure ( centroid noperspective temp 1-component vector of float)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              2 (const int)
 0:40        move second child to first child ( temp 2-component vector of float)
@@ -71,7 +71,7 @@ gl_FragCoord origin is upper left
 0:40            Constant:
 0:40              3 (const int)
 0:40          d: direct index for structure ( centroid sample temp 2-component vector of float)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              3 (const int)
 0:40        move second child to first child ( temp bool)
@@ -79,14 +79,14 @@ gl_FragCoord origin is upper left
 0:?             's' ( temp structure{ temp 4-component vector of float a,  temp bool b,  temp 1-component vector of float c,  temp 2-component vector of float d,  temp bool ff1,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              4 (const int)
-0:?           's_ff1' ( in bool Face)
+0:?           's_ff1' ( flat in bool Face)
 0:40        move second child to first child ( temp bool)
 0:40          ff2: direct index for structure ( temp bool)
 0:?             's' ( temp structure{ temp 4-component vector of float a,  temp bool b,  temp 1-component vector of float c,  temp 2-component vector of float d,  temp bool ff1,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              5 (const int)
-0:40          ff2: direct index for structure ( temp bool)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40          ff2: direct index for structure ( flat temp bool)
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              4 (const int)
 0:40        move second child to first child ( temp bool)
@@ -94,8 +94,8 @@ gl_FragCoord origin is upper left
 0:?             's' ( temp structure{ temp 4-component vector of float a,  temp bool b,  temp 1-component vector of float c,  temp 2-component vector of float d,  temp bool ff1,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              6 (const int)
-0:40          ff3: direct index for structure ( temp bool)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40          ff3: direct index for structure ( flat temp bool)
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              5 (const int)
 0:40        move second child to first child ( temp 4-component vector of float)
@@ -104,7 +104,7 @@ gl_FragCoord origin is upper left
 0:40            Constant:
 0:40              7 (const int)
 0:40          ff4: direct index for structure ( temp 4-component vector of float)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              6 (const int)
 0:40      move second child to first child ( temp 4-component vector of float)
@@ -117,8 +117,8 @@ gl_FragCoord origin is upper left
 0:?     's2' ( global structure{ temp 4-component vector of float i})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'input' (layout( location=0) in 4-component vector of float)
-0:?     's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
-0:?     's_ff1' ( in bool Face)
+0:?     's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
+0:?     's_ff1' ( flat in bool Face)
 
 
 Linked fragment stage:
@@ -165,7 +165,7 @@ gl_FragCoord origin is upper left
 0:40            Constant:
 0:40              0 (const int)
 0:40          a: direct index for structure ( smooth temp 4-component vector of float)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              0 (const int)
 0:40        move second child to first child ( temp bool)
@@ -174,7 +174,7 @@ gl_FragCoord origin is upper left
 0:40            Constant:
 0:40              1 (const int)
 0:40          b: direct index for structure ( flat temp bool)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              1 (const int)
 0:40        move second child to first child ( temp 1-component vector of float)
@@ -183,7 +183,7 @@ gl_FragCoord origin is upper left
 0:40            Constant:
 0:40              2 (const int)
 0:40          c: direct index for structure ( centroid noperspective temp 1-component vector of float)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              2 (const int)
 0:40        move second child to first child ( temp 2-component vector of float)
@@ -192,7 +192,7 @@ gl_FragCoord origin is upper left
 0:40            Constant:
 0:40              3 (const int)
 0:40          d: direct index for structure ( centroid sample temp 2-component vector of float)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              3 (const int)
 0:40        move second child to first child ( temp bool)
@@ -200,14 +200,14 @@ gl_FragCoord origin is upper left
 0:?             's' ( temp structure{ temp 4-component vector of float a,  temp bool b,  temp 1-component vector of float c,  temp 2-component vector of float d,  temp bool ff1,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              4 (const int)
-0:?           's_ff1' ( in bool Face)
+0:?           's_ff1' ( flat in bool Face)
 0:40        move second child to first child ( temp bool)
 0:40          ff2: direct index for structure ( temp bool)
 0:?             's' ( temp structure{ temp 4-component vector of float a,  temp bool b,  temp 1-component vector of float c,  temp 2-component vector of float d,  temp bool ff1,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              5 (const int)
-0:40          ff2: direct index for structure ( temp bool)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40          ff2: direct index for structure ( flat temp bool)
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              4 (const int)
 0:40        move second child to first child ( temp bool)
@@ -215,8 +215,8 @@ gl_FragCoord origin is upper left
 0:?             's' ( temp structure{ temp 4-component vector of float a,  temp bool b,  temp 1-component vector of float c,  temp 2-component vector of float d,  temp bool ff1,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              6 (const int)
-0:40          ff3: direct index for structure ( temp bool)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40          ff3: direct index for structure ( flat temp bool)
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              5 (const int)
 0:40        move second child to first child ( temp 4-component vector of float)
@@ -225,7 +225,7 @@ gl_FragCoord origin is upper left
 0:40            Constant:
 0:40              7 (const int)
 0:40          ff4: direct index for structure ( temp 4-component vector of float)
-0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
+0:40            's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
 0:40            Constant:
 0:40              6 (const int)
 0:40      move second child to first child ( temp 4-component vector of float)
@@ -238,8 +238,8 @@ gl_FragCoord origin is upper left
 0:?     's2' ( global structure{ temp 4-component vector of float i})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'input' (layout( location=0) in 4-component vector of float)
-0:?     's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  temp bool ff2,  temp bool ff3,  temp 4-component vector of float ff4})
-0:?     's_ff1' ( in bool Face)
+0:?     's' (layout( location=1) in structure{ smooth temp 4-component vector of float a,  flat temp bool b,  centroid noperspective temp 1-component vector of float c,  centroid sample temp 2-component vector of float d,  flat temp bool ff2,  flat temp bool ff3,  temp 4-component vector of float ff4})
+0:?     's_ff1' ( flat in bool Face)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -306,7 +306,10 @@ gl_FragCoord origin is upper left
                               MemberDecorate 54(IN_S) 2 NoPerspective
                               MemberDecorate 54(IN_S) 2 Centroid
                               MemberDecorate 54(IN_S) 3 Centroid
+                              MemberDecorate 54(IN_S) 4 Flat
+                              MemberDecorate 54(IN_S) 5 Flat
                               Decorate 56(s) Location 1
+                              Decorate 79(s_ff1) Flat
                               Decorate 79(s_ff1) BuiltIn FrontFacing
                               Decorate 94(@entryPointOutput) Location 0
                               MemberDecorate 101(myS) 0 Offset 0

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.struct.split.assign.frag.out

@@ -20,7 +20,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:7      move second child to first child ( temp int)
 0:?         'i' ( temp int)
-0:?         'i' (layout( location=0) in int)
+0:?         'i' (layout( location=0) flat in int)
 0:7      Sequence
 0:7        move second child to first child ( temp float)
 0:7          f: direct index for structure ( temp float)
@@ -110,7 +110,7 @@ gl_FragCoord origin is upper left
 0:?           'input' ( temp 3-element array of structure{ temp float f,  temp 4-component vector of float pos})
 0:?   Linker Objects
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'i' (layout( location=0) in int)
+0:?     'i' (layout( location=0) flat in int)
 0:?     'input' (layout( location=1) in 3-element array of structure{ temp float f})
 0:?     'input_pos' ( in 3-element array of 4-component vector of float FragCoord)
 
@@ -139,7 +139,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:7      move second child to first child ( temp int)
 0:?         'i' ( temp int)
-0:?         'i' (layout( location=0) in int)
+0:?         'i' (layout( location=0) flat in int)
 0:7      Sequence
 0:7        move second child to first child ( temp float)
 0:7          f: direct index for structure ( temp float)
@@ -229,7 +229,7 @@ gl_FragCoord origin is upper left
 0:?           'input' ( temp 3-element array of structure{ temp float f,  temp 4-component vector of float pos})
 0:?   Linker Objects
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'i' (layout( location=0) in int)
+0:?     'i' (layout( location=0) flat in int)
 0:?     'input' (layout( location=1) in 3-element array of structure{ temp float f})
 0:?     'input_pos' ( in 3-element array of 4-component vector of float FragCoord)
 
@@ -261,6 +261,7 @@ gl_FragCoord origin is upper left
                               Name 67  "@entryPointOutput"
                               Name 68  "param"
                               Name 70  "param"
+                              Decorate 32(i) Flat
                               Decorate 32(i) Location 0
                               Decorate 39(input) Location 1
                               Decorate 48(input_pos) BuiltIn FragCoord

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.fn.frag.out

@@ -58,7 +58,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:19      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:19      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:19        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -70,7 +70,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
 0:?     'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 
 Linked fragment stage:
@@ -135,7 +135,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:19      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:19      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:19        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -147,7 +147,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
 0:?     'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -192,6 +192,7 @@ gl_FragCoord origin is upper left
                               Decorate 50(sbuf_a@count) DescriptorSet 0
                               Decorate 51(sbuf_c) DescriptorSet 0
                               Decorate 52(sbuf_c@count) DescriptorSet 0
+                              Decorate 58(pos) Flat
                               Decorate 58(pos) Location 0
                               Decorate 61(@entryPointOutput) Location 0
                               MemberDecorate 65(sbuf_a@count) 0 Offset 0

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.frag.out

@@ -45,7 +45,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:7      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:7      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:7        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -57,7 +57,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
 0:?     'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 
 Linked fragment stage:
@@ -109,7 +109,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:7      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:7      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:7        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -121,7 +121,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
 0:?     'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -158,6 +158,7 @@ gl_FragCoord origin is upper left
                               Decorate 22(sbuf_a@count) DescriptorSet 0
                               Decorate 36(sbuf_c) DescriptorSet 0
                               Decorate 37(sbuf_c@count) DescriptorSet 0
+                              Decorate 48(pos) Flat
                               Decorate 48(pos) Location 0
                               Decorate 51(@entryPointOutput) Location 0
                               Decorate 55(sbuf_unused) DescriptorSet 0

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.atomics.frag.out

@@ -224,7 +224,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:5      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:5      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:5        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -232,7 +232,7 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 
 Linked fragment stage:
@@ -463,7 +463,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:5      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:5      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:5        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -471,7 +471,7 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -498,6 +498,7 @@ gl_FragCoord origin is upper left
                               MemberDecorate 15(sbuf) 0 Offset 0
                               Decorate 15(sbuf) BufferBlock
                               Decorate 17(sbuf) DescriptorSet 0
+                              Decorate 80(pos) Flat
                               Decorate 80(pos) Location 0
                               Decorate 83(@entryPointOutput) Location 0
                2:             TypeVoid

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.byte.frag.out

@@ -149,7 +149,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:5      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:5      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:5        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -157,7 +157,7 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 
 Linked fragment stage:
@@ -313,7 +313,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:5      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:5      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:5        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -321,7 +321,7 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     'sbuf' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -352,6 +352,7 @@ gl_FragCoord origin is upper left
                               MemberDecorate 16(sbuf) 0 Offset 0
                               Decorate 16(sbuf) BufferBlock
                               Decorate 18(sbuf) DescriptorSet 0
+                              Decorate 107(pos) Flat
                               Decorate 107(pos) Location 0
                               Decorate 110(@entryPointOutput) Location 0
                2:             TypeVoid

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.coherent.frag.out

@@ -74,7 +74,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:12      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:12      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:12        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -83,7 +83,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color,  temp bool test} @data})
 0:?     'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 
 Linked fragment stage:
@@ -164,7 +164,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:12      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:12      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:12        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -173,7 +173,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color,  temp bool test} @data})
 0:?     'sbuf2' (layout( row_major std430) coherent buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -217,6 +217,7 @@ gl_FragCoord origin is upper left
                               MemberDecorate 30(sbuf) 0 Offset 0
                               Decorate 30(sbuf) BufferBlock
                               Decorate 32(sbuf) DescriptorSet 0
+                              Decorate 71(pos) Flat
                               Decorate 71(pos) Location 0
                               Decorate 74(@entryPointOutput) Location 0
                2:             TypeVoid

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn.frag.out

@@ -53,7 +53,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:20      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:20      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:20        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -64,7 +64,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf2@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
 0:?     'sbuf3' (layout( binding=12 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 3-component vector of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 
 Linked fragment stage:
@@ -124,7 +124,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:20      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:20      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:20        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -135,7 +135,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf2@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
 0:?     'sbuf3' (layout( binding=12 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of 3-component vector of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -192,6 +192,7 @@ gl_FragCoord origin is upper left
                               Decorate 48(sbuf2@count) DescriptorSet 0
                               Decorate 50(sbuf) DescriptorSet 0
                               Decorate 50(sbuf) Binding 10
+                              Decorate 63(pos) Flat
                               Decorate 63(pos) Location 0
                               Decorate 66(@entryPointOutput) Location 0
                               MemberDecorate 70(sbuf2@count) 0 Offset 0

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.frag.out

@@ -80,7 +80,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:12      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:12      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:12        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -89,7 +89,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color,  temp bool test,  temp bool test2} @data})
 0:?     'sbuf2' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 
 Linked fragment stage:
@@ -176,7 +176,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:12      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:12      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:12        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -185,7 +185,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color,  temp bool test,  temp bool test2} @data})
 0:?     'sbuf2' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -238,6 +238,7 @@ gl_FragCoord origin is upper left
                               MemberDecorate 59(sbuf2) 0 Offset 0
                               Decorate 59(sbuf2) BufferBlock
                               Decorate 61(sbuf2) DescriptorSet 0
+                              Decorate 89(pos) Flat
                               Decorate 89(pos) Location 0
                               Decorate 92(@entryPointOutput) Location 0
                2:             TypeVoid

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.incdec.frag.out

@@ -85,7 +85,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:7      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:7      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:7        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -97,7 +97,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
 0:?     'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 
 Linked fragment stage:
@@ -189,7 +189,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:7      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:7      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:7        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -201,7 +201,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
 0:?     'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of 4-component vector of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -242,6 +242,7 @@ gl_FragCoord origin is upper left
                               Decorate 34(sbuf_rw_i@count) BufferBlock
                               Decorate 36(sbuf_rw_i@count) DescriptorSet 0
                               Decorate 43(sbuf_rw_d@count) DescriptorSet 0
+                              Decorate 63(pos) Flat
                               Decorate 63(pos) Location 0
                               Decorate 66(@entryPointOutput) Location 0
                2:             TypeVoid

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rw.frag.out

@@ -74,7 +74,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:12      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:12      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:12        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -83,7 +83,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color,  temp bool test} @data})
 0:?     'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 
 Linked fragment stage:
@@ -164,7 +164,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:12      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:12      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:12        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -173,7 +173,7 @@ gl_FragCoord origin is upper left
 0:?     'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 3-component vector of float color,  temp bool test} @data})
 0:?     'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -213,6 +213,7 @@ gl_FragCoord origin is upper left
                               MemberDecorate 30(sbuf) 0 Offset 0
                               Decorate 30(sbuf) BufferBlock
                               Decorate 32(sbuf) DescriptorSet 0
+                              Decorate 71(pos) Flat
                               Decorate 71(pos) Location 0
                               Decorate 74(@entryPointOutput) Location 0
                2:             TypeVoid

+ 5 - 4
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.rwbyte.frag.out

@@ -490,7 +490,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:5      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:5      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:5        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -498,7 +498,7 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 
 Linked fragment stage:
@@ -995,7 +995,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:5      move second child to first child ( temp uint)
 0:?         'pos' ( temp uint)
-0:?         'pos' (layout( location=0) in uint)
+0:?         'pos' (layout( location=0) flat in uint)
 0:5      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:5        Function Call: @main(u1; ( temp 4-component vector of float)
@@ -1003,7 +1003,7 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     'sbuf' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:?     'pos' (layout( location=0) in uint)
+0:?     'pos' (layout( location=0) flat in uint)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -1037,6 +1037,7 @@ gl_FragCoord origin is upper left
                               MemberDecorate 16(sbuf) 0 Offset 0
                               Decorate 16(sbuf) BufferBlock
                               Decorate 18(sbuf) DescriptorSet 0
+                              Decorate 233(pos) Flat
                               Decorate 233(pos) Location 0
                               Decorate 236(@entryPointOutput) Location 0
                2:             TypeVoid

+ 10 - 8
3rdparty/glslang/Test/baseResults/hlsl.switch.frag.out

@@ -129,10 +129,10 @@ gl_FragCoord origin is upper left
 0:?         'input' (layout( location=0) in 4-component vector of float)
 0:2      move second child to first child ( temp int)
 0:?         'c' ( temp int)
-0:?         'c' (layout( location=1) in int)
+0:?         'c' (layout( location=1) flat in int)
 0:2      move second child to first child ( temp int)
 0:?         'd' ( temp int)
-0:?         'd' (layout( location=2) in int)
+0:?         'd' (layout( location=2) flat in int)
 0:2      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:2        Function Call: @PixelShaderFunction(vf4;i1;i1; ( temp 4-component vector of float)
@@ -142,8 +142,8 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'input' (layout( location=0) in 4-component vector of float)
-0:?     'c' (layout( location=1) in int)
-0:?     'd' (layout( location=2) in int)
+0:?     'c' (layout( location=1) flat in int)
+0:?     'd' (layout( location=2) flat in int)
 
 
 Linked fragment stage:
@@ -279,10 +279,10 @@ gl_FragCoord origin is upper left
 0:?         'input' (layout( location=0) in 4-component vector of float)
 0:2      move second child to first child ( temp int)
 0:?         'c' ( temp int)
-0:?         'c' (layout( location=1) in int)
+0:?         'c' (layout( location=1) flat in int)
 0:2      move second child to first child ( temp int)
 0:?         'd' ( temp int)
-0:?         'd' (layout( location=2) in int)
+0:?         'd' (layout( location=2) flat in int)
 0:2      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:2        Function Call: @PixelShaderFunction(vf4;i1;i1; ( temp 4-component vector of float)
@@ -292,8 +292,8 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'input' (layout( location=0) in 4-component vector of float)
-0:?     'c' (layout( location=1) in int)
-0:?     'd' (layout( location=2) in int)
+0:?     'c' (layout( location=1) flat in int)
+0:?     'd' (layout( location=2) flat in int)
 
 // Module Version 10000
 // Generated by (magic number): 80001
@@ -321,7 +321,9 @@ gl_FragCoord origin is upper left
                               Name 101  "param"
                               Name 103  "param"
                               Decorate 88(input) Location 0
+                              Decorate 92(c) Flat
                               Decorate 92(c) Location 1
+                              Decorate 95(d) Flat
                               Decorate 95(d) Location 2
                               Decorate 98(@entryPointOutput) Location 0
                2:             TypeVoid

+ 151 - 0
3rdparty/glslang/Test/baseResults/hlsl.synthesizeInput.frag.out

@@ -0,0 +1,151 @@
+hlsl.synthesizeInput.frag
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:7  Function Definition: @main(struct-PSInput-f1-u11; ( temp 4-component vector of float)
+0:7    Function Parameters: 
+0:7      'input' ( in structure{ temp float interp,  temp uint no_interp})
+0:?     Sequence
+0:8      Branch: Return with expression
+0:?         Construct vec4 ( temp 4-component vector of float)
+0:8          Convert uint to float ( temp float)
+0:8            no_interp: direct index for structure ( temp uint)
+0:8              'input' ( in structure{ temp float interp,  temp uint no_interp})
+0:8              Constant:
+0:8                1 (const int)
+0:8          interp: direct index for structure ( temp float)
+0:8            'input' ( in structure{ temp float interp,  temp uint no_interp})
+0:8            Constant:
+0:8              0 (const int)
+0:8          Constant:
+0:8            0.000000
+0:8          Constant:
+0:8            1.000000
+0:7  Function Definition: main( ( temp void)
+0:7    Function Parameters: 
+0:?     Sequence
+0:7      move second child to first child ( temp structure{ temp float interp,  temp uint no_interp})
+0:?         'input' ( temp structure{ temp float interp,  temp uint no_interp})
+0:?         'input' (layout( location=0) in structure{ temp float interp,  flat temp uint no_interp})
+0:7      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:7        Function Call: @main(struct-PSInput-f1-u11; ( temp 4-component vector of float)
+0:?           'input' ( temp structure{ temp float interp,  temp uint no_interp})
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'input' (layout( location=0) in structure{ temp float interp,  flat temp uint no_interp})
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:7  Function Definition: @main(struct-PSInput-f1-u11; ( temp 4-component vector of float)
+0:7    Function Parameters: 
+0:7      'input' ( in structure{ temp float interp,  temp uint no_interp})
+0:?     Sequence
+0:8      Branch: Return with expression
+0:?         Construct vec4 ( temp 4-component vector of float)
+0:8          Convert uint to float ( temp float)
+0:8            no_interp: direct index for structure ( temp uint)
+0:8              'input' ( in structure{ temp float interp,  temp uint no_interp})
+0:8              Constant:
+0:8                1 (const int)
+0:8          interp: direct index for structure ( temp float)
+0:8            'input' ( in structure{ temp float interp,  temp uint no_interp})
+0:8            Constant:
+0:8              0 (const int)
+0:8          Constant:
+0:8            0.000000
+0:8          Constant:
+0:8            1.000000
+0:7  Function Definition: main( ( temp void)
+0:7    Function Parameters: 
+0:?     Sequence
+0:7      move second child to first child ( temp structure{ temp float interp,  temp uint no_interp})
+0:?         'input' ( temp structure{ temp float interp,  temp uint no_interp})
+0:?         'input' (layout( location=0) in structure{ temp float interp,  flat temp uint no_interp})
+0:7      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:7        Function Call: @main(struct-PSInput-f1-u11; ( temp 4-component vector of float)
+0:?           'input' ( temp structure{ temp float interp,  temp uint no_interp})
+0:?   Linker Objects
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'input' (layout( location=0) in structure{ temp float interp,  flat temp uint no_interp})
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 44
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 33 40
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 8  "PSInput"
+                              MemberName 8(PSInput) 0  "interp"
+                              MemberName 8(PSInput) 1  "no_interp"
+                              Name 13  "@main(struct-PSInput-f1-u11;"
+                              Name 12  "input"
+                              Name 30  "input"
+                              Name 31  "PSInput"
+                              MemberName 31(PSInput) 0  "interp"
+                              MemberName 31(PSInput) 1  "no_interp"
+                              Name 33  "input"
+                              Name 40  "@entryPointOutput"
+                              Name 41  "param"
+                              MemberDecorate 31(PSInput) 1 Flat
+                              Decorate 33(input) Location 0
+                              Decorate 40(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeInt 32 0
+      8(PSInput):             TypeStruct 6(float) 7(int)
+               9:             TypePointer Function 8(PSInput)
+              10:             TypeVector 6(float) 4
+              11:             TypeFunction 10(fvec4) 9(ptr)
+              15:             TypeInt 32 1
+              16:     15(int) Constant 1
+              17:             TypePointer Function 7(int)
+              21:     15(int) Constant 0
+              22:             TypePointer Function 6(float)
+              25:    6(float) Constant 0
+              26:    6(float) Constant 1065353216
+     31(PSInput):             TypeStruct 6(float) 7(int)
+              32:             TypePointer Input 31(PSInput)
+       33(input):     32(ptr) Variable Input
+              39:             TypePointer Output 10(fvec4)
+40(@entryPointOutput):     39(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+       30(input):      9(ptr) Variable Function
+       41(param):      9(ptr) Variable Function
+              34: 31(PSInput) Load 33(input)
+              35:    6(float) CompositeExtract 34 0
+              36:     22(ptr) AccessChain 30(input) 21
+                              Store 36 35
+              37:      7(int) CompositeExtract 34 1
+              38:     17(ptr) AccessChain 30(input) 16
+                              Store 38 37
+              42:  8(PSInput) Load 30(input)
+                              Store 41(param) 42
+              43:   10(fvec4) FunctionCall 13(@main(struct-PSInput-f1-u11;) 41(param)
+                              Store 40(@entryPointOutput) 43
+                              Return
+                              FunctionEnd
+13(@main(struct-PSInput-f1-u11;):   10(fvec4) Function None 11
+       12(input):      9(ptr) FunctionParameter
+              14:             Label
+              18:     17(ptr) AccessChain 12(input) 16
+              19:      7(int) Load 18
+              20:    6(float) ConvertUToF 19
+              23:     22(ptr) AccessChain 12(input) 21
+              24:    6(float) Load 23
+              27:   10(fvec4) CompositeConstruct 20 24 25 26
+                              ReturnValue 27
+                              FunctionEnd

+ 22 - 17
3rdparty/glslang/Test/hlsl.buffer.frag

@@ -1,17 +1,17 @@
-cbuffer {
+cbuffer buf1 {
     float4 v1;
-};
+}; // extraneous ;
 
-tbuffer {
+tbuffer buf2 {
     float4 v2;
-};
+}; // extraneous ;
 
-cbuffer cbufName : register(b2, space10) {
-    float4 v3;
-    int i3 : packoffset(c1.y);
-} // no semicolon is okay
+cbuffer cbufName {
+    float4 v3 : packoffset(c0);
+    int i3    : packoffset(c1.y);
+}
 
-tbuffer tbufName : register(b8) {
+tbuffer tbufName : register(t8) {
     float4 v4 : packoffset(c1);
     int i4    : packoffset(c3);
     float f1  : packoffset(c3.w);
@@ -19,14 +19,19 @@ tbuffer tbufName : register(b8) {
     float f4  : packoffset(c4.y);
     float f5  : packoffset(c4.z);
     float f6  : packoffset(c);
-    float f7;
-                 float3x4 m1;
-       row_major float3x4 m2;
-    column_major float3x4 m3;
-                 float3x4 m4;
-}  // no semicolon is okay
+    float f7  : packoffset(c8);
+                 float3x4 m1 : packoffset(c7);
+       row_major float3x4 m2 : packoffset(c11);
+    column_major float3x4 m3 : packoffset(c15);
+                 float3x4 m4 : packoffset(c19);
+}
+
+float foo() // float looks like identifier, but can't be part of tbuffer
+{
+    return 1.0;
+}
 
-float4 PixelShaderFunction(float4 input) : COLOR0
+float4 PixelShaderFunction(float4 input : SV_POSITION) : SV_TARGET0
 {
-    return input + v1 + v2 + v3 + v4;
+    return (input + v1 + v2 + v3 + v4) * foo();
 }

+ 8 - 0
3rdparty/glslang/Test/hlsl.clipdistance-1.vert

@@ -0,0 +1,8 @@
+void main(out float4 pos : SV_Position, 
+          out float clip : SV_ClipDistance,  // scalar float
+          out float cull : SV_CullDistance)  // scalar float
+{
+    pos = 1.0f.xxxx;
+    clip = 0.5f;
+    cull = 0.51f;
+}

+ 15 - 0
3rdparty/glslang/Test/hlsl.clipdistance-2.vert

@@ -0,0 +1,15 @@
+void main(out float4 pos : SV_Position,
+          out float2 clip[2] : SV_ClipDistance,  // array of vector float
+          out float2 cull[2] : SV_CullDistance)  // array of vector float
+{
+    pos = 1.0f.xxxx;
+    clip[0].x = 0.5f;
+    clip[0].y = 0.6f;
+    clip[1].x = 0.7f;
+    clip[1].y = 0.8f;
+
+    cull[0].x = 0.525f;
+    cull[0].y = 0.625f;
+    cull[1].x = 0.725f;
+    cull[1].y = 0.825f;
+}

+ 13 - 0
3rdparty/glslang/Test/hlsl.clipdistance-3.vert

@@ -0,0 +1,13 @@
+void main(out float4 pos : SV_Position,
+          out float clip[2] : SV_ClipDistance, // array of scalar float
+          out float cull[2] : SV_CullDistance) // array of scalar float
+{
+    pos = 1.0f.xxxx;
+    clip[0] = 0.5f;
+    clip[1] = 0.6f;
+
+    cull[0] = 0.525f;
+    cull[1] = 0.625f;
+}
+
+

+ 21 - 0
3rdparty/glslang/Test/hlsl.clipdistance-4.vert

@@ -0,0 +1,21 @@
+struct VS_INPUT         {
+    float4 Position             : POSITION;
+};
+
+struct VS_OUTPUT        {
+    float4 Position             : SV_Position;
+    float4 ClipRect             : SV_ClipDistance0;  // vector in split struct
+};
+
+VS_OUTPUT main(const VS_INPUT v)
+{
+    VS_OUTPUT           Output;
+    Output.Position     = 0;
+
+    Output.ClipRect.x = 1;
+    Output.ClipRect.y = 2;
+    Output.ClipRect.z = 3;
+    Output.ClipRect.w = 4;
+
+    return Output;
+}

+ 21 - 0
3rdparty/glslang/Test/hlsl.clipdistance-5.vert

@@ -0,0 +1,21 @@
+struct VS_INPUT         {
+    float4 Position             : POSITION;
+};
+
+struct VS_OUTPUT        {
+    float4 Position             : SV_Position;
+    float2 ClipRect[2]          : SV_ClipDistance0;  // array of float2 in split struct
+};
+
+VS_OUTPUT main(const VS_INPUT v)
+{
+    VS_OUTPUT           Output;
+    Output.Position     = 0;
+
+    Output.ClipRect[0].x = 1;
+    Output.ClipRect[0].y = 2;
+    Output.ClipRect[1].x = 3;
+    Output.ClipRect[1].y = 4;
+
+    return Output;
+}

+ 3 - 2
3rdparty/glslang/Test/hlsl.inoutquals.frag

@@ -4,11 +4,12 @@ struct PS_OUTPUT
     float  Depth : SV_Depth;
 };
 
-inline void MyFunc(in float x, out float y, inout float z)
+inline void MyFunc(in float x, out float y, inout float z, in out float w)
 {
     y = x;
     z = y;
     x = -1; // no effect since x = in param
+    w *= 1;
 }
 
 PS_OUTPUT main(noperspective in float4 inpos : SV_Position, out int sampleMask : SV_Coverage)
@@ -16,7 +17,7 @@ PS_OUTPUT main(noperspective in float4 inpos : SV_Position, out int sampleMask :
    PS_OUTPUT psout;
 
    float x = 7, y, z = 3;
-   MyFunc(x, y, z);
+   MyFunc(x, y, z, inpos.w);
 
    psout.Color = float4(x, y, z, 1);
    psout.Depth = inpos.w;

+ 9 - 36
3rdparty/glslang/Test/hlsl.reflection.vert

@@ -19,27 +19,10 @@ cbuffer c_nameless {
     float4 c_anonMember3;
 };
 
-cbuffer named {
-    float3 deadMember1;
-    int scalar;
-    float4 member2;
-    float4 member3;
-    float2 memfloat2;
-    float memf1;
-    bool  memf2;
-    int   memf3;
-    float2 memfloat2a;
-    float2x2 m22[7];
-} ablock;
-
 cbuffer namelessdead {
     int a;
 };
 
-cbuffer namedDead {
-    int b;
-} bblock;
-
 struct N1 {
     float a;
 };
@@ -57,7 +40,7 @@ struct N3 {
 
 cbuffer nested {
     N3 foo;
-} nest;
+}
 
 struct TS {
     int a;
@@ -89,16 +72,12 @@ struct deep3 {
     int3 v3;
 };
 
-
-
-
 uniform deep3 deepA[2], deepB[2], deepC[3], deepD[2];
 
 const bool control = true;
 
 void deadFunction()
 {
-    float3 v3 = ablock.deadMember1;
     float4 v = anonDeadMember2;
     float f = ufDead4;
 }
@@ -110,12 +89,12 @@ void liveFunction2()
 }
 
 tbuffer abl {
-    float foo;
-} arrBl;
+    float foo1;
+}
 
 tbuffer abl2 {
-    float foo;
-} arrBl2;
+    float foo2;
+}
 
 void flizv(in float attributeFloat, in float2 attributeFloat2, in float3 attributeFloat3, in float4 attributeFloat4, in float4x4 attributeMat4)
 {
@@ -130,22 +109,16 @@ void flizv(in float attributeFloat, in float2 attributeFloat2, in float3 attribu
         liveFunction2();
         f = anonMember3.z;
         f = s.a;
-        f = ablock.scalar;
         f = m23[1].y + scalarAfterm23;
         f = c_m23[1].y + c_scalarAfterm23;
         f += scalarBeforeArray;
         f += floatArray[2];
         f += floatArray[4];
         f += scalarAfterArray;
-        f += ablock.memfloat2.x;
-        f += ablock.memf1;
-        f += float(ablock.memf2);
-        f += ablock.memf3;
-        f += ablock.memfloat2a.y;
-        f += ablock.m22[i][1][0];
+        f += m22[i][1][0];
         f += dm22[3][0][1];
         f += m22[2][1].y;
-        f += nest.foo.n1.a + nest.foo.n2.b + nest.foo.n2.c + nest.foo.n2.d;
+        f += foo.n1.a + foo.n2.b + foo.n2.c + foo.n2.d;
         f += deepA[i].d2.d1[2].va[1].x;
         f += deepB[1].d2.d1[i].va[1].x;
         f += deepB[i].d2.d1[i].va[1].x;
@@ -154,8 +127,8 @@ void flizv(in float attributeFloat, in float2 attributeFloat2, in float3 attribu
     } else
         f = ufDead3;
 
-    f += arrBl.foo + arrBl.foo;
-    f += arrBl2.foo;
+    f += foo1 + foo2;
+    f += foo2;
 
     f += attributeFloat;
     f += attributeFloat2.x;

+ 9 - 0
3rdparty/glslang/Test/hlsl.synthesizeInput.frag

@@ -0,0 +1,9 @@
+struct PSInput {
+  float interp;
+  uint no_interp;
+};
+
+float4 main(PSInput input : INPUT) : SV_TARGET
+{
+  return float4(float(input.no_interp), input.interp, 0, 1);
+}

+ 20 - 3
3rdparty/glslang/glslang/Include/Types.h

@@ -1338,7 +1338,24 @@ public:
 #else
     virtual bool isFloatingDomain() const { return basicType == EbtFloat || basicType == EbtDouble; }
 #endif
-
+    virtual bool isIntegerDomain() const
+    {
+        switch (basicType) {
+        case EbtInt:
+        case EbtUint:
+        case EbtInt64:
+        case EbtUint64:
+#ifdef AMD_EXTENSIONS
+        case EbtInt16:
+        case EbtUint16:
+#endif
+        case EbtAtomicUint:
+            return true;
+        default:
+            break;
+        }
+        return false;
+    }
     virtual bool isOpaque() const { return basicType == EbtSampler || basicType == EbtAtomicUint; }
 
     // "Image" is a superset of "Subpass"
@@ -1451,9 +1468,9 @@ public:
             case EbtUint16:
 #endif
             case EbtBool:
-            return true;
+                return true;
             default:
-            return false;
+                return false;
             }
         };
 

+ 3 - 1
3rdparty/glslang/glslang/MachineIndependent/reflection.cpp

@@ -725,7 +725,9 @@ void TReflection::buildCounterIndices()
 // Returns false if the input is too malformed to do this.
 bool TReflection::addStage(EShLanguage stage, const TIntermediate& intermediate)
 {
-    if (intermediate.getNumEntryPoints() != 1 || intermediate.isRecursive())
+    if (intermediate.getTreeRoot() == nullptr ||
+        intermediate.getNumEntryPoints() != 1 ||
+        intermediate.isRecursive())
         return false;
 
     buildAttributeReflection(stage, intermediate);

+ 6 - 0
3rdparty/glslang/gtests/Hlsl.FromFile.cpp

@@ -97,6 +97,11 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.cast.frag", "PixelShaderFunction"},
         {"hlsl.charLit.vert", "main"},
         {"hlsl.clip.frag", "main"},
+        {"hlsl.clipdistance-1.vert", "main"},
+        {"hlsl.clipdistance-2.vert", "main"},
+        {"hlsl.clipdistance-3.vert", "main"},
+        {"hlsl.clipdistance-4.vert", "main"},
+        {"hlsl.clipdistance-5.vert", "main"},
         {"hlsl.comparison.vec.frag", "main"},
         {"hlsl.conditional.frag", "PixelShaderFunction"},
         {"hlsl.constantbuffer.frag", "main"},
@@ -275,6 +280,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.structin.vert", "main"},
         {"hlsl.structIoFourWay.frag", "main"},
         {"hlsl.structStructName.frag", "main"},
+        {"hlsl.synthesizeInput.frag", "main"},
         {"hlsl.texture.subvec4.frag", "main"},
         {"hlsl.this.frag", "main"},
         {"hlsl.intrinsics.vert", "VertexShaderFunction"},

+ 28 - 22
3rdparty/glslang/hlsl/hlslGrammar.cpp

@@ -296,7 +296,8 @@ bool HlslGrammar::acceptSamplerDeclarationDX9(TType& /*type*/)
 
 // declaration
 //      : sampler_declaration_dx9 post_decls SEMICOLON
-//      | fully_specified_type declarator_list SEMICOLON(optional for cbuffer/tbuffer)
+//      | fully_specified_type                           // for cbuffer/tbuffer
+//      | fully_specified_type declarator_list SEMICOLON // for non cbuffer/tbuffer
 //      | fully_specified_type identifier function_parameters post_decls compound_statement  // function definition
 //      | fully_specified_type identifier sampler_state post_decls compound_statement        // sampler definition
 //      | typedef declaration
@@ -370,11 +371,19 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
     // if (acceptSamplerDeclarationDX9(declaredType))
     //     return true;
 
+    bool forbidDeclarators = (peekTokenClass(EHTokCBuffer) || peekTokenClass(EHTokTBuffer));
     // fully_specified_type
     if (! acceptFullySpecifiedType(declaredType, nodeList))
         return false;
 
-    // identifier
+    // cbuffer and tbuffer end with the closing '}'.
+    // No semicolon is included.
+    if (forbidDeclarators)
+        return true;
+
+    // declarator_list
+    //    : declarator
+    //         : identifier
     HlslToken idToken;
     TIntermAggregate* initializers = nullptr;
     while (acceptIdentifier(idToken)) {
@@ -483,11 +492,10 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
             }
         }
 
-        if (acceptTokenClass(EHTokComma)) {
+        // COMMA
+        if (acceptTokenClass(EHTokComma))
             declarator_list = true;
-            continue;
-        }
-    };
+    }
 
     // The top-level initializer node is a sequence.
     if (initializers != nullptr)
@@ -499,18 +507,15 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
     else
         nodeList = initializers;
 
-    // SEMICOLON(optional for cbuffer/tbuffer)
+    // SEMICOLON
     if (! acceptTokenClass(EHTokSemicolon)) {
+        // This may have been a false detection of what appeared to be a declaration, but
+        // was actually an assignment such as "float = 4", where "float" is an identifier.
+        // We put the token back to let further parsing happen for cases where that may
+        // happen.  This errors on the side of caution, and mostly triggers the error.
         if (peek() == EHTokAssign || peek() == EHTokLeftBracket || peek() == EHTokDot || peek() == EHTokComma) {
-            // This may have been a false detection of what appeared to be a declaration, but
-            // was actually an assignment such as "float = 4", where "float" is an identifier.
-            // We put the token back to let further parsing happen for cases where that may
-            // happen.  This errors on the side of caution, and mostly triggers the error.
             recedeToken();
             return false;
-        } else if (declaredType.getBasicType() == EbtBlock) {
-            // cbuffer, et. al. (but not struct) don't have an ending semicolon
-            return true;
         } else {
             expected(";");
             return false;
@@ -675,10 +680,10 @@ bool HlslGrammar::acceptQualifier(TQualifier& qualifier)
             qualifier.noContraction = true;
             break;
         case EHTokIn:
-            qualifier.storage = EvqIn;
+            qualifier.storage = (qualifier.storage == EvqOut) ? EvqInOut : EvqIn;
             break;
         case EHTokOut:
-            qualifier.storage = EvqOut;
+            qualifier.storage = (qualifier.storage == EvqIn) ? EvqInOut : EvqOut;
             break;
         case EHTokInOut:
             qualifier.storage = EvqInOut;
@@ -1901,18 +1906,19 @@ bool HlslGrammar::acceptStruct(TType& type, TIntermNode*& nodeList)
     TStorageQualifier storageQualifier = EvqTemporary;
     bool readonly = false;
 
-    // CBUFFER
     if (acceptTokenClass(EHTokCBuffer)) {
+        // CBUFFER
         storageQualifier = EvqUniform;
-    // TBUFFER
     } else if (acceptTokenClass(EHTokTBuffer)) {
+        // TBUFFER
         storageQualifier = EvqBuffer;
         readonly = true;
-    }
-    // CLASS
-    // STRUCT
-    else if (! acceptTokenClass(EHTokClass) && ! acceptTokenClass(EHTokStruct))
+    } else if (! acceptTokenClass(EHTokClass) && ! acceptTokenClass(EHTokStruct)) {
+        // Neither CLASS nor STRUCT
         return false;
+    }
+
+    // Now known to be one of CBUFFER, TBUFFER, CLASS, or STRUCT
 
     // IDENTIFIER
     TString structName = "";

+ 206 - 45
3rdparty/glslang/hlsl/hlslParseHelper.cpp

@@ -693,7 +693,7 @@ TIntermTyped* HlslParseContext::handleVariable(const TSourceLoc& loc, const TStr
         }
 
         // Recovery, if it wasn't found or was not a variable.
-        if (! variable) {
+        if (variable == nullptr) {
             error(loc, "unknown variable", string->c_str(), "");
             variable = new TVariable(string, TType(EbtVoid));
         }
@@ -791,7 +791,7 @@ TIntermTyped* HlslParseContext::handleBracketDereference(const TSourceLoc& loc,
     index = makeIntegerIndex(index);
 
     if (index == nullptr) {
-        error(loc, " unknown undex type ", "", "");
+        error(loc, " unknown index type ", "", "");
         return nullptr;
     }
 
@@ -867,7 +867,7 @@ void HlslParseContext::checkIndex(const TSourceLoc& /*loc*/, const TType& /*type
 TIntermTyped* HlslParseContext::handleBinaryMath(const TSourceLoc& loc, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right)
 {
     TIntermTyped* result = intermediate.addBinaryMath(op, left, right, loc);
-    if (! result)
+    if (result == nullptr)
         binaryOpError(loc, str, left->getCompleteString(), right->getCompleteString());
 
     return result;
@@ -1492,9 +1492,25 @@ void HlslParseContext::fixBuiltInIoType(TType& type)
     switch (type.getQualifier().builtIn) {
     case EbvTessLevelOuter: requiredArraySize = 4; break;
     case EbvTessLevelInner: requiredArraySize = 2; break;
-    case EbvClipDistance:   // TODO: ...
-    case EbvCullDistance:   // TODO: ...
-        return;
+
+    case EbvClipDistance:
+    case EbvCullDistance:
+        {
+            // ClipDistance and CullDistance are handled specially in the entry point output 
+            // copy algorithm, because they may need to be unpacked from components of vectors
+            // (or a scalar) into a float array.  Here, we make the array the right size and type,
+            // which is the number of components per vector times the array size (or 1 if not
+            // an array).  The copy itself is handled in assignClipCullDistance().
+            requiredArraySize = type.getVectorSize() * (type.isArray() ? type.getOuterArraySize() : 1);
+
+            TType clipCullType(EbtFloat, type.getQualifier().storage, 1);
+
+            clipCullType.getQualifier() = type.getQualifier();
+            type.shallowCopy(clipCullType);
+
+            break;
+        }
+
     case EbvTessCoord:
         {
             // tesscoord is always a vec3 for the IO variable, no matter the shader's
@@ -1525,15 +1541,15 @@ void HlslParseContext::fixBuiltInIoType(TType& type)
 }
 
 // Variables that correspond to the user-interface in and out of a stage
-// (not the built-in interface) are assigned locations and
-// registered as a linkage node (part of the stage's external interface).
-//
+// (not the built-in interface) are
+//  - assigned locations
+//  - registered as a linkage node (part of the stage's external interface).
 // Assumes it is called in the order in which locations should be assigned.
-void HlslParseContext::assignLocations(TVariable& variable)
+void HlslParseContext::assignToInterface(TVariable& variable)
 {
     const auto assignLocation = [&](TVariable& variable) {
-        const TType& type = variable.getType();
-        const TQualifier& qualifier = type.getQualifier();
+        TType& type = variable.getWritableType();
+        TQualifier& qualifier = type.getQualifier();
         if (qualifier.storage == EvqVaryingIn || qualifier.storage == EvqVaryingOut) {
             if (qualifier.builtIn == EbvNone) {
                 // Strip off the outer array dimension for those having an extra one.
@@ -1552,7 +1568,6 @@ void HlslParseContext::assignLocations(TVariable& variable)
                     nextOutLocation += size;
                 }
             }
-
             trackLinkage(variable);
         }
     };
@@ -1664,7 +1679,7 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
     TSymbol* symbol = symbolTable.find(function.getMangledName());
     TFunction* prevDec = symbol ? symbol->getAsFunction() : nullptr;
 
-    if (! prevDec)
+    if (prevDec == nullptr)
         error(loc, "can't find function", function.getName().c_str(), "");
     // Note:  'prevDec' could be 'function' if this is the first time we've seen function
     // as it would have just been put in the symbol table.  Otherwise, we're looking up
@@ -1914,9 +1929,11 @@ void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const T
 //        ret = @shaderEntryPoint(args...);
 //        oargs = args<that are output>...;
 //    }
+//    retType @shaderEntryPoint(args...)
+//    { body }
 //
 // The symbol table will still map the original entry point name to the
-// the modified function and it's new name:
+// the modified function and its new name:
 //
 //    symbol table:  shaderEntryPoint  ->   @shaderEntryPoint
 //
@@ -1966,7 +1983,7 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
                 split(variable);
         }
 
-        assignLocations(variable);
+        assignToInterface(variable);
     };
     if (entryPointOutput)
         makeVariableInOut(*entryPointOutput);
@@ -2012,11 +2029,8 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
     for (int i = 0; i < userFunction.getParamCount(); i++) {
         TParameter& param = userFunction[i];
         argVars.push_back(makeInternalVariable(*param.name, *param.type));
-
         argVars.back()->getWritableType().getQualifier().makeTemporary();
-
         TIntermSymbol* arg = intermediate.addSymbol(*argVars.back());
-
         handleFunctionArgument(&callee, callingArgs, arg);
         if (param.type->getQualifier().isParamInput()) {
             intermediate.growAggregate(synthBody, handleAssign(loc, EOpAssign, arg,
@@ -2062,7 +2076,6 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
         } else {
             returnAssign = handleAssign(loc, EOpAssign, intermediate.addSymbol(*entryPointOutput), callReturn);
         }
-        
         intermediate.growAggregate(synthBody, returnAssign);
     } else
         intermediate.growAggregate(synthBody, callReturn);
@@ -2120,12 +2133,63 @@ void HlslParseContext::handleFunctionBody(const TSourceLoc& loc, TFunction& func
 void HlslParseContext::remapEntryPointIO(TFunction& function, TVariable*& returnValue,
     TVector<TVariable*>& inputs, TVector<TVariable*>& outputs)
 {
+    // We might have in input structure type with no decorations that caused it
+    // to look like an input type, yet it has (e.g.) interpolation types that
+    // must be modified that turn it into an input type.
+    // Hence, a missing ioTypeMap for 'input' might need to be synthesized.
+    const auto synthesizeEditedInput = [this](TType& type) {
+        // True if a type needs to be 'flat'
+        const auto needsFlat = [](const TType& type) {
+            return type.containsBasicType(EbtInt) ||
+                    type.containsBasicType(EbtUint) ||
+                    type.containsBasicType(EbtInt64) ||
+                    type.containsBasicType(EbtUint64) ||
+                    type.containsBasicType(EbtBool) ||
+                    type.containsBasicType(EbtDouble);
+        };
+
+        if (language == EShLangFragment && needsFlat(type)) {
+            if (type.isStruct()) {
+                TTypeList* finalList = nullptr;
+                auto it = ioTypeMap.find(type.getStruct());
+                if (it == ioTypeMap.end() || it->second.input == nullptr) {
+                    // Getting here means we have no input struct, but we need one.
+                    auto list = new TTypeList;
+                    for (auto member = type.getStruct()->begin(); member != type.getStruct()->end(); ++member) {
+                        TType* newType = new TType;
+                        newType->shallowCopy(*member->type);
+                        TTypeLoc typeLoc = { newType, member->loc };
+                        list->push_back(typeLoc);
+                    }
+                    // install the new input type
+                    if (it == ioTypeMap.end()) {
+                        tIoKinds newLists = { list, nullptr, nullptr };
+                        ioTypeMap[type.getStruct()] = newLists;
+                    } else
+                        it->second.input = list;
+                    finalList = list;
+                } else
+                    finalList = it->second.input;
+                // edit for 'flat'
+                for (auto member = finalList->begin(); member != finalList->end(); ++member) {
+                    if (needsFlat(*member->type)) {
+                        member->type->getQualifier().clearInterpolation();
+                        member->type->getQualifier().flat = true;
+                    }
+                }
+            } else {
+                type.getQualifier().clearInterpolation();
+                type.getQualifier().flat = true;
+            }
+        }
+    };
+
     // Do the actual work to make a type be a shader input or output variable,
     // and clear the original to be non-IO (for use as a normal function parameter/return).
     const auto makeIoVariable = [this](const char* name, TType& type, TStorageQualifier storage) -> TVariable* {
         TVariable* ioVariable = makeInternalVariable(name, type);
         clearUniformInputOutput(type.getQualifier());
-        if (type.getStruct() != nullptr) {
+        if (type.isStruct()) {
             auto newLists = ioTypeMap.find(ioVariable->getType().getStruct());
             if (newLists != ioTypeMap.end()) {
                 if (storage == EvqVaryingIn && newLists->second.input)
@@ -2178,6 +2242,7 @@ void HlslParseContext::remapEntryPointIO(TFunction& function, TVariable*& return
     for (int i = 0; i < function.getParamCount(); i++) {
         TType& paramType = *function[i].type;
         if (paramType.getQualifier().isParamInput()) {
+            synthesizeEditedInput(paramType);
             TVariable* argAsGlobal = makeIoVariable(function[i].name->c_str(), paramType, EvqVaryingIn);
             inputs.push_back(argAsGlobal);
 
@@ -2241,6 +2306,88 @@ void HlslParseContext::handleFunctionArgument(TFunction* function,
         arguments = newArg;
 }
 
+// Clip and cull distance require special handling due to a semantic mismatch.  In HLSL,
+// these can be float scalar, float vector, or arrays of float scalar or float vector.
+// In SPIR-V, they are arrays of scalar floats in all cases.  We must copy individual components
+// (e.g, both x and y components of a float2) out into the destination float array.
+//
+// The values are assigned to sequential members of the output array.  The inner dimension
+// is vector components.  The outer dimension is array elements.
+TIntermAggregate* HlslParseContext::assignClipCullDistance(const TSourceLoc& loc, TOperator op,
+                                                           TIntermTyped* left, TIntermTyped* right)
+{
+    // ***
+    // TODO: this does not yet handle the index coming from the semantic's ID, as in SV_ClipDistance[012345...]
+    // ***
+
+    // left has got to be an array of scalar floats, per SPIR-V semantics.
+    // fixBuiltInIoType() should have handled that upstream.
+    assert(left->getType().isArray());
+    assert(left->getType().getVectorSize() == 1);
+    assert(left->getType().getBasicType() == EbtFloat);
+
+    // array sizes, or 1 if it's not an array:
+    const int lhsArraySize = (left->getType().isArray() ? left->getType().getOuterArraySize() : 1);
+    const int rhsArraySize = (right->getType().isArray() ? right->getType().getOuterArraySize() : 1);
+    // vector sizes:
+    const int lhsVectorSize = left->getType().getVectorSize();
+    const int rhsVectorSize = right->getType().getVectorSize();
+
+    // We may be creating multiple sub-assignments.  This is an aggregate to hold them.
+    // TODO: it would be possible to be clever sometimes and avoid the sequence node if not needed.
+    TIntermAggregate* assignList = nullptr;
+
+    // If the types are homomorphic, use a simple assign.  No need to mess about with 
+    // individual components.
+    if (left->getType().isArray() == right->getType().isArray() &&
+        lhsArraySize == rhsArraySize &&
+        lhsVectorSize == rhsVectorSize) {
+        assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, left, right, loc));
+        assignList->setOperator(EOpSequence);
+        return assignList;
+    }
+
+    // We are going to copy each component of the right (per array element if indicated) to sequential
+    // array elements of the left.  This tracks the lhs element we're writing to as we go along.
+    int lhsArrayPos = 0;
+
+    // Loop through every component of every element of the RHS, and copy to LHS elements in turn.
+    for (int rhsArrayPos = 0; rhsArrayPos < rhsArraySize; ++rhsArrayPos) {
+        for (int rhsComponent = 0; rhsComponent < rhsVectorSize; ++rhsComponent) {
+            // LHS array member to write to:
+            TIntermTyped* lhsMember = intermediate.addIndex(EOpIndexDirect, left,
+                                                            intermediate.addConstantUnion(lhsArrayPos++, loc), loc);
+
+            TIntermTyped* rhsMember = right;
+
+            // If right is an array, extract the element of interest
+            if (right->getType().isArray()) {
+                const TType derefType(rhsMember->getType(), 0);
+                rhsMember = intermediate.addIndex(EOpIndexDirect, rhsMember,
+                                                  intermediate.addConstantUnion(rhsArrayPos, loc), loc);
+                rhsMember->setType(derefType);
+            }
+
+            // If right is a vector, extract the component of interest.
+            if (right->getType().isVector()) {
+                const TType derefType(rhsMember->getType(), 0);
+                rhsMember = intermediate.addIndex(EOpIndexDirect, rhsMember,
+                                                  intermediate.addConstantUnion(rhsComponent, loc), loc);
+                rhsMember->setType(derefType);
+            }
+
+            // Assign: to the proper lhs member.
+            assignList = intermediate.growAggregate(assignList,
+                                                    intermediate.addAssign(op, lhsMember, rhsMember, loc));
+        }
+    }
+
+    assert(assignList != nullptr);
+    assignList->setOperator(EOpSequence);
+
+    return assignList;
+}
+
 // Some simple source assignments need to be flattened to a sequence
 // of AST assignments. Catch these and flatten, otherwise, pass through
 // to intermediate.addAssign().
@@ -2263,8 +2410,14 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
 
     // OK to do a single assign if both are split, or both are unsplit.  But if one is and the other
     // isn't, we fall back to a member-wise copy.
-    if (! isFlattenLeft && ! isFlattenRight && !isSplitLeft && !isSplitRight)
+    if (! isFlattenLeft && ! isFlattenRight && !isSplitLeft && !isSplitRight) {
+        // Clip and cull distance requires more processing.  See comment above assignClipCullDistance.
+        const TBuiltInVariable leftBuiltIn = left->getType().getQualifier().builtIn;
+        if (leftBuiltIn == EbvClipDistance || leftBuiltIn == EbvCullDistance)
+            return assignClipCullDistance(loc, op, left, right);
+
         return intermediate.addAssign(op, left, right, loc);
+    }
 
     TIntermAggregate* assignList = nullptr;
     const TVector<TVariable*>* leftVariables = nullptr;
@@ -2425,13 +2578,21 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
                 TIntermTyped* subSplitLeft =  isSplitLeft  ? getMember(true,  left,  member, splitLeft, memberL) : subLeft;
                 TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right, member, splitRight, memberR) : subRight;
 
-                // If this is the final flattening (no nested types below to flatten) we'll copy the member, else
-                // recurse into the type hierarchy.  However, if splitting the struct, that means we can copy a whole
-                // subtree here IFF it does not itself contain any interstage built-in IO variables, so we only have to
-                // recurse into it if there's something for splitting to do.  That can save a lot of AST verbosity for
-                // a bunch of memberwise copies.
-                if ((!isFlattenLeft && !isFlattenRight &&
-                     !typeL.containsBuiltInInterstageIO(language) && !typeR.containsBuiltInInterstageIO(language))) {
+                const TBuiltInVariable leftBuiltIn = subSplitLeft->getType().getQualifier().builtIn;
+
+                if (leftBuiltIn == EbvClipDistance || leftBuiltIn == EbvCullDistance) {
+
+                    // Clip and cull distance builtin assignment is complex in its own right, and is handled in
+                    // a separate function dedicated to that task.  See comment above assignClipCullDistance;
+                    assignList = intermediate.growAggregate(assignList, assignClipCullDistance(loc, op, subSplitLeft, subSplitRight), loc);
+                } else if ((!isFlattenLeft && !isFlattenRight &&
+                            !typeL.containsBuiltInInterstageIO(language) && !typeR.containsBuiltInInterstageIO(language))) {
+                    // If this is the final flattening (no nested types below to flatten) we'll copy the member, else
+                    // recurse into the type hierarchy.  However, if splitting the struct, that means we can copy a whole
+                    // subtree here IFF it does not itself contain any interstage built-in IO variables, so we only have to
+                    // recurse into it if there's something for splitting to do.  That can save a lot of AST verbosity for
+                    // a bunch of memberwise copies.
+
                     assignList = intermediate.growAggregate(assignList, intermediate.addAssign(op, subSplitLeft, subSplitRight, loc), loc);
                 } else {
                     traverse(subLeft, subRight, subSplitLeft, subSplitRight);
@@ -3031,7 +3192,7 @@ TIntermConstantUnion* HlslParseContext::getSamplePosArray(int count)
 //
 void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermTyped*& node, TIntermNode* arguments)
 {
-    if (!node || !node->getAsOperator())
+    if (node == nullptr || !node->getAsOperator())
         return;
 
     const auto clampReturn = [&loc, &node, this](TIntermTyped* result, const TSampler& sampler) -> TIntermTyped* {
@@ -3773,7 +3934,7 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
 //
 void HlslParseContext::decomposeGeometryMethods(const TSourceLoc& loc, TIntermTyped*& node, TIntermNode* arguments)
 {
-    if (!node || !node->getAsOperator())
+    if (node == nullptr || !node->getAsOperator())
         return;
 
     const TOperator op  = node->getAsOperator()->getOp();
@@ -4967,7 +5128,7 @@ void HlslParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fn
         }
 
         if (arg > 0) {
-            if (! aggArgs[arg]->getAsConstantUnion())
+            if (aggArgs[arg]->getAsConstantUnion() == nullptr)
                 error(loc, "argument must be compile-time constant", "texel offset", "");
             else {
                 const TType& type = aggArgs[arg]->getAsTyped()->getType();
@@ -5706,7 +5867,7 @@ void HlslParseContext::arrayDimMerge(TType& type, const TArraySizes* sizes)
 //
 void HlslParseContext::declareArray(const TSourceLoc& loc, const TString& identifier, const TType& type, TSymbol*& symbol, bool track)
 {
-    if (! symbol) {
+    if (symbol == nullptr) {
         bool currentScope;
         symbol = symbolTable.find(identifier, nullptr, &currentScope);
 
@@ -5737,7 +5898,7 @@ void HlslParseContext::declareArray(const TSourceLoc& loc, const TString& identi
     // Process a redeclaration.
     //
 
-    if (! symbol) {
+    if (symbol == nullptr) {
         error(loc, "array variable name expected", identifier.c_str(), "");
         return;
     }
@@ -5856,7 +6017,7 @@ void HlslParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& n
     // If the block was not found, this must be a version/profile/stage
     // that doesn't have it, or the instance name is wrong.
     const char* errorName = instanceName ? instanceName->c_str() : newTypeList.front().type->getFieldName().c_str();
-    if (! block) {
+    if (block == nullptr) {
         error(loc, "no declaration found for redeclaration", errorName, "");
         return;
     }
@@ -6967,7 +7128,7 @@ TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, const TStr
         declareArray(loc, identifier, type, symbol, !flattenVar);
     } else {
         // non-array case
-        if (! symbol)
+        if (symbol == nullptr)
             symbol = declareNonArray(loc, identifier, type, !flattenVar);
         else if (type != symbol->getType())
             error(loc, "cannot change the type of", "redeclaration", symbol->getName().c_str());
@@ -6976,7 +7137,7 @@ TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, const TStr
     if (flattenVar)
         flatten(loc, *symbol->getAsVariable());
 
-    if (! symbol)
+    if (symbol == nullptr)
         return nullptr;
 
     // Deal with initializer
@@ -6993,7 +7154,7 @@ TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, const TStr
 */
 
         TVariable* variable = symbol->getAsVariable();
-        if (! variable) {
+        if (variable == nullptr) {
             error(loc, "initializer requires a variable, not a member", identifier.c_str(), "");
             return nullptr;
         }
@@ -7089,7 +7250,7 @@ TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TInterm
     skeletalType.getQualifier().makeTemporary();
     if (initializer->getAsAggregate() && initializer->getAsAggregate()->getOp() == EOpNull)
         initializer = convertInitializerList(loc, skeletalType, initializer, nullptr);
-    if (! initializer) {
+    if (initializer == nullptr) {
         // error recovery; don't leave const without constant values
         if (qualifier == EvqConst)
             variable->getWritableType().getQualifier().storage = EvqTemporary;
@@ -7152,7 +7313,7 @@ TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TInterm
         specializationCheck(loc, initializer->getType(), "initializer");
         TIntermSymbol* intermSymbol = intermediate.addSymbol(*variable, loc);
         TIntermNode* initNode = handleAssign(loc, EOpAssign, intermSymbol, initializer);
-        if (! initNode)
+        if (initNode == nullptr)
             assignError(loc, "=", intermSymbol->getCompleteString(), initializer->getCompleteString());
 
         return initNode;
@@ -7182,7 +7343,7 @@ TIntermTyped* HlslParseContext::convertInitializerList(const TSourceLoc& loc, co
 
     // see if we have bottomed out in the tree within the initializer-list part
     TIntermAggregate* initList = initializer->getAsAggregate();
-    if (! initList || initList->getOp() != EOpNull) {
+    if (initList == nullptr || initList->getOp() != EOpNull) {
         // We don't have a list, but if it's a scalar and the 'type' is a
         // composite, we need to lengthen below to make it useful.
         // Otherwise, this is an already formed object to initialize with.
@@ -7650,7 +7811,7 @@ TIntermTyped* HlslParseContext::constructAggregate(TIntermNode* node, const TTyp
 {
     // Handle cases that map more 1:1 between constructor arguments and constructed.
     TIntermTyped* converted = intermediate.addConversion(EOpConstructStruct, type, node->getAsTyped());
-    if (! converted || converted->getType() != type) {
+    if (converted == nullptr || converted->getType() != type) {
         error(loc, "", "constructor", "cannot convert parameter %d from '%s' to '%s'", paramCount,
             node->getAsTyped()->getType().getCompleteString().c_str(), type.getCompleteString().c_str());
 
@@ -7803,7 +7964,7 @@ void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TS
 
     // Add the variable, as anonymous or named instanceName.
     // Make an anonymous variable if no name was provided.
-    if (! instanceName)
+    if (instanceName == nullptr)
         instanceName = NewPoolTString("");
 
     TVariable& variable = *new TVariable(instanceName, blockType);
@@ -7953,7 +8114,7 @@ void HlslParseContext::fixBlockUniformOffsets(const TQualifier& qualifier, TType
 void HlslParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qualifier, const TString& identifier)
 {
     TSymbol* symbol = symbolTable.find(identifier);
-    if (! symbol) {
+    if (symbol == nullptr) {
         error(loc, "identifier not previously declared", identifier.c_str(), "");
         return;
     }
@@ -8842,7 +9003,7 @@ void HlslParseContext::addPatchConstantInvocation()
         if (pcfOutput->getType().containsBuiltInInterstageIO(language))
             split(*pcfOutput);
 
-        assignLocations(*pcfOutput);
+        assignToInterface(*pcfOutput);
 
         TIntermSymbol* pcfOutputSym = intermediate.addSymbol(*pcfOutput, loc);
 

+ 2 - 1
3rdparty/glslang/hlsl/hlslParseHelper.h

@@ -77,7 +77,7 @@ public:
     TIntermTyped* handleUnaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* childNode);
     TIntermTyped* handleDotDereference(const TSourceLoc&, TIntermTyped* base, const TString& field);
     bool isBuiltInMethod(const TSourceLoc&, TIntermTyped* base, const TString& field);
-    void assignLocations(TVariable& variable);
+    void assignToInterface(TVariable& variable);
     void handleFunctionDeclarator(const TSourceLoc&, TFunction& function, bool prototype);
     TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&, const TAttributeMap&, TIntermNode*& entryPointTree);
     TIntermNode* transformEntryPoint(const TSourceLoc&, TFunction&, const TAttributeMap&);
@@ -90,6 +90,7 @@ public:
     TIntermTyped* handleAssign(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right);
     TIntermTyped* handleAssignToMatrixSwizzle(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right);
     TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermTyped*);
+    TIntermAggregate* assignClipCullDistance(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right);
     void decomposeIntrinsic(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
     void decomposeSampleMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
     void decomposeStructBufferMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);