Ver Fonte

Updated glslang.

Branimir Karadžić há 8 anos atrás
pai
commit
a6daca505b
35 ficheiros alterados com 2526 adições e 200 exclusões
  1. 6 0
      3rdparty/glslang/README.md
  2. 9 1
      3rdparty/glslang/SPIRV/GlslangToSpv.cpp
  3. 11 11
      3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out
  4. 48 0
      3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset.frag.out
  5. 176 0
      3rdparty/glslang/Test/baseResults/hlsl.attributeC11.frag.out
  6. 48 24
      3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInit.vert.out
  7. 218 0
      3rdparty/glslang/Test/baseResults/hlsl.flattenSubset.frag.out
  8. 207 0
      3rdparty/glslang/Test/baseResults/hlsl.flattenSubset2.frag.out
  9. 64 0
      3rdparty/glslang/Test/baseResults/hlsl.localStructuredBuffer.comp.out
  10. 157 0
      3rdparty/glslang/Test/baseResults/hlsl.samplecmp.dualmode.frag.out
  11. 778 0
      3rdparty/glslang/Test/baseResults/hlsl.subpass.frag.out
  12. 69 68
      3rdparty/glslang/Test/baseResults/spv.atomic.comp.out
  13. 76 0
      3rdparty/glslang/Test/baseResults/spv.register.subpass.frag.out
  14. 18 0
      3rdparty/glslang/Test/hlsl.attributeC11.frag
  15. 3 2
      3rdparty/glslang/Test/hlsl.flattenOpaqueInit.vert
  16. 36 0
      3rdparty/glslang/Test/hlsl.flattenSubset.frag
  17. 24 0
      3rdparty/glslang/Test/hlsl.flattenSubset2.frag
  18. 4 0
      3rdparty/glslang/Test/hlsl.localStructuredBuffer.comp
  19. 14 0
      3rdparty/glslang/Test/hlsl.samplecmp.dualmode.frag
  20. 113 0
      3rdparty/glslang/Test/hlsl.subpass.frag
  21. 15 0
      3rdparty/glslang/Test/spv.register.subpass.frag
  22. 3 2
      3rdparty/glslang/glslang/Include/intermediate.h
  23. 7 0
      3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp
  24. 2 1
      3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp
  25. 8 1
      3rdparty/glslang/gtests/Hlsl.FromFile.cpp
  26. 1 0
      3rdparty/glslang/gtests/Spv.FromFile.cpp
  27. 19 3
      3rdparty/glslang/hlsl/hlslAttributes.cpp
  28. 5 2
      3rdparty/glslang/hlsl/hlslAttributes.h
  29. 120 10
      3rdparty/glslang/hlsl/hlslGrammar.cpp
  30. 1 0
      3rdparty/glslang/hlsl/hlslGrammar.h
  31. 190 55
      3rdparty/glslang/hlsl/hlslParseHelper.cpp
  32. 27 5
      3rdparty/glslang/hlsl/hlslParseHelper.h
  33. 43 15
      3rdparty/glslang/hlsl/hlslParseables.cpp
  34. 4 0
      3rdparty/glslang/hlsl/hlslScanContext.cpp
  35. 2 0
      3rdparty/glslang/hlsl/hlslTokens.h

+ 6 - 0
3rdparty/glslang/README.md

@@ -52,6 +52,7 @@ Building
 ### Dependencies
 
 * [CMake][cmake]: for generating compilation targets.
+* [Python 2.7][python]: for executing SPIRV-Tools scripts. (Optional if not using SPIRV-Tools.)
 * [bison][bison]: _optional_, but needed when changing the grammar (glslang.y).
 * [googletest][googletest]: _optional_, but should use if making any changes to glslang.
 
@@ -82,6 +83,10 @@ spirv-tools with this:
 ./update_glslang_sources.py
 ```
 
+For running the CMake GUI or Visual Studio with python dependencies, you will,
+in addition to python within the cygwin environment, need a Windows [python][python]
+installation, including selecting the `PATH` update.
+
 #### 3) Configure
 
 Assume the source directory is `$SOURCE_DIR` and
@@ -309,6 +314,7 @@ Basic Internal Operation
 
 
 [cmake]: https://cmake.org/
+[python]: https://www.python.org/
 [bison]: https://www.gnu.org/software/bison/
 [googletest]: https://github.com/google/googletest
 [bison-gnu-win32]: http://gnuwin32.sourceforge.net/packages/bison.htm

+ 9 - 1
3rdparty/glslang/SPIRV/GlslangToSpv.cpp

@@ -4833,6 +4833,7 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
     //  - there are extra SPV operands with no glslang source
     //  - compare-exchange swaps the value and comparator
     //  - compare-exchange has an extra memory semantics
+    //  - EOpAtomicCounterDecrement needs a post decrement
     std::vector<spv::Id> spvAtomicOperands;  // hold the spv operands
     auto opIt = operands.begin();            // walk the glslang operands
     spvAtomicOperands.push_back(*(opIt++));
@@ -4851,7 +4852,14 @@ spv::Id TGlslangToSpvTraverser::createAtomicOperation(glslang::TOperator op, spv
     for (; opIt != operands.end(); ++opIt)
         spvAtomicOperands.push_back(*opIt);
 
-    return builder.createOp(opCode, typeId, spvAtomicOperands);
+    spv::Id resultId = builder.createOp(opCode, typeId, spvAtomicOperands);
+
+    // GLSL and HLSL atomic-counter decrement return post-decrement value,
+    // while SPIR-V returns pre-decrement value. Translate between these semantics.
+    if (op == glslang::EOpAtomicCounterDecrement)
+        resultId = builder.createBinOp(spv::OpISub, typeId, resultId, builder.makeIntConstant(1));
+
+    return resultId;
 }
 
 // Create group invocation operations.

+ 11 - 11
3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out

@@ -2,12 +2,12 @@ hlsl.flattenOpaqueInit.vert
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 117
+// Id's are bound by 125
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 78
+                              EntryPoint Vertex 4  "main" 82
                               Source HLSL 500
                               Name 4  "main"
                               Name 17  "FxaaTex"
@@ -15,10 +15,10 @@ WARNING: AST will form illegal SPIR-V; need to transform to legalize
                               MemberName 17(FxaaTex) 1  "tex"
                               Name 38  "g_tInputTexture_sampler"
                               Name 42  "g_tInputTexture"
-                              Name 78  "@entryPointOutput"
+                              Name 82  "@entryPointOutput"
                               Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
                               Decorate 42(g_tInputTexture) DescriptorSet 0
-                              Decorate 78(@entryPointOutput) Location 0
+                              Decorate 82(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeSampler
@@ -36,14 +36,14 @@ WARNING: AST will form illegal SPIR-V; need to transform to legalize
 38(g_tInputTexture_sampler):     37(ptr) Variable UniformConstant
               41:             TypePointer UniformConstant 9
 42(g_tInputTexture):     41(ptr) Variable UniformConstant
-              77:             TypePointer Output 11(fvec4)
-78(@entryPointOutput):     77(ptr) Variable Output
+              81:             TypePointer Output 11(fvec4)
+82(@entryPointOutput):     81(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-              90:           6 Load 38(g_tInputTexture_sampler)
-              91:           9 Load 42(g_tInputTexture)
-             115:          26 SampledImage 91 90
-             116:   11(fvec4) ImageSampleExplicitLod 115 31 Lod 32
-                              Store 78(@entryPointOutput) 116
+              96:           6 Load 38(g_tInputTexture_sampler)
+              97:           9 Load 42(g_tInputTexture)
+             123:          26 SampledImage 97 96
+             124:   11(fvec4) ImageSampleExplicitLod 123 31 Lod 32
+                              Store 82(@entryPointOutput) 124
                               Return
                               FunctionEnd

+ 48 - 0
3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset.frag.out

@@ -0,0 +1,48 @@
+hlsl.flattenSubset.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 85
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 54 57
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 17  "samp"
+                              Name 41  "tex"
+                              Name 54  "vpos"
+                              Name 57  "@entryPointOutput"
+                              Decorate 17(samp) DescriptorSet 0
+                              Decorate 41(tex) DescriptorSet 0
+                              Decorate 54(vpos) Location 0
+                              Decorate 57(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+              13:             TypeSampler
+              16:             TypePointer UniformConstant 13
+        17(samp):     16(ptr) Variable UniformConstant
+              39:             TypeImage 6(float) 2D sampled format:Unknown
+              40:             TypePointer UniformConstant 39
+         41(tex):     40(ptr) Variable UniformConstant
+              44:             TypeSampledImage 39
+              46:             TypeVector 6(float) 2
+              47:    6(float) Constant 1056964608
+              48:   46(fvec2) ConstantComposite 47 47
+              53:             TypePointer Input 7(fvec4)
+        54(vpos):     53(ptr) Variable Input
+              56:             TypePointer Output 7(fvec4)
+57(@entryPointOutput):     56(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              74:          13 Load 17(samp)
+              81:          39 Load 41(tex)
+              83:          44 SampledImage 81 74
+              84:    7(fvec4) ImageSampleImplicitLod 83 48
+                              Store 57(@entryPointOutput) 84
+                              Return
+                              FunctionEnd

+ 176 - 0
3rdparty/glslang/Test/baseResults/hlsl.attributeC11.frag.out

@@ -0,0 +1,176 @@
+hlsl.attributeC11.frag
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:16  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:16    Function Parameters: 
+0:16      'input' ( in 4-component vector of float)
+0:?     Sequence
+0:17      Branch: Return with expression
+0:17        add ( temp 4-component vector of float)
+0:17          'input' ( in 4-component vector of float)
+0:17          textureFetch ( temp 4-component vector of float)
+0:17            'attach' ( uniform texture2D)
+0:17            vector swizzle ( temp int)
+0:17              Constant:
+0:17                0 (const int)
+0:17                0 (const int)
+0:17              Sequence
+0:17                Constant:
+0:17                  0 (const int)
+0:17            direct index ( temp int)
+0:17              Constant:
+0:17                0 (const int)
+0:17                0 (const int)
+0:17              Constant:
+0:17                1 (const int)
+0:16  Function Definition: main( ( temp void)
+0:16    Function Parameters: 
+0:?     Sequence
+0:16      move second child to first child ( temp 4-component vector of float)
+0:?         'input' ( temp 4-component vector of float)
+0:?         'input' (layout( location=8) in 4-component vector of float)
+0:16      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=7) out 4-component vector of float)
+0:16        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'input' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'buffer1' (layout( set=0 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data})
+0:?     'buffer3' (layout( set=2 binding=3 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data})
+0:?     'attach' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=7) out 4-component vector of float)
+0:?     'input' (layout( location=8) in 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:16  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:16    Function Parameters: 
+0:16      'input' ( in 4-component vector of float)
+0:?     Sequence
+0:17      Branch: Return with expression
+0:17        add ( temp 4-component vector of float)
+0:17          'input' ( in 4-component vector of float)
+0:17          textureFetch ( temp 4-component vector of float)
+0:17            'attach' ( uniform texture2D)
+0:17            vector swizzle ( temp int)
+0:17              Constant:
+0:17                0 (const int)
+0:17                0 (const int)
+0:17              Sequence
+0:17                Constant:
+0:17                  0 (const int)
+0:17            direct index ( temp int)
+0:17              Constant:
+0:17                0 (const int)
+0:17                0 (const int)
+0:17              Constant:
+0:17                1 (const int)
+0:16  Function Definition: main( ( temp void)
+0:16    Function Parameters: 
+0:?     Sequence
+0:16      move second child to first child ( temp 4-component vector of float)
+0:?         'input' ( temp 4-component vector of float)
+0:?         'input' (layout( location=8) in 4-component vector of float)
+0:16      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=7) out 4-component vector of float)
+0:16        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'input' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'buffer1' (layout( set=0 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data})
+0:?     'buffer3' (layout( set=2 binding=3 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data})
+0:?     'attach' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=7) out 4-component vector of float)
+0:?     'input' (layout( location=8) in 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 47
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 33 36
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 11  "@main(vf4;"
+                              Name 10  "input"
+                              Name 16  "attach"
+                              Name 31  "input"
+                              Name 33  "input"
+                              Name 36  "@entryPointOutput"
+                              Name 37  "param"
+                              Name 41  "S"
+                              MemberName 41(S) 0  "f"
+                              Name 43  "buffer1"
+                              MemberName 43(buffer1) 0  "@data"
+                              Name 45  "buffer1"
+                              Name 46  "buffer3"
+                              Decorate 16(attach) DescriptorSet 0
+                              Decorate 16(attach) InputAttachmentIndex 4
+                              Decorate 33(input) Location 8
+                              Decorate 36(@entryPointOutput) Location 7
+                              MemberDecorate 41(S) 0 Offset 0
+                              Decorate 42 ArrayStride 8
+                              MemberDecorate 43(buffer1) 0 NonWritable
+                              MemberDecorate 43(buffer1) 0 Offset 0
+                              Decorate 43(buffer1) BufferBlock
+                              Decorate 45(buffer1) DescriptorSet 0
+                              Decorate 45(buffer1) Binding 1
+                              Decorate 46(buffer3) DescriptorSet 2
+                              Decorate 46(buffer3) Binding 3
+               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:             TypeImage 6(float) 2D sampled format:Unknown
+              15:             TypePointer UniformConstant 14
+      16(attach):     15(ptr) Variable UniformConstant
+              18:             TypeInt 32 1
+              19:             TypeVector 18(int) 2
+              20:     18(int) Constant 0
+              21:   19(ivec2) ConstantComposite 20 20
+              22:             TypeInt 32 0
+              23:     22(int) Constant 0
+              25:     22(int) Constant 1
+              32:             TypePointer Input 7(fvec4)
+       33(input):     32(ptr) Variable Input
+              35:             TypePointer Output 7(fvec4)
+36(@entryPointOutput):     35(ptr) Variable Output
+              40:             TypeVector 6(float) 2
+           41(S):             TypeStruct 40(fvec2)
+              42:             TypeRuntimeArray 41(S)
+     43(buffer1):             TypeStruct 42
+              44:             TypePointer Uniform 43(buffer1)
+     45(buffer1):     44(ptr) Variable Uniform
+     46(buffer3):     44(ptr) Variable Uniform
+         4(main):           2 Function None 3
+               5:             Label
+       31(input):      8(ptr) Variable Function
+       37(param):      8(ptr) Variable Function
+              34:    7(fvec4) Load 33(input)
+                              Store 31(input) 34
+              38:    7(fvec4) Load 31(input)
+                              Store 37(param) 38
+              39:    7(fvec4) FunctionCall 11(@main(vf4;) 37(param)
+                              Store 36(@entryPointOutput) 39
+                              Return
+                              FunctionEnd
+  11(@main(vf4;):    7(fvec4) Function None 9
+       10(input):      8(ptr) FunctionParameter
+              12:             Label
+              13:    7(fvec4) Load 10(input)
+              17:          14 Load 16(attach)
+              24:     18(int) CompositeExtract 21 0
+              26:     18(int) CompositeExtract 21 1
+              27:    7(fvec4) ImageFetch 17 24 Lod 26
+              28:    7(fvec4) FAdd 13 27
+                              ReturnValue 28
+                              FunctionEnd

+ 48 - 24
3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInit.vert.out

@@ -65,10 +65,18 @@ Shader version: 500
 0:20              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:20              Constant:
 0:20                1 (const int)
-0:21      Branch: Return with expression
-0:21        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
-0:?           'tex1.smpl' ( temp sampler)
-0:?           'tex1.tex' ( temp texture2D)
+0:21      Sequence
+0:21        Sequence
+0:21          move second child to first child ( temp sampler)
+0:?             'tex3.smpl' ( temp sampler)
+0:?             'tex1.smpl' ( temp sampler)
+0:21          move second child to first child ( temp texture2D)
+0:?             'tex3.tex' ( temp texture2D)
+0:?             'tex1.tex' ( temp texture2D)
+0:22      Branch: Return with expression
+0:22        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
+0:?           'tex3.smpl' ( temp sampler)
+0:?           'tex3.tex' ( temp texture2D)
 0:18  Function Definition: main( ( temp void)
 0:18    Function Parameters: 
 0:?     Sequence
@@ -149,10 +157,18 @@ Shader version: 500
 0:20              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:20              Constant:
 0:20                1 (const int)
-0:21      Branch: Return with expression
-0:21        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
-0:?           'tex1.smpl' ( temp sampler)
-0:?           'tex1.tex' ( temp texture2D)
+0:21      Sequence
+0:21        Sequence
+0:21          move second child to first child ( temp sampler)
+0:?             'tex3.smpl' ( temp sampler)
+0:?             'tex1.smpl' ( temp sampler)
+0:21          move second child to first child ( temp texture2D)
+0:?             'tex3.tex' ( temp texture2D)
+0:?             'tex1.tex' ( temp texture2D)
+0:22      Branch: Return with expression
+0:22        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
+0:?           'tex3.smpl' ( temp sampler)
+0:?           'tex3.tex' ( temp texture2D)
 0:18  Function Definition: main( ( temp void)
 0:18    Function Parameters: 
 0:?     Sequence
@@ -166,12 +182,12 @@ Shader version: 500
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 80
+// Id's are bound by 84
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 78
+                              EntryPoint Vertex 4  "main" 82
                               Source HLSL 500
                               Name 4  "main"
                               Name 15  "lookUp(struct-FxaaTex-p1-t211;"
@@ -193,12 +209,14 @@ Shader version: 500
                               Name 62  "flattenTemp"
                               Name 64  "tex2.smpl"
                               Name 67  "tex2.tex"
-                              Name 70  "param"
-                              Name 72  "param"
-                              Name 78  "@entryPointOutput"
+                              Name 70  "tex3.smpl"
+                              Name 72  "tex3.tex"
+                              Name 74  "param"
+                              Name 76  "param"
+                              Name 82  "@entryPointOutput"
                               Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
                               Decorate 42(g_tInputTexture) DescriptorSet 0
-                              Decorate 78(@entryPointOutput) Location 0
+                              Decorate 82(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeSampler
@@ -225,12 +243,12 @@ Shader version: 500
               54:             TypeInt 32 1
               55:     54(int) Constant 0
               59:     54(int) Constant 1
-              77:             TypePointer Output 11(fvec4)
-78(@entryPointOutput):     77(ptr) Variable Output
+              81:             TypePointer Output 11(fvec4)
+82(@entryPointOutput):     81(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-              79:   11(fvec4) FunctionCall 22(@main()
-                              Store 78(@entryPointOutput) 79
+              83:   11(fvec4) FunctionCall 22(@main()
+                              Store 82(@entryPointOutput) 83
                               Return
                               FunctionEnd
 15(lookUp(struct-FxaaTex-p1-t211;):   11(fvec4) Function None 12
@@ -263,8 +281,10 @@ Shader version: 500
  62(flattenTemp):     44(ptr) Variable Function
    64(tex2.smpl):      7(ptr) Variable Function
     67(tex2.tex):     10(ptr) Variable Function
-       70(param):      7(ptr) Variable Function
-       72(param):     10(ptr) Variable Function
+   70(tex3.smpl):      7(ptr) Variable Function
+    72(tex3.tex):     10(ptr) Variable Function
+       74(param):      7(ptr) Variable Function
+       76(param):     10(ptr) Variable Function
               50:           6 Load 38(g_tInputTexture_sampler)
               51:           9 Load 42(g_tInputTexture)
               52: 17(FxaaTex) CompositeConstruct 50 51
@@ -284,9 +304,13 @@ Shader version: 500
               69:           9 Load 68
                               Store 67(tex2.tex) 69
               71:           6 Load 53(tex1.smpl)
-                              Store 70(param) 71
+                              Store 70(tex3.smpl) 71
               73:           9 Load 58(tex1.tex)
-                              Store 72(param) 73
-              74:   11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 70(param) 72(param)
-                              ReturnValue 74
+                              Store 72(tex3.tex) 73
+              75:           6 Load 70(tex3.smpl)
+                              Store 74(param) 75
+              77:           9 Load 72(tex3.tex)
+                              Store 76(param) 77
+              78:   11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 74(param) 76(param)
+                              ReturnValue 78
                               FunctionEnd

+ 218 - 0
3rdparty/glslang/Test/baseResults/hlsl.flattenSubset.frag.out

@@ -0,0 +1,218 @@
+hlsl.flattenSubset.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:30  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:30    Function Parameters: 
+0:30      'vpos' ( in 4-component vector of float)
+0:?     Sequence
+0:33      move second child to first child ( temp sampler)
+0:?         's1.s0.ss' ( temp sampler)
+0:33        'samp' ( uniform sampler)
+0:34      Sequence
+0:34        move second child to first child ( temp float)
+0:?           's2.resources.b' ( temp float)
+0:?           's1.b' ( temp float)
+0:34        move second child to first child ( temp sampler)
+0:?           's2.resources.samplerState' ( temp sampler)
+0:?           's1.samplerState' ( temp sampler)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.s0.x' ( temp int)
+0:?           's1.s0.x' ( temp int)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.s0.y' ( temp int)
+0:?           's1.s0.y' ( temp int)
+0:34        move second child to first child ( temp sampler)
+0:?           's2.resources.s0.ss' ( temp sampler)
+0:?           's1.s0.ss' ( temp sampler)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.a' ( temp int)
+0:?           's1.a' ( temp int)
+0:35      Branch: Return with expression
+0:35        texture ( temp 4-component vector of float)
+0:35          Construct combined texture-sampler ( temp sampler2D)
+0:35            'tex' ( uniform texture2D)
+0:?             's2.resources.s0.ss' ( temp sampler)
+0:35          Constant:
+0:35            0.500000
+0:35            0.500000
+0:30  Function Definition: main( ( temp void)
+0:30    Function Parameters: 
+0:?     Sequence
+0:30      move second child to first child ( temp 4-component vector of float)
+0:?         'vpos' ( temp 4-component vector of float)
+0:?         'vpos' (layout( location=0) in 4-component vector of float)
+0:30      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: @main(vf4; ( temp 4-component vector of float)
+0:?           'vpos' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'samp' ( uniform sampler)
+0:?     'tex' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'vpos' (layout( location=0) in 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:30  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:30    Function Parameters: 
+0:30      'vpos' ( in 4-component vector of float)
+0:?     Sequence
+0:33      move second child to first child ( temp sampler)
+0:?         's1.s0.ss' ( temp sampler)
+0:33        'samp' ( uniform sampler)
+0:34      Sequence
+0:34        move second child to first child ( temp float)
+0:?           's2.resources.b' ( temp float)
+0:?           's1.b' ( temp float)
+0:34        move second child to first child ( temp sampler)
+0:?           's2.resources.samplerState' ( temp sampler)
+0:?           's1.samplerState' ( temp sampler)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.s0.x' ( temp int)
+0:?           's1.s0.x' ( temp int)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.s0.y' ( temp int)
+0:?           's1.s0.y' ( temp int)
+0:34        move second child to first child ( temp sampler)
+0:?           's2.resources.s0.ss' ( temp sampler)
+0:?           's1.s0.ss' ( temp sampler)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.a' ( temp int)
+0:?           's1.a' ( temp int)
+0:35      Branch: Return with expression
+0:35        texture ( temp 4-component vector of float)
+0:35          Construct combined texture-sampler ( temp sampler2D)
+0:35            'tex' ( uniform texture2D)
+0:?             's2.resources.s0.ss' ( temp sampler)
+0:35          Constant:
+0:35            0.500000
+0:35            0.500000
+0:30  Function Definition: main( ( temp void)
+0:30    Function Parameters: 
+0:?     Sequence
+0:30      move second child to first child ( temp 4-component vector of float)
+0:?         'vpos' ( temp 4-component vector of float)
+0:?         'vpos' (layout( location=0) in 4-component vector of float)
+0:30      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: @main(vf4; ( temp 4-component vector of float)
+0:?           'vpos' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'samp' ( uniform sampler)
+0:?     'tex' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'vpos' (layout( location=0) in 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 61
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 54 57
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 11  "@main(vf4;"
+                              Name 10  "vpos"
+                              Name 15  "s1.s0.ss"
+                              Name 17  "samp"
+                              Name 20  "s2.resources.b"
+                              Name 21  "s1.b"
+                              Name 23  "s2.resources.samplerState"
+                              Name 24  "s1.samplerState"
+                              Name 28  "s2.resources.s0.x"
+                              Name 29  "s1.s0.x"
+                              Name 31  "s2.resources.s0.y"
+                              Name 32  "s1.s0.y"
+                              Name 34  "s2.resources.s0.ss"
+                              Name 36  "s2.resources.a"
+                              Name 37  "s1.a"
+                              Name 41  "tex"
+                              Name 52  "vpos"
+                              Name 54  "vpos"
+                              Name 57  "@entryPointOutput"
+                              Name 58  "param"
+                              Decorate 17(samp) DescriptorSet 0
+                              Decorate 41(tex) DescriptorSet 0
+                              Decorate 54(vpos) Location 0
+                              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)
+              13:             TypeSampler
+              14:             TypePointer Function 13
+              16:             TypePointer UniformConstant 13
+        17(samp):     16(ptr) Variable UniformConstant
+              19:             TypePointer Function 6(float)
+              26:             TypeInt 32 1
+              27:             TypePointer Function 26(int)
+              39:             TypeImage 6(float) 2D sampled format:Unknown
+              40:             TypePointer UniformConstant 39
+         41(tex):     40(ptr) Variable UniformConstant
+              44:             TypeSampledImage 39
+              46:             TypeVector 6(float) 2
+              47:    6(float) Constant 1056964608
+              48:   46(fvec2) ConstantComposite 47 47
+              53:             TypePointer Input 7(fvec4)
+        54(vpos):     53(ptr) Variable Input
+              56:             TypePointer Output 7(fvec4)
+57(@entryPointOutput):     56(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+        52(vpos):      8(ptr) Variable Function
+       58(param):      8(ptr) Variable Function
+              55:    7(fvec4) Load 54(vpos)
+                              Store 52(vpos) 55
+              59:    7(fvec4) Load 52(vpos)
+                              Store 58(param) 59
+              60:    7(fvec4) FunctionCall 11(@main(vf4;) 58(param)
+                              Store 57(@entryPointOutput) 60
+                              Return
+                              FunctionEnd
+  11(@main(vf4;):    7(fvec4) Function None 9
+        10(vpos):      8(ptr) FunctionParameter
+              12:             Label
+    15(s1.s0.ss):     14(ptr) Variable Function
+20(s2.resources.b):     19(ptr) Variable Function
+        21(s1.b):     19(ptr) Variable Function
+23(s2.resources.samplerState):     14(ptr) Variable Function
+24(s1.samplerState):     14(ptr) Variable Function
+28(s2.resources.s0.x):     27(ptr) Variable Function
+     29(s1.s0.x):     27(ptr) Variable Function
+31(s2.resources.s0.y):     27(ptr) Variable Function
+     32(s1.s0.y):     27(ptr) Variable Function
+34(s2.resources.s0.ss):     14(ptr) Variable Function
+36(s2.resources.a):     27(ptr) Variable Function
+        37(s1.a):     27(ptr) Variable Function
+              18:          13 Load 17(samp)
+                              Store 15(s1.s0.ss) 18
+              22:    6(float) Load 21(s1.b)
+                              Store 20(s2.resources.b) 22
+              25:          13 Load 24(s1.samplerState)
+                              Store 23(s2.resources.samplerState) 25
+              30:     26(int) Load 29(s1.s0.x)
+                              Store 28(s2.resources.s0.x) 30
+              33:     26(int) Load 32(s1.s0.y)
+                              Store 31(s2.resources.s0.y) 33
+              35:          13 Load 15(s1.s0.ss)
+                              Store 34(s2.resources.s0.ss) 35
+              38:     26(int) Load 37(s1.a)
+                              Store 36(s2.resources.a) 38
+              42:          39 Load 41(tex)
+              43:          13 Load 34(s2.resources.s0.ss)
+              45:          44 SampledImage 42 43
+              49:    7(fvec4) ImageSampleImplicitLod 45 48
+                              ReturnValue 49
+                              FunctionEnd

+ 207 - 0
3rdparty/glslang/Test/baseResults/hlsl.flattenSubset2.frag.out

@@ -0,0 +1,207 @@
+hlsl.flattenSubset2.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:8  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:8    Function Parameters: 
+0:8      'vpos' ( in 4-component vector of float)
+0:?     Sequence
+0:13      Sequence
+0:13        move second child to first child ( temp float)
+0:?           'a1.n.y' ( temp float)
+0:?           'a2.n.y' ( temp float)
+0:13        move second child to first child ( temp texture2D)
+0:?           'a1.n.texNested' ( temp texture2D)
+0:?           'a2.n.texNested' ( temp texture2D)
+0:14      Sequence
+0:14        move second child to first child ( temp float)
+0:?           'b.n.y' ( temp float)
+0:?           'a1.n.y' ( temp float)
+0:14        move second child to first child ( temp texture2D)
+0:?           'b.n.texNested' ( temp texture2D)
+0:?           'a1.n.texNested' ( temp texture2D)
+0:17      Sequence
+0:17        Sequence
+0:17          move second child to first child ( temp float)
+0:?             'n.y' ( temp float)
+0:?             'b.n.y' ( temp float)
+0:17          move second child to first child ( temp texture2D)
+0:?             'n.texNested' ( temp texture2D)
+0:?             'b.n.texNested' ( temp texture2D)
+0:20      move second child to first child ( temp texture2D)
+0:?         'a2.n.texNested' ( temp texture2D)
+0:20        'someTex' ( uniform texture2D)
+0:21      move second child to first child ( temp float)
+0:?         'a1.n.y' ( temp float)
+0:21        Constant:
+0:21          1.000000
+0:23      Branch: Return with expression
+0:?         Constant:
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:8  Function Definition: main( ( temp void)
+0:8    Function Parameters: 
+0:?     Sequence
+0:8      move second child to first child ( temp 4-component vector of float)
+0:?         'vpos' ( temp 4-component vector of float)
+0:?         'vpos' (layout( location=0) in 4-component vector of float)
+0:8      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:8        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'vpos' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'someTex' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'vpos' (layout( location=0) in 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:8  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:8    Function Parameters: 
+0:8      'vpos' ( in 4-component vector of float)
+0:?     Sequence
+0:13      Sequence
+0:13        move second child to first child ( temp float)
+0:?           'a1.n.y' ( temp float)
+0:?           'a2.n.y' ( temp float)
+0:13        move second child to first child ( temp texture2D)
+0:?           'a1.n.texNested' ( temp texture2D)
+0:?           'a2.n.texNested' ( temp texture2D)
+0:14      Sequence
+0:14        move second child to first child ( temp float)
+0:?           'b.n.y' ( temp float)
+0:?           'a1.n.y' ( temp float)
+0:14        move second child to first child ( temp texture2D)
+0:?           'b.n.texNested' ( temp texture2D)
+0:?           'a1.n.texNested' ( temp texture2D)
+0:17      Sequence
+0:17        Sequence
+0:17          move second child to first child ( temp float)
+0:?             'n.y' ( temp float)
+0:?             'b.n.y' ( temp float)
+0:17          move second child to first child ( temp texture2D)
+0:?             'n.texNested' ( temp texture2D)
+0:?             'b.n.texNested' ( temp texture2D)
+0:20      move second child to first child ( temp texture2D)
+0:?         'a2.n.texNested' ( temp texture2D)
+0:20        'someTex' ( uniform texture2D)
+0:21      move second child to first child ( temp float)
+0:?         'a1.n.y' ( temp float)
+0:21        Constant:
+0:21          1.000000
+0:23      Branch: Return with expression
+0:?         Constant:
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:8  Function Definition: main( ( temp void)
+0:8    Function Parameters: 
+0:?     Sequence
+0:8      move second child to first child ( temp 4-component vector of float)
+0:?         'vpos' ( temp 4-component vector of float)
+0:?         'vpos' (layout( location=0) in 4-component vector of float)
+0:8      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:8        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'vpos' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'someTex' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'vpos' (layout( location=0) in 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 47
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 40 43
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 11  "@main(vf4;"
+                              Name 10  "vpos"
+                              Name 14  "a1.n.y"
+                              Name 15  "a2.n.y"
+                              Name 19  "a1.n.texNested"
+                              Name 20  "a2.n.texNested"
+                              Name 22  "b.n.y"
+                              Name 24  "b.n.texNested"
+                              Name 26  "n.y"
+                              Name 28  "n.texNested"
+                              Name 31  "someTex"
+                              Name 38  "vpos"
+                              Name 40  "vpos"
+                              Name 43  "@entryPointOutput"
+                              Name 44  "param"
+                              Decorate 31(someTex) DescriptorSet 0
+                              Decorate 40(vpos) Location 0
+                              Decorate 43(@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)
+              13:             TypePointer Function 6(float)
+              17:             TypeImage 6(float) 2D sampled format:Unknown
+              18:             TypePointer Function 17
+              30:             TypePointer UniformConstant 17
+     31(someTex):     30(ptr) Variable UniformConstant
+              33:    6(float) Constant 1065353216
+              34:    6(float) Constant 0
+              35:    7(fvec4) ConstantComposite 34 34 34 34
+              39:             TypePointer Input 7(fvec4)
+        40(vpos):     39(ptr) Variable Input
+              42:             TypePointer Output 7(fvec4)
+43(@entryPointOutput):     42(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+        38(vpos):      8(ptr) Variable Function
+       44(param):      8(ptr) Variable Function
+              41:    7(fvec4) Load 40(vpos)
+                              Store 38(vpos) 41
+              45:    7(fvec4) Load 38(vpos)
+                              Store 44(param) 45
+              46:    7(fvec4) FunctionCall 11(@main(vf4;) 44(param)
+                              Store 43(@entryPointOutput) 46
+                              Return
+                              FunctionEnd
+  11(@main(vf4;):    7(fvec4) Function None 9
+        10(vpos):      8(ptr) FunctionParameter
+              12:             Label
+      14(a1.n.y):     13(ptr) Variable Function
+      15(a2.n.y):     13(ptr) Variable Function
+19(a1.n.texNested):     18(ptr) Variable Function
+20(a2.n.texNested):     18(ptr) Variable Function
+       22(b.n.y):     13(ptr) Variable Function
+24(b.n.texNested):     18(ptr) Variable Function
+         26(n.y):     13(ptr) Variable Function
+ 28(n.texNested):     18(ptr) Variable Function
+              16:    6(float) Load 15(a2.n.y)
+                              Store 14(a1.n.y) 16
+              21:          17 Load 20(a2.n.texNested)
+                              Store 19(a1.n.texNested) 21
+              23:    6(float) Load 14(a1.n.y)
+                              Store 22(b.n.y) 23
+              25:          17 Load 19(a1.n.texNested)
+                              Store 24(b.n.texNested) 25
+              27:    6(float) Load 22(b.n.y)
+                              Store 26(n.y) 27
+              29:          17 Load 24(b.n.texNested)
+                              Store 28(n.texNested) 29
+              32:          17 Load 31(someTex)
+                              Store 20(a2.n.texNested) 32
+                              Store 14(a1.n.y) 33
+                              ReturnValue 35
+                              FunctionEnd

+ 64 - 0
3rdparty/glslang/Test/baseResults/hlsl.localStructuredBuffer.comp.out

@@ -0,0 +1,64 @@
+hlsl.localStructuredBuffer.comp
+Shader version: 500
+local_size = (1, 1, 1)
+0:? Sequence
+0:2  Function Definition: @main( ( temp void)
+0:2    Function Parameters: 
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      Function Call: @main( ( temp void)
+0:?   Linker Objects
+0:?     'srt0' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+
+
+Linked compute stage:
+
+
+Shader version: 500
+local_size = (1, 1, 1)
+0:? Sequence
+0:2  Function Definition: @main( ( temp void)
+0:2    Function Parameters: 
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      Function Call: @main( ( temp void)
+0:?   Linker Objects
+0:?     'srt0' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 14
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint GLCompute 4  "main"
+                              ExecutionMode 4 LocalSize 1 1 1
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 6  "@main("
+                              Name 11  "srt0"
+                              MemberName 11(srt0) 0  "@data"
+                              Name 13  "srt0"
+                              Decorate 10 ArrayStride 4
+                              MemberDecorate 11(srt0) 0 Offset 0
+                              Decorate 11(srt0) BufferBlock
+                              Decorate 13(srt0) DescriptorSet 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               9:             TypeInt 32 0
+              10:             TypeRuntimeArray 9(int)
+        11(srt0):             TypeStruct 10
+              12:             TypePointer Uniform 11(srt0)
+        13(srt0):     12(ptr) Variable Uniform
+         4(main):           2 Function None 3
+               5:             Label
+               8:           2 FunctionCall 6(@main()
+                              Return
+                              FunctionEnd
+       6(@main():           2 Function None 3
+               7:             Label
+                              Return
+                              FunctionEnd

+ 157 - 0
3rdparty/glslang/Test/baseResults/hlsl.samplecmp.dualmode.frag.out

@@ -0,0 +1,157 @@
+hlsl.samplecmp.dualmode.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:7  Function Definition: @main( ( temp 4-component vector of float)
+0:7    Function Parameters: 
+0:?     Sequence
+0:10      texture ( temp float)
+0:10        Construct combined texture-sampler ( temp sampler1DShadow)
+0:10          'g_tTex' (layout( binding=3) uniform texture1DShadow)
+0:10          'g_sSampCmp' (layout( binding=1) uniform sampler)
+0:10        Construct vec2 ( temp 2-component vector of float)
+0:10          Constant:
+0:10            0.100000
+0:10          Constant:
+0:10            0.750000
+0:11      texture ( temp 4-component vector of float)
+0:11        Construct combined texture-sampler ( temp sampler1D)
+0:11          'g_tTex' (layout( binding=3) uniform texture1D)
+0:11          'g_sSamp' (layout( binding=0) uniform sampler)
+0:11        Constant:
+0:11          0.100000
+0:13      Branch: Return with expression
+0:13        Constant:
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:7  Function Definition: main( ( temp void)
+0:7    Function Parameters: 
+0:?     Sequence
+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( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'g_sSamp' (layout( binding=0) uniform sampler)
+0:?     'g_sSampCmp' (layout( binding=1) uniform sampler)
+0:?     'g_tTex' (layout( binding=3) uniform texture1DShadow)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'g_tTex' (layout( binding=3) uniform texture1D)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:7  Function Definition: @main( ( temp 4-component vector of float)
+0:7    Function Parameters: 
+0:?     Sequence
+0:10      texture ( temp float)
+0:10        Construct combined texture-sampler ( temp sampler1DShadow)
+0:10          'g_tTex' (layout( binding=3) uniform texture1DShadow)
+0:10          'g_sSampCmp' (layout( binding=1) uniform sampler)
+0:10        Construct vec2 ( temp 2-component vector of float)
+0:10          Constant:
+0:10            0.100000
+0:10          Constant:
+0:10            0.750000
+0:11      texture ( temp 4-component vector of float)
+0:11        Construct combined texture-sampler ( temp sampler1D)
+0:11          'g_tTex' (layout( binding=3) uniform texture1D)
+0:11          'g_sSamp' (layout( binding=0) uniform sampler)
+0:11        Constant:
+0:11          0.100000
+0:13      Branch: Return with expression
+0:13        Constant:
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:7  Function Definition: main( ( temp void)
+0:7    Function Parameters: 
+0:?     Sequence
+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( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'g_sSamp' (layout( binding=0) uniform sampler)
+0:?     'g_sSampCmp' (layout( binding=1) uniform sampler)
+0:?     'g_tTex' (layout( binding=3) uniform texture1DShadow)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'g_tTex' (layout( binding=3) uniform texture1D)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 43
+
+                              Capability Shader
+                              Capability Sampled1D
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 41
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 9  "@main("
+                              Name 13  "g_tTex"
+                              Name 17  "g_sSampCmp"
+                              Name 29  "g_tTex"
+                              Name 31  "g_sSamp"
+                              Name 41  "@entryPointOutput"
+                              Decorate 13(g_tTex) DescriptorSet 0
+                              Decorate 13(g_tTex) Binding 3
+                              Decorate 17(g_sSampCmp) DescriptorSet 0
+                              Decorate 17(g_sSampCmp) Binding 1
+                              Decorate 29(g_tTex) DescriptorSet 0
+                              Decorate 29(g_tTex) Binding 3
+                              Decorate 31(g_sSamp) DescriptorSet 0
+                              Decorate 31(g_sSamp) Binding 0
+                              Decorate 41(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+              11:             TypeImage 6(float) 1D depth sampled format:Unknown
+              12:             TypePointer UniformConstant 11
+      13(g_tTex):     12(ptr) Variable UniformConstant
+              15:             TypeSampler
+              16:             TypePointer UniformConstant 15
+  17(g_sSampCmp):     16(ptr) Variable UniformConstant
+              19:             TypeSampledImage 11
+              21:    6(float) Constant 1036831949
+              22:    6(float) Constant 1061158912
+              23:             TypeVector 6(float) 2
+              27:             TypeImage 6(float) 1D sampled format:Unknown
+              28:             TypePointer UniformConstant 27
+      29(g_tTex):     28(ptr) Variable UniformConstant
+     31(g_sSamp):     16(ptr) Variable UniformConstant
+              33:             TypeSampledImage 27
+              36:    6(float) Constant 0
+              37:    7(fvec4) ConstantComposite 36 36 36 36
+              40:             TypePointer Output 7(fvec4)
+41(@entryPointOutput):     40(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              42:    7(fvec4) FunctionCall 9(@main()
+                              Store 41(@entryPointOutput) 42
+                              Return
+                              FunctionEnd
+       9(@main():    7(fvec4) Function None 8
+              10:             Label
+              14:          11 Load 13(g_tTex)
+              18:          15 Load 17(g_sSampCmp)
+              20:          19 SampledImage 14 18
+              24:   23(fvec2) CompositeConstruct 21 22
+              25:    6(float) CompositeExtract 24 1
+              26:    6(float) ImageSampleDrefImplicitLod 20 24 25
+              30:          27 Load 29(g_tTex)
+              32:          15 Load 31(g_sSamp)
+              34:          33 SampledImage 30 32
+              35:    7(fvec4) ImageSampleImplicitLod 34 21
+                              ReturnValue 37
+                              FunctionEnd

+ 778 - 0
3rdparty/glslang/Test/baseResults/hlsl.subpass.frag.out

@@ -0,0 +1,778 @@
+hlsl.subpass.frag
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:68  Function Definition: @main( ( temp 4-component vector of float)
+0:68    Function Parameters: 
+0:?     Sequence
+0:69      Sequence
+0:69        move second child to first child ( temp 4-component vector of float)
+0:69          'result00' ( temp 4-component vector of float)
+0:69          subpassLoad ( temp 4-component vector of float)
+0:69            'subpass_f4' (layout( binding=1 input_attachment_index=1) uniform subpassInput)
+0:70      Sequence
+0:70        move second child to first child ( temp 4-component vector of int)
+0:70          'result01' ( temp 4-component vector of int)
+0:70          subpassLoad ( temp 4-component vector of int)
+0:70            'subpass_i4' ( uniform isubpassInput)
+0:71      Sequence
+0:71        move second child to first child ( temp 4-component vector of uint)
+0:71          'result02' ( temp 4-component vector of uint)
+0:71          subpassLoad ( temp 4-component vector of uint)
+0:71            'subpass_u4' ( uniform usubpassInput)
+0:73      Sequence
+0:73        move second child to first child ( temp 4-component vector of float)
+0:73          'result10' ( temp 4-component vector of float)
+0:73          subpassLoadMS ( temp 4-component vector of float)
+0:73            'subpass_ms_f4' ( uniform subpassInputMS)
+0:73            Constant:
+0:73              3 (const int)
+0:74      Sequence
+0:74        move second child to first child ( temp 4-component vector of int)
+0:74          'result11' ( temp 4-component vector of int)
+0:74          subpassLoadMS ( temp 4-component vector of int)
+0:74            'subpass_ms_i4' ( uniform isubpassInputMS)
+0:74            Constant:
+0:74              3 (const int)
+0:75      Sequence
+0:75        move second child to first child ( temp 4-component vector of uint)
+0:75          'result12' ( temp 4-component vector of uint)
+0:75          subpassLoadMS ( temp 4-component vector of uint)
+0:75            'subpass_ms_u4' ( uniform usubpassInputMS)
+0:75            Constant:
+0:75              3 (const int)
+0:77      Sequence
+0:77        move second child to first child ( temp 3-component vector of float)
+0:77          'result20' ( temp 3-component vector of float)
+0:77          Construct vec3 ( temp 3-component vector of float)
+0:77            subpassLoad ( temp 4-component vector of float)
+0:77              'subpass_f3' ( uniform subpassInput)
+0:78      Sequence
+0:78        move second child to first child ( temp 3-component vector of int)
+0:78          'result21' ( temp 3-component vector of int)
+0:78          Construct ivec3 ( temp 3-component vector of int)
+0:78            subpassLoad ( temp 4-component vector of int)
+0:78              'subpass_i3' ( uniform isubpassInput)
+0:79      Sequence
+0:79        move second child to first child ( temp 3-component vector of uint)
+0:79          'result22' ( temp 3-component vector of uint)
+0:79          Construct uvec3 ( temp 3-component vector of uint)
+0:79            subpassLoad ( temp 4-component vector of uint)
+0:79              'subpass_u3' ( uniform usubpassInput)
+0:81      Sequence
+0:81        move second child to first child ( temp 3-component vector of float)
+0:81          'result30' ( temp 3-component vector of float)
+0:81          Construct vec3 ( temp 3-component vector of float)
+0:81            subpassLoadMS ( temp 4-component vector of float)
+0:81              'subpass_ms_f3' ( uniform subpassInputMS)
+0:81              Constant:
+0:81                3 (const int)
+0:82      Sequence
+0:82        move second child to first child ( temp 3-component vector of int)
+0:82          'result31' ( temp 3-component vector of int)
+0:82          Construct ivec3 ( temp 3-component vector of int)
+0:82            subpassLoadMS ( temp 4-component vector of int)
+0:82              'subpass_ms_i3' ( uniform isubpassInputMS)
+0:82              Constant:
+0:82                3 (const int)
+0:83      Sequence
+0:83        move second child to first child ( temp 3-component vector of uint)
+0:83          'result32' ( temp 3-component vector of uint)
+0:83          Construct uvec3 ( temp 3-component vector of uint)
+0:83            subpassLoadMS ( temp 4-component vector of uint)
+0:83              'subpass_ms_u3' ( uniform usubpassInputMS)
+0:83              Constant:
+0:83                3 (const int)
+0:85      Sequence
+0:85        move second child to first child ( temp 2-component vector of float)
+0:85          'result40' ( temp 2-component vector of float)
+0:85          Construct vec2 ( temp 2-component vector of float)
+0:85            subpassLoad ( temp 4-component vector of float)
+0:85              'subpass_f2' ( uniform subpassInput)
+0:86      Sequence
+0:86        move second child to first child ( temp 2-component vector of int)
+0:86          'result41' ( temp 2-component vector of int)
+0:86          Construct ivec2 ( temp 2-component vector of int)
+0:86            subpassLoad ( temp 4-component vector of int)
+0:86              'subpass_i2' ( uniform isubpassInput)
+0:87      Sequence
+0:87        move second child to first child ( temp 2-component vector of uint)
+0:87          'result42' ( temp 2-component vector of uint)
+0:87          Construct uvec2 ( temp 2-component vector of uint)
+0:87            subpassLoad ( temp 4-component vector of uint)
+0:87              'subpass_u2' ( uniform usubpassInput)
+0:89      Sequence
+0:89        move second child to first child ( temp 2-component vector of float)
+0:89          'result50' ( temp 2-component vector of float)
+0:89          Construct vec2 ( temp 2-component vector of float)
+0:89            subpassLoadMS ( temp 4-component vector of float)
+0:89              'subpass_ms_f2' ( uniform subpassInputMS)
+0:89              Constant:
+0:89                2 (const int)
+0:90      Sequence
+0:90        move second child to first child ( temp 2-component vector of int)
+0:90          'result51' ( temp 2-component vector of int)
+0:90          Construct ivec2 ( temp 2-component vector of int)
+0:90            subpassLoadMS ( temp 4-component vector of int)
+0:90              'subpass_ms_i2' ( uniform isubpassInputMS)
+0:90              Constant:
+0:90                2 (const int)
+0:91      Sequence
+0:91        move second child to first child ( temp 2-component vector of uint)
+0:91          'result52' ( temp 2-component vector of uint)
+0:91          Construct uvec2 ( temp 2-component vector of uint)
+0:91            subpassLoadMS ( temp 4-component vector of uint)
+0:91              'subpass_ms_u2' ( uniform usubpassInputMS)
+0:91              Constant:
+0:91                2 (const int)
+0:93      Sequence
+0:93        move second child to first child ( temp float)
+0:93          'result60' ( temp float)
+0:93          Construct float ( temp float)
+0:93            subpassLoad ( temp 4-component vector of float)
+0:93              'subpass_f' ( uniform subpassInput)
+0:94      Sequence
+0:94        move second child to first child ( temp int)
+0:94          'result61' ( temp int)
+0:94          Construct int ( temp int)
+0:94            subpassLoad ( temp 4-component vector of int)
+0:94              'subpass_i' ( uniform isubpassInput)
+0:95      Sequence
+0:95        move second child to first child ( temp uint)
+0:95          'result62' ( temp uint)
+0:95          Construct uint ( temp uint)
+0:95            subpassLoad ( temp 4-component vector of uint)
+0:95              'subpass_u' ( uniform usubpassInput)
+0:97      Sequence
+0:97        move second child to first child ( temp float)
+0:97          'result70' ( temp float)
+0:97          Construct float ( temp float)
+0:97            subpassLoadMS ( temp 4-component vector of float)
+0:97              'subpass_ms_f' ( uniform subpassInputMS)
+0:97              Constant:
+0:97                2 (const int)
+0:98      Sequence
+0:98        move second child to first child ( temp int)
+0:98          'result71' ( temp int)
+0:98          Construct int ( temp int)
+0:98            subpassLoadMS ( temp 4-component vector of int)
+0:98              'subpass_ms_i' ( uniform isubpassInputMS)
+0:98              Constant:
+0:98                2 (const int)
+0:99      Sequence
+0:99        move second child to first child ( temp uint)
+0:99          'result72' ( temp uint)
+0:99          Construct uint ( temp uint)
+0:99            subpassLoadMS ( temp 4-component vector of uint)
+0:99              'subpass_ms_u' ( uniform usubpassInputMS)
+0:99              Constant:
+0:99                2 (const int)
+0:101      Sequence
+0:101        move second child to first child ( temp 4-component vector of float)
+0:101          'result73' ( temp 4-component vector of float)
+0:101          subpassLoad ( temp 4-component vector of float)
+0:101            'subpass_2' ( uniform subpassInput)
+0:112      Branch: Return with expression
+0:112        Constant:
+0:112          0.000000
+0:112          0.000000
+0:112          0.000000
+0:112          0.000000
+0:68  Function Definition: main( ( temp void)
+0:68    Function Parameters: 
+0:?     Sequence
+0:68      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:68        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'subpass_f4' (layout( binding=1 input_attachment_index=1) uniform subpassInput)
+0:?     'subpass_i4' ( uniform isubpassInput)
+0:?     'subpass_u4' ( uniform usubpassInput)
+0:?     'subpass_ms_f4' ( uniform subpassInputMS)
+0:?     'subpass_ms_i4' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u4' ( uniform usubpassInputMS)
+0:?     'subpass_f3' ( uniform subpassInput)
+0:?     'subpass_i3' ( uniform isubpassInput)
+0:?     'subpass_u3' ( uniform usubpassInput)
+0:?     'subpass_ms_f3' ( uniform subpassInputMS)
+0:?     'subpass_ms_i3' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u3' ( uniform usubpassInputMS)
+0:?     'subpass_f2' ( uniform subpassInput)
+0:?     'subpass_i2' ( uniform isubpassInput)
+0:?     'subpass_u2' ( uniform usubpassInput)
+0:?     'subpass_ms_f2' ( uniform subpassInputMS)
+0:?     'subpass_ms_i2' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u2' ( uniform usubpassInputMS)
+0:?     'subpass_f' ( uniform subpassInput)
+0:?     'subpass_i' ( uniform isubpassInput)
+0:?     'subpass_u' ( uniform usubpassInput)
+0:?     'subpass_ms_f' ( uniform subpassInputMS)
+0:?     'subpass_ms_i' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u' ( uniform usubpassInputMS)
+0:?     'subpass_2' ( uniform subpassInput)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:68  Function Definition: @main( ( temp 4-component vector of float)
+0:68    Function Parameters: 
+0:?     Sequence
+0:69      Sequence
+0:69        move second child to first child ( temp 4-component vector of float)
+0:69          'result00' ( temp 4-component vector of float)
+0:69          subpassLoad ( temp 4-component vector of float)
+0:69            'subpass_f4' (layout( binding=1 input_attachment_index=1) uniform subpassInput)
+0:70      Sequence
+0:70        move second child to first child ( temp 4-component vector of int)
+0:70          'result01' ( temp 4-component vector of int)
+0:70          subpassLoad ( temp 4-component vector of int)
+0:70            'subpass_i4' ( uniform isubpassInput)
+0:71      Sequence
+0:71        move second child to first child ( temp 4-component vector of uint)
+0:71          'result02' ( temp 4-component vector of uint)
+0:71          subpassLoad ( temp 4-component vector of uint)
+0:71            'subpass_u4' ( uniform usubpassInput)
+0:73      Sequence
+0:73        move second child to first child ( temp 4-component vector of float)
+0:73          'result10' ( temp 4-component vector of float)
+0:73          subpassLoadMS ( temp 4-component vector of float)
+0:73            'subpass_ms_f4' ( uniform subpassInputMS)
+0:73            Constant:
+0:73              3 (const int)
+0:74      Sequence
+0:74        move second child to first child ( temp 4-component vector of int)
+0:74          'result11' ( temp 4-component vector of int)
+0:74          subpassLoadMS ( temp 4-component vector of int)
+0:74            'subpass_ms_i4' ( uniform isubpassInputMS)
+0:74            Constant:
+0:74              3 (const int)
+0:75      Sequence
+0:75        move second child to first child ( temp 4-component vector of uint)
+0:75          'result12' ( temp 4-component vector of uint)
+0:75          subpassLoadMS ( temp 4-component vector of uint)
+0:75            'subpass_ms_u4' ( uniform usubpassInputMS)
+0:75            Constant:
+0:75              3 (const int)
+0:77      Sequence
+0:77        move second child to first child ( temp 3-component vector of float)
+0:77          'result20' ( temp 3-component vector of float)
+0:77          Construct vec3 ( temp 3-component vector of float)
+0:77            subpassLoad ( temp 4-component vector of float)
+0:77              'subpass_f3' ( uniform subpassInput)
+0:78      Sequence
+0:78        move second child to first child ( temp 3-component vector of int)
+0:78          'result21' ( temp 3-component vector of int)
+0:78          Construct ivec3 ( temp 3-component vector of int)
+0:78            subpassLoad ( temp 4-component vector of int)
+0:78              'subpass_i3' ( uniform isubpassInput)
+0:79      Sequence
+0:79        move second child to first child ( temp 3-component vector of uint)
+0:79          'result22' ( temp 3-component vector of uint)
+0:79          Construct uvec3 ( temp 3-component vector of uint)
+0:79            subpassLoad ( temp 4-component vector of uint)
+0:79              'subpass_u3' ( uniform usubpassInput)
+0:81      Sequence
+0:81        move second child to first child ( temp 3-component vector of float)
+0:81          'result30' ( temp 3-component vector of float)
+0:81          Construct vec3 ( temp 3-component vector of float)
+0:81            subpassLoadMS ( temp 4-component vector of float)
+0:81              'subpass_ms_f3' ( uniform subpassInputMS)
+0:81              Constant:
+0:81                3 (const int)
+0:82      Sequence
+0:82        move second child to first child ( temp 3-component vector of int)
+0:82          'result31' ( temp 3-component vector of int)
+0:82          Construct ivec3 ( temp 3-component vector of int)
+0:82            subpassLoadMS ( temp 4-component vector of int)
+0:82              'subpass_ms_i3' ( uniform isubpassInputMS)
+0:82              Constant:
+0:82                3 (const int)
+0:83      Sequence
+0:83        move second child to first child ( temp 3-component vector of uint)
+0:83          'result32' ( temp 3-component vector of uint)
+0:83          Construct uvec3 ( temp 3-component vector of uint)
+0:83            subpassLoadMS ( temp 4-component vector of uint)
+0:83              'subpass_ms_u3' ( uniform usubpassInputMS)
+0:83              Constant:
+0:83                3 (const int)
+0:85      Sequence
+0:85        move second child to first child ( temp 2-component vector of float)
+0:85          'result40' ( temp 2-component vector of float)
+0:85          Construct vec2 ( temp 2-component vector of float)
+0:85            subpassLoad ( temp 4-component vector of float)
+0:85              'subpass_f2' ( uniform subpassInput)
+0:86      Sequence
+0:86        move second child to first child ( temp 2-component vector of int)
+0:86          'result41' ( temp 2-component vector of int)
+0:86          Construct ivec2 ( temp 2-component vector of int)
+0:86            subpassLoad ( temp 4-component vector of int)
+0:86              'subpass_i2' ( uniform isubpassInput)
+0:87      Sequence
+0:87        move second child to first child ( temp 2-component vector of uint)
+0:87          'result42' ( temp 2-component vector of uint)
+0:87          Construct uvec2 ( temp 2-component vector of uint)
+0:87            subpassLoad ( temp 4-component vector of uint)
+0:87              'subpass_u2' ( uniform usubpassInput)
+0:89      Sequence
+0:89        move second child to first child ( temp 2-component vector of float)
+0:89          'result50' ( temp 2-component vector of float)
+0:89          Construct vec2 ( temp 2-component vector of float)
+0:89            subpassLoadMS ( temp 4-component vector of float)
+0:89              'subpass_ms_f2' ( uniform subpassInputMS)
+0:89              Constant:
+0:89                2 (const int)
+0:90      Sequence
+0:90        move second child to first child ( temp 2-component vector of int)
+0:90          'result51' ( temp 2-component vector of int)
+0:90          Construct ivec2 ( temp 2-component vector of int)
+0:90            subpassLoadMS ( temp 4-component vector of int)
+0:90              'subpass_ms_i2' ( uniform isubpassInputMS)
+0:90              Constant:
+0:90                2 (const int)
+0:91      Sequence
+0:91        move second child to first child ( temp 2-component vector of uint)
+0:91          'result52' ( temp 2-component vector of uint)
+0:91          Construct uvec2 ( temp 2-component vector of uint)
+0:91            subpassLoadMS ( temp 4-component vector of uint)
+0:91              'subpass_ms_u2' ( uniform usubpassInputMS)
+0:91              Constant:
+0:91                2 (const int)
+0:93      Sequence
+0:93        move second child to first child ( temp float)
+0:93          'result60' ( temp float)
+0:93          Construct float ( temp float)
+0:93            subpassLoad ( temp 4-component vector of float)
+0:93              'subpass_f' ( uniform subpassInput)
+0:94      Sequence
+0:94        move second child to first child ( temp int)
+0:94          'result61' ( temp int)
+0:94          Construct int ( temp int)
+0:94            subpassLoad ( temp 4-component vector of int)
+0:94              'subpass_i' ( uniform isubpassInput)
+0:95      Sequence
+0:95        move second child to first child ( temp uint)
+0:95          'result62' ( temp uint)
+0:95          Construct uint ( temp uint)
+0:95            subpassLoad ( temp 4-component vector of uint)
+0:95              'subpass_u' ( uniform usubpassInput)
+0:97      Sequence
+0:97        move second child to first child ( temp float)
+0:97          'result70' ( temp float)
+0:97          Construct float ( temp float)
+0:97            subpassLoadMS ( temp 4-component vector of float)
+0:97              'subpass_ms_f' ( uniform subpassInputMS)
+0:97              Constant:
+0:97                2 (const int)
+0:98      Sequence
+0:98        move second child to first child ( temp int)
+0:98          'result71' ( temp int)
+0:98          Construct int ( temp int)
+0:98            subpassLoadMS ( temp 4-component vector of int)
+0:98              'subpass_ms_i' ( uniform isubpassInputMS)
+0:98              Constant:
+0:98                2 (const int)
+0:99      Sequence
+0:99        move second child to first child ( temp uint)
+0:99          'result72' ( temp uint)
+0:99          Construct uint ( temp uint)
+0:99            subpassLoadMS ( temp 4-component vector of uint)
+0:99              'subpass_ms_u' ( uniform usubpassInputMS)
+0:99              Constant:
+0:99                2 (const int)
+0:101      Sequence
+0:101        move second child to first child ( temp 4-component vector of float)
+0:101          'result73' ( temp 4-component vector of float)
+0:101          subpassLoad ( temp 4-component vector of float)
+0:101            'subpass_2' ( uniform subpassInput)
+0:112      Branch: Return with expression
+0:112        Constant:
+0:112          0.000000
+0:112          0.000000
+0:112          0.000000
+0:112          0.000000
+0:68  Function Definition: main( ( temp void)
+0:68    Function Parameters: 
+0:?     Sequence
+0:68      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:68        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'subpass_f4' (layout( binding=1 input_attachment_index=1) uniform subpassInput)
+0:?     'subpass_i4' ( uniform isubpassInput)
+0:?     'subpass_u4' ( uniform usubpassInput)
+0:?     'subpass_ms_f4' ( uniform subpassInputMS)
+0:?     'subpass_ms_i4' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u4' ( uniform usubpassInputMS)
+0:?     'subpass_f3' ( uniform subpassInput)
+0:?     'subpass_i3' ( uniform isubpassInput)
+0:?     'subpass_u3' ( uniform usubpassInput)
+0:?     'subpass_ms_f3' ( uniform subpassInputMS)
+0:?     'subpass_ms_i3' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u3' ( uniform usubpassInputMS)
+0:?     'subpass_f2' ( uniform subpassInput)
+0:?     'subpass_i2' ( uniform isubpassInput)
+0:?     'subpass_u2' ( uniform usubpassInput)
+0:?     'subpass_ms_f2' ( uniform subpassInputMS)
+0:?     'subpass_ms_i2' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u2' ( uniform usubpassInputMS)
+0:?     'subpass_f' ( uniform subpassInput)
+0:?     'subpass_i' ( uniform isubpassInput)
+0:?     'subpass_u' ( uniform usubpassInput)
+0:?     'subpass_ms_f' ( uniform subpassInputMS)
+0:?     'subpass_ms_i' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u' ( uniform usubpassInputMS)
+0:?     'subpass_2' ( uniform subpassInput)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 204
+
+                              Capability Shader
+                              Capability StorageImageMultisample
+                              Capability InputAttachment
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 202
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 9  "@main("
+                              Name 12  "result00"
+                              Name 15  "subpass_f4"
+                              Name 24  "result01"
+                              Name 27  "subpass_i4"
+                              Name 33  "result02"
+                              Name 36  "subpass_u4"
+                              Name 39  "result10"
+                              Name 42  "subpass_ms_f4"
+                              Name 46  "result11"
+                              Name 49  "subpass_ms_i4"
+                              Name 52  "result12"
+                              Name 55  "subpass_ms_u4"
+                              Name 60  "result20"
+                              Name 61  "subpass_f3"
+                              Name 70  "result21"
+                              Name 71  "subpass_i3"
+                              Name 80  "result22"
+                              Name 81  "subpass_u3"
+                              Name 88  "result30"
+                              Name 89  "subpass_ms_f3"
+                              Name 96  "result31"
+                              Name 97  "subpass_ms_i3"
+                              Name 104  "result32"
+                              Name 105  "subpass_ms_u3"
+                              Name 114  "result40"
+                              Name 115  "subpass_f2"
+                              Name 122  "result41"
+                              Name 123  "subpass_i2"
+                              Name 131  "result42"
+                              Name 132  "subpass_u2"
+                              Name 138  "result50"
+                              Name 139  "subpass_ms_f2"
+                              Name 146  "result51"
+                              Name 147  "subpass_ms_i2"
+                              Name 153  "result52"
+                              Name 154  "subpass_ms_u2"
+                              Name 161  "result60"
+                              Name 162  "subpass_f"
+                              Name 167  "result61"
+                              Name 168  "subpass_i"
+                              Name 173  "result62"
+                              Name 174  "subpass_u"
+                              Name 178  "result70"
+                              Name 179  "subpass_ms_f"
+                              Name 183  "result71"
+                              Name 184  "subpass_ms_i"
+                              Name 188  "result72"
+                              Name 189  "subpass_ms_u"
+                              Name 193  "result73"
+                              Name 194  "subpass_2"
+                              Name 202  "@entryPointOutput"
+                              Decorate 15(subpass_f4) DescriptorSet 0
+                              Decorate 15(subpass_f4) Binding 1
+                              Decorate 15(subpass_f4) InputAttachmentIndex 1
+                              Decorate 27(subpass_i4) DescriptorSet 0
+                              Decorate 27(subpass_i4) InputAttachmentIndex 2
+                              Decorate 36(subpass_u4) DescriptorSet 0
+                              Decorate 36(subpass_u4) InputAttachmentIndex 3
+                              Decorate 42(subpass_ms_f4) DescriptorSet 0
+                              Decorate 42(subpass_ms_f4) InputAttachmentIndex 4
+                              Decorate 49(subpass_ms_i4) DescriptorSet 0
+                              Decorate 49(subpass_ms_i4) InputAttachmentIndex 5
+                              Decorate 55(subpass_ms_u4) DescriptorSet 0
+                              Decorate 55(subpass_ms_u4) InputAttachmentIndex 6
+                              Decorate 61(subpass_f3) DescriptorSet 0
+                              Decorate 61(subpass_f3) InputAttachmentIndex 1
+                              Decorate 71(subpass_i3) DescriptorSet 0
+                              Decorate 71(subpass_i3) InputAttachmentIndex 2
+                              Decorate 81(subpass_u3) DescriptorSet 0
+                              Decorate 81(subpass_u3) InputAttachmentIndex 3
+                              Decorate 89(subpass_ms_f3) DescriptorSet 0
+                              Decorate 89(subpass_ms_f3) InputAttachmentIndex 4
+                              Decorate 97(subpass_ms_i3) DescriptorSet 0
+                              Decorate 97(subpass_ms_i3) InputAttachmentIndex 5
+                              Decorate 105(subpass_ms_u3) DescriptorSet 0
+                              Decorate 105(subpass_ms_u3) InputAttachmentIndex 6
+                              Decorate 115(subpass_f2) DescriptorSet 0
+                              Decorate 115(subpass_f2) InputAttachmentIndex 1
+                              Decorate 123(subpass_i2) DescriptorSet 0
+                              Decorate 123(subpass_i2) InputAttachmentIndex 2
+                              Decorate 132(subpass_u2) DescriptorSet 0
+                              Decorate 132(subpass_u2) InputAttachmentIndex 3
+                              Decorate 139(subpass_ms_f2) DescriptorSet 0
+                              Decorate 139(subpass_ms_f2) InputAttachmentIndex 4
+                              Decorate 147(subpass_ms_i2) DescriptorSet 0
+                              Decorate 147(subpass_ms_i2) InputAttachmentIndex 5
+                              Decorate 154(subpass_ms_u2) DescriptorSet 0
+                              Decorate 154(subpass_ms_u2) InputAttachmentIndex 6
+                              Decorate 162(subpass_f) DescriptorSet 0
+                              Decorate 162(subpass_f) InputAttachmentIndex 1
+                              Decorate 168(subpass_i) DescriptorSet 0
+                              Decorate 168(subpass_i) InputAttachmentIndex 2
+                              Decorate 174(subpass_u) DescriptorSet 0
+                              Decorate 174(subpass_u) InputAttachmentIndex 3
+                              Decorate 179(subpass_ms_f) DescriptorSet 0
+                              Decorate 179(subpass_ms_f) InputAttachmentIndex 4
+                              Decorate 184(subpass_ms_i) DescriptorSet 0
+                              Decorate 184(subpass_ms_i) InputAttachmentIndex 5
+                              Decorate 189(subpass_ms_u) DescriptorSet 0
+                              Decorate 189(subpass_ms_u) InputAttachmentIndex 6
+                              Decorate 194(subpass_2) DescriptorSet 0
+                              Decorate 194(subpass_2) InputAttachmentIndex 7
+                              Decorate 202(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+              11:             TypePointer Function 7(fvec4)
+              13:             TypeImage 6(float) SubpassData nonsampled format:Unknown
+              14:             TypePointer UniformConstant 13
+  15(subpass_f4):     14(ptr) Variable UniformConstant
+              17:             TypeInt 32 1
+              18:     17(int) Constant 0
+              19:             TypeVector 17(int) 2
+              20:   19(ivec2) ConstantComposite 18 18
+              22:             TypeVector 17(int) 4
+              23:             TypePointer Function 22(ivec4)
+              25:             TypeImage 17(int) SubpassData nonsampled format:Unknown
+              26:             TypePointer UniformConstant 25
+  27(subpass_i4):     26(ptr) Variable UniformConstant
+              30:             TypeInt 32 0
+              31:             TypeVector 30(int) 4
+              32:             TypePointer Function 31(ivec4)
+              34:             TypeImage 30(int) SubpassData nonsampled format:Unknown
+              35:             TypePointer UniformConstant 34
+  36(subpass_u4):     35(ptr) Variable UniformConstant
+              40:             TypeImage 6(float) SubpassData multi-sampled nonsampled format:Unknown
+              41:             TypePointer UniformConstant 40
+42(subpass_ms_f4):     41(ptr) Variable UniformConstant
+              44:     17(int) Constant 3
+              47:             TypeImage 17(int) SubpassData multi-sampled nonsampled format:Unknown
+              48:             TypePointer UniformConstant 47
+49(subpass_ms_i4):     48(ptr) Variable UniformConstant
+              53:             TypeImage 30(int) SubpassData multi-sampled nonsampled format:Unknown
+              54:             TypePointer UniformConstant 53
+55(subpass_ms_u4):     54(ptr) Variable UniformConstant
+              58:             TypeVector 6(float) 3
+              59:             TypePointer Function 58(fvec3)
+  61(subpass_f3):     14(ptr) Variable UniformConstant
+              68:             TypeVector 17(int) 3
+              69:             TypePointer Function 68(ivec3)
+  71(subpass_i3):     26(ptr) Variable UniformConstant
+              78:             TypeVector 30(int) 3
+              79:             TypePointer Function 78(ivec3)
+  81(subpass_u3):     35(ptr) Variable UniformConstant
+89(subpass_ms_f3):     41(ptr) Variable UniformConstant
+97(subpass_ms_i3):     48(ptr) Variable UniformConstant
+105(subpass_ms_u3):     54(ptr) Variable UniformConstant
+             112:             TypeVector 6(float) 2
+             113:             TypePointer Function 112(fvec2)
+ 115(subpass_f2):     14(ptr) Variable UniformConstant
+             121:             TypePointer Function 19(ivec2)
+ 123(subpass_i2):     26(ptr) Variable UniformConstant
+             129:             TypeVector 30(int) 2
+             130:             TypePointer Function 129(ivec2)
+ 132(subpass_u2):     35(ptr) Variable UniformConstant
+139(subpass_ms_f2):     41(ptr) Variable UniformConstant
+             141:     17(int) Constant 2
+147(subpass_ms_i2):     48(ptr) Variable UniformConstant
+154(subpass_ms_u2):     54(ptr) Variable UniformConstant
+             160:             TypePointer Function 6(float)
+  162(subpass_f):     14(ptr) Variable UniformConstant
+             166:             TypePointer Function 17(int)
+  168(subpass_i):     26(ptr) Variable UniformConstant
+             172:             TypePointer Function 30(int)
+  174(subpass_u):     35(ptr) Variable UniformConstant
+179(subpass_ms_f):     41(ptr) Variable UniformConstant
+184(subpass_ms_i):     48(ptr) Variable UniformConstant
+189(subpass_ms_u):     54(ptr) Variable UniformConstant
+  194(subpass_2):     14(ptr) Variable UniformConstant
+             197:    6(float) Constant 0
+             198:    7(fvec4) ConstantComposite 197 197 197 197
+             201:             TypePointer Output 7(fvec4)
+202(@entryPointOutput):    201(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+             203:    7(fvec4) FunctionCall 9(@main()
+                              Store 202(@entryPointOutput) 203
+                              Return
+                              FunctionEnd
+       9(@main():    7(fvec4) Function None 8
+              10:             Label
+    12(result00):     11(ptr) Variable Function
+    24(result01):     23(ptr) Variable Function
+    33(result02):     32(ptr) Variable Function
+    39(result10):     11(ptr) Variable Function
+    46(result11):     23(ptr) Variable Function
+    52(result12):     32(ptr) Variable Function
+    60(result20):     59(ptr) Variable Function
+    70(result21):     69(ptr) Variable Function
+    80(result22):     79(ptr) Variable Function
+    88(result30):     59(ptr) Variable Function
+    96(result31):     69(ptr) Variable Function
+   104(result32):     79(ptr) Variable Function
+   114(result40):    113(ptr) Variable Function
+   122(result41):    121(ptr) Variable Function
+   131(result42):    130(ptr) Variable Function
+   138(result50):    113(ptr) Variable Function
+   146(result51):    121(ptr) Variable Function
+   153(result52):    130(ptr) Variable Function
+   161(result60):    160(ptr) Variable Function
+   167(result61):    166(ptr) Variable Function
+   173(result62):    172(ptr) Variable Function
+   178(result70):    160(ptr) Variable Function
+   183(result71):    166(ptr) Variable Function
+   188(result72):    172(ptr) Variable Function
+   193(result73):     11(ptr) Variable Function
+              16:          13 Load 15(subpass_f4)
+              21:    7(fvec4) ImageRead 16 20
+                              Store 12(result00) 21
+              28:          25 Load 27(subpass_i4)
+              29:   22(ivec4) ImageRead 28 20
+                              Store 24(result01) 29
+              37:          34 Load 36(subpass_u4)
+              38:   31(ivec4) ImageRead 37 20
+                              Store 33(result02) 38
+              43:          40 Load 42(subpass_ms_f4)
+              45:    7(fvec4) ImageRead 43 20 Sample 44
+                              Store 39(result10) 45
+              50:          47 Load 49(subpass_ms_i4)
+              51:   22(ivec4) ImageRead 50 20 Sample 44
+                              Store 46(result11) 51
+              56:          53 Load 55(subpass_ms_u4)
+              57:   31(ivec4) ImageRead 56 20 Sample 44
+                              Store 52(result12) 57
+              62:          13 Load 61(subpass_f3)
+              63:    7(fvec4) ImageRead 62 20
+              64:    6(float) CompositeExtract 63 0
+              65:    6(float) CompositeExtract 63 1
+              66:    6(float) CompositeExtract 63 2
+              67:   58(fvec3) CompositeConstruct 64 65 66
+                              Store 60(result20) 67
+              72:          25 Load 71(subpass_i3)
+              73:   22(ivec4) ImageRead 72 20
+              74:     17(int) CompositeExtract 73 0
+              75:     17(int) CompositeExtract 73 1
+              76:     17(int) CompositeExtract 73 2
+              77:   68(ivec3) CompositeConstruct 74 75 76
+                              Store 70(result21) 77
+              82:          34 Load 81(subpass_u3)
+              83:   31(ivec4) ImageRead 82 20
+              84:     30(int) CompositeExtract 83 0
+              85:     30(int) CompositeExtract 83 1
+              86:     30(int) CompositeExtract 83 2
+              87:   78(ivec3) CompositeConstruct 84 85 86
+                              Store 80(result22) 87
+              90:          40 Load 89(subpass_ms_f3)
+              91:    7(fvec4) ImageRead 90 20 Sample 44
+              92:    6(float) CompositeExtract 91 0
+              93:    6(float) CompositeExtract 91 1
+              94:    6(float) CompositeExtract 91 2
+              95:   58(fvec3) CompositeConstruct 92 93 94
+                              Store 88(result30) 95
+              98:          47 Load 97(subpass_ms_i3)
+              99:   22(ivec4) ImageRead 98 20 Sample 44
+             100:     17(int) CompositeExtract 99 0
+             101:     17(int) CompositeExtract 99 1
+             102:     17(int) CompositeExtract 99 2
+             103:   68(ivec3) CompositeConstruct 100 101 102
+                              Store 96(result31) 103
+             106:          53 Load 105(subpass_ms_u3)
+             107:   31(ivec4) ImageRead 106 20 Sample 44
+             108:     30(int) CompositeExtract 107 0
+             109:     30(int) CompositeExtract 107 1
+             110:     30(int) CompositeExtract 107 2
+             111:   78(ivec3) CompositeConstruct 108 109 110
+                              Store 104(result32) 111
+             116:          13 Load 115(subpass_f2)
+             117:    7(fvec4) ImageRead 116 20
+             118:    6(float) CompositeExtract 117 0
+             119:    6(float) CompositeExtract 117 1
+             120:  112(fvec2) CompositeConstruct 118 119
+                              Store 114(result40) 120
+             124:          25 Load 123(subpass_i2)
+             125:   22(ivec4) ImageRead 124 20
+             126:     17(int) CompositeExtract 125 0
+             127:     17(int) CompositeExtract 125 1
+             128:   19(ivec2) CompositeConstruct 126 127
+                              Store 122(result41) 128
+             133:          34 Load 132(subpass_u2)
+             134:   31(ivec4) ImageRead 133 20
+             135:     30(int) CompositeExtract 134 0
+             136:     30(int) CompositeExtract 134 1
+             137:  129(ivec2) CompositeConstruct 135 136
+                              Store 131(result42) 137
+             140:          40 Load 139(subpass_ms_f2)
+             142:    7(fvec4) ImageRead 140 20 Sample 141
+             143:    6(float) CompositeExtract 142 0
+             144:    6(float) CompositeExtract 142 1
+             145:  112(fvec2) CompositeConstruct 143 144
+                              Store 138(result50) 145
+             148:          47 Load 147(subpass_ms_i2)
+             149:   22(ivec4) ImageRead 148 20 Sample 141
+             150:     17(int) CompositeExtract 149 0
+             151:     17(int) CompositeExtract 149 1
+             152:   19(ivec2) CompositeConstruct 150 151
+                              Store 146(result51) 152
+             155:          53 Load 154(subpass_ms_u2)
+             156:   31(ivec4) ImageRead 155 20 Sample 141
+             157:     30(int) CompositeExtract 156 0
+             158:     30(int) CompositeExtract 156 1
+             159:  129(ivec2) CompositeConstruct 157 158
+                              Store 153(result52) 159
+             163:          13 Load 162(subpass_f)
+             164:    7(fvec4) ImageRead 163 20
+             165:    6(float) CompositeExtract 164 0
+                              Store 161(result60) 165
+             169:          25 Load 168(subpass_i)
+             170:   22(ivec4) ImageRead 169 20
+             171:     17(int) CompositeExtract 170 0
+                              Store 167(result61) 171
+             175:          34 Load 174(subpass_u)
+             176:   31(ivec4) ImageRead 175 20
+             177:     30(int) CompositeExtract 176 0
+                              Store 173(result62) 177
+             180:          40 Load 179(subpass_ms_f)
+             181:    7(fvec4) ImageRead 180 20 Sample 141
+             182:    6(float) CompositeExtract 181 0
+                              Store 178(result70) 182
+             185:          47 Load 184(subpass_ms_i)
+             186:   22(ivec4) ImageRead 185 20 Sample 141
+             187:     17(int) CompositeExtract 186 0
+                              Store 183(result71) 187
+             190:          53 Load 189(subpass_ms_u)
+             191:   31(ivec4) ImageRead 190 20 Sample 141
+             192:     30(int) CompositeExtract 191 0
+                              Store 188(result72) 192
+             195:          13 Load 194(subpass_2)
+             196:    7(fvec4) ImageRead 195 20
+                              Store 193(result73) 196
+                              ReturnValue 198
+                              FunctionEnd

+ 69 - 68
3rdparty/glslang/Test/baseResults/spv.atomic.comp.out

@@ -1,7 +1,7 @@
 spv.atomic.comp
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 73
+// Id's are bound by 74
 
                               Capability Shader
                               Capability AtomicStorage
@@ -17,29 +17,29 @@ spv.atomic.comp
                               Name 20  "counter"
                               Name 23  "val"
                               Name 27  "countArr"
-                              Name 35  "origi"
-                              Name 37  "atomi"
-                              Name 40  "origu"
-                              Name 42  "atomu"
-                              Name 43  "value"
-                              Name 60  "dataSSB"
-                              MemberName 60(dataSSB) 0  "f"
-                              MemberName 60(dataSSB) 1  "n_frames_rendered"
-                              Name 62  "result"
-                              Name 70  "arrX"
-                              Name 71  "arrY"
-                              Name 72  "arrZ"
+                              Name 37  "origi"
+                              Name 39  "atomi"
+                              Name 42  "origu"
+                              Name 44  "atomu"
+                              Name 45  "value"
+                              Name 62  "dataSSB"
+                              MemberName 62(dataSSB) 0  "f"
+                              MemberName 62(dataSSB) 1  "n_frames_rendered"
+                              Name 64  "result"
+                              Name 71  "arrX"
+                              Name 72  "arrY"
+                              Name 73  "arrZ"
                               Decorate 20(counter) Offset 0
                               Decorate 20(counter) Binding 0
                               Decorate 27(countArr) Offset 4
                               Decorate 27(countArr) Binding 0
-                              MemberDecorate 60(dataSSB) 0 Restrict
-                              MemberDecorate 60(dataSSB) 0 Offset 0
-                              MemberDecorate 60(dataSSB) 1 Restrict
-                              MemberDecorate 60(dataSSB) 1 Offset 16
-                              Decorate 60(dataSSB) BufferBlock
-                              Decorate 62(result) DescriptorSet 0
-                              Decorate 62(result) Binding 0
+                              MemberDecorate 62(dataSSB) 0 Restrict
+                              MemberDecorate 62(dataSSB) 0 Offset 0
+                              MemberDecorate 62(dataSSB) 1 Restrict
+                              MemberDecorate 62(dataSSB) 1 Offset 16
+                              Decorate 62(dataSSB) BufferBlock
+                              Decorate 64(result) DescriptorSet 0
+                              Decorate 64(result) Binding 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 0
@@ -56,29 +56,29 @@ spv.atomic.comp
     27(countArr):     26(ptr) Variable AtomicCounter
               28:             TypeInt 32 1
               29:     28(int) Constant 2
-              34:             TypePointer Function 28(int)
-              36:             TypePointer Workgroup 28(int)
-       37(atomi):     36(ptr) Variable Workgroup
-              38:     28(int) Constant 3
-              41:             TypePointer Workgroup 6(int)
-       42(atomu):     41(ptr) Variable Workgroup
-       43(value):     41(ptr) Variable Workgroup
-              46:      6(int) Constant 7
-              51:     28(int) Constant 7
-              55:      6(int) Constant 10
-              58:             TypeFloat 32
-              59:             TypeVector 28(int) 4
-     60(dataSSB):             TypeStruct 58(float) 59(ivec4)
-              61:             TypePointer Uniform 60(dataSSB)
-      62(result):     61(ptr) Variable Uniform
-              63:     28(int) Constant 1
-              64:      6(int) Constant 2
-              65:             TypePointer Uniform 28(int)
-              68:             TypeArray 28(int) 14
-              69:             TypePointer Private 68
-        70(arrX):     69(ptr) Variable Private
-        71(arrY):     69(ptr) Variable Private
-        72(arrZ):     69(ptr) Variable Private
+              33:     28(int) Constant 1
+              36:             TypePointer Function 28(int)
+              38:             TypePointer Workgroup 28(int)
+       39(atomi):     38(ptr) Variable Workgroup
+              40:     28(int) Constant 3
+              43:             TypePointer Workgroup 6(int)
+       44(atomu):     43(ptr) Variable Workgroup
+       45(value):     43(ptr) Variable Workgroup
+              48:      6(int) Constant 7
+              53:     28(int) Constant 7
+              57:      6(int) Constant 10
+              60:             TypeFloat 32
+              61:             TypeVector 28(int) 4
+     62(dataSSB):             TypeStruct 60(float) 61(ivec4)
+              63:             TypePointer Uniform 62(dataSSB)
+      64(result):     63(ptr) Variable Uniform
+              65:      6(int) Constant 2
+              66:             TypePointer Uniform 28(int)
+              69:             TypeArray 28(int) 14
+              70:             TypePointer Private 69
+        71(arrX):     70(ptr) Variable Private
+        72(arrY):     70(ptr) Variable Private
+        73(arrZ):     70(ptr) Variable Private
          4(main):           2 Function None 3
                5:             Label
          23(val):     22(ptr) Variable Function
@@ -88,7 +88,8 @@ spv.atomic.comp
               31:      6(int) AtomicLoad 30 14 15
                               Store 23(val) 31
               32:      6(int) AtomicIDecrement 20(counter) 14 15
-              33:      6(int) AtomicIIncrement 20(counter) 14 15
+              34:      6(int) ISub 32 33
+              35:      6(int) AtomicIIncrement 20(counter) 14 15
                               Return
                               FunctionEnd
    10(func(au1;):      6(int) Function None 8
@@ -99,29 +100,29 @@ spv.atomic.comp
                               FunctionEnd
       12(atoms():           2 Function None 3
               13:             Label
-       35(origi):     34(ptr) Variable Function
-       40(origu):     22(ptr) Variable Function
-              39:     28(int) AtomicIAdd 37(atomi) 14 15 38
-                              Store 35(origi) 39
-              44:      6(int) Load 43(value)
-              45:      6(int) AtomicAnd 42(atomu) 14 15 44
-                              Store 40(origu) 45
-              47:      6(int) AtomicOr 42(atomu) 14 15 46
-                              Store 40(origu) 47
-              48:      6(int) AtomicXor 42(atomu) 14 15 46
-                              Store 40(origu) 48
-              49:      6(int) Load 43(value)
-              50:      6(int) AtomicUMin 42(atomu) 14 15 49
-                              Store 40(origu) 50
-              52:     28(int) AtomicSMax 37(atomi) 14 15 51
-                              Store 35(origi) 52
-              53:     28(int) Load 35(origi)
-              54:     28(int) AtomicExchange 37(atomi) 14 15 53
-                              Store 35(origi) 54
-              56:      6(int) Load 43(value)
-              57:      6(int) AtomicCompareExchange 42(atomu) 14 15 15 56 55
-                              Store 40(origu) 57
-              66:     65(ptr) AccessChain 62(result) 63 64
-              67:     28(int) AtomicIAdd 66 14 15 63
+       37(origi):     36(ptr) Variable Function
+       42(origu):     22(ptr) Variable Function
+              41:     28(int) AtomicIAdd 39(atomi) 14 15 40
+                              Store 37(origi) 41
+              46:      6(int) Load 45(value)
+              47:      6(int) AtomicAnd 44(atomu) 14 15 46
+                              Store 42(origu) 47
+              49:      6(int) AtomicOr 44(atomu) 14 15 48
+                              Store 42(origu) 49
+              50:      6(int) AtomicXor 44(atomu) 14 15 48
+                              Store 42(origu) 50
+              51:      6(int) Load 45(value)
+              52:      6(int) AtomicUMin 44(atomu) 14 15 51
+                              Store 42(origu) 52
+              54:     28(int) AtomicSMax 39(atomi) 14 15 53
+                              Store 37(origi) 54
+              55:     28(int) Load 37(origi)
+              56:     28(int) AtomicExchange 39(atomi) 14 15 55
+                              Store 37(origi) 56
+              58:      6(int) Load 45(value)
+              59:      6(int) AtomicCompareExchange 44(atomu) 14 15 15 58 57
+                              Store 42(origu) 59
+              67:     66(ptr) AccessChain 64(result) 33 65
+              68:     28(int) AtomicIAdd 67 14 15 33
                               Return
                               FunctionEnd

+ 76 - 0
3rdparty/glslang/Test/baseResults/spv.register.subpass.frag.out

@@ -0,0 +1,76 @@
+spv.register.subpass.frag
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 40
+
+                              Capability Shader
+                              Capability StorageImageMultisample
+                              Capability InputAttachment
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 38
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 9  "@main("
+                              Name 12  "result00"
+                              Name 15  "subpass_f4"
+                              Name 22  "result10"
+                              Name 25  "subpass_ms_f4"
+                              Name 29  "result73"
+                              Name 30  "subpass_2"
+                              Name 38  "@entryPointOutput"
+                              Decorate 15(subpass_f4) DescriptorSet 0
+                              Decorate 15(subpass_f4) Binding 21
+                              Decorate 15(subpass_f4) InputAttachmentIndex 1
+                              Decorate 25(subpass_ms_f4) DescriptorSet 0
+                              Decorate 25(subpass_ms_f4) Binding 20
+                              Decorate 25(subpass_ms_f4) InputAttachmentIndex 4
+                              Decorate 30(subpass_2) DescriptorSet 0
+                              Decorate 30(subpass_2) Binding 22
+                              Decorate 30(subpass_2) InputAttachmentIndex 7
+                              Decorate 38(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+              11:             TypePointer Function 7(fvec4)
+              13:             TypeImage 6(float) SubpassData nonsampled format:Unknown
+              14:             TypePointer UniformConstant 13
+  15(subpass_f4):     14(ptr) Variable UniformConstant
+              17:             TypeInt 32 1
+              18:     17(int) Constant 0
+              19:             TypeVector 17(int) 2
+              20:   19(ivec2) ConstantComposite 18 18
+              23:             TypeImage 6(float) SubpassData multi-sampled nonsampled format:Unknown
+              24:             TypePointer UniformConstant 23
+25(subpass_ms_f4):     24(ptr) Variable UniformConstant
+              27:     17(int) Constant 3
+   30(subpass_2):     14(ptr) Variable UniformConstant
+              33:    6(float) Constant 0
+              34:    7(fvec4) ConstantComposite 33 33 33 33
+              37:             TypePointer Output 7(fvec4)
+38(@entryPointOutput):     37(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              39:    7(fvec4) FunctionCall 9(@main()
+                              Store 38(@entryPointOutput) 39
+                              Return
+                              FunctionEnd
+       9(@main():    7(fvec4) Function None 8
+              10:             Label
+    12(result00):     11(ptr) Variable Function
+    22(result10):     11(ptr) Variable Function
+    29(result73):     11(ptr) Variable Function
+              16:          13 Load 15(subpass_f4)
+              21:    7(fvec4) ImageRead 16 20
+                              Store 12(result00) 21
+              26:          23 Load 25(subpass_ms_f4)
+              28:    7(fvec4) ImageRead 26 20 Sample 27
+                              Store 22(result10) 28
+              31:          13 Load 30(subpass_2)
+              32:    7(fvec4) ImageRead 31 20
+                              Store 29(result73) 32
+                              ReturnValue 34
+                              FunctionEnd

+ 18 - 0
3rdparty/glslang/Test/hlsl.attributeC11.frag

@@ -0,0 +1,18 @@
+struct S {
+    float2 f;
+};
+
+[[vk::binding(1)]]
+StructuredBuffer<S> buffer1;
+
+[[vk::binding(3, 2)]]
+StructuredBuffer<S> buffer3;
+
+[[vk::input_attachment_index(4)]]
+Texture2D<float4> attach;
+
+[[vk::location(7)]] float4
+main([[vk::location(8)]] float4 input: A) : B
+{
+    return input + attach.Load(float2(0.5));
+}

+ 3 - 2
3rdparty/glslang/Test/hlsl.flattenOpaqueInit.vert

@@ -18,5 +18,6 @@ float4 main() : SV_TARGET0
 {
     FxaaTex tex1 = { g_tInputTexture_sampler, g_tInputTexture };
     FxaaTex tex2 = fillOpaque();
-    return lookUp(tex1);
-}
+    FxaaTex tex3 = tex1;
+    return lookUp(tex3);
+}

+ 36 - 0
3rdparty/glslang/Test/hlsl.flattenSubset.frag

@@ -0,0 +1,36 @@
+struct S0
+{
+    int x;
+    int y;
+    SamplerState ss;
+};
+
+struct S1
+{
+    float b;
+    SamplerState samplerState;
+    S0 s0;
+    int a;
+};
+
+struct S2
+{
+    int a1;
+    int a2;
+    int a3;
+    int a4;
+    int a5;
+    S1 resources;
+};
+
+SamplerState samp;
+Texture2D tex;
+
+float4 main(float4 vpos : VPOS) : COLOR0
+{
+    S1 s1;
+    S2 s2;
+    s1.s0.ss = samp;
+    s2.resources = s1;
+    return tex.Sample(s2.resources.s0.ss, float2(0.5));
+}

+ 24 - 0
3rdparty/glslang/Test/hlsl.flattenSubset2.frag

@@ -0,0 +1,24 @@
+struct Nested { float y; Texture2D texNested; };
+struct A { Nested n; float x; };
+struct B { Nested n; Texture2D tex; };
+
+Texture2D someTex;
+
+float4 main(float4 vpos : VPOS) : COLOR0
+{
+    A a1, a2;
+    B b;
+
+    // Assignment of nested structs to nested structs
+    a1.n = a2.n;
+    b .n = a1.n;
+
+    // Assignment of nested struct to standalone
+    Nested n = b.n; 
+
+    // Assignment to nestested struct members
+    a2.n.texNested = someTex;
+    a1.n.y = 1.0;
+
+    return float4(0,0,0,0);
+}

+ 4 - 0
3rdparty/glslang/Test/hlsl.localStructuredBuffer.comp

@@ -0,0 +1,4 @@
+RWStructuredBuffer<uint> srt0;
+void main() {
+    RWStructuredBuffer<uint> srt0Local = srt0;
+}

+ 14 - 0
3rdparty/glslang/Test/hlsl.samplecmp.dualmode.frag

@@ -0,0 +1,14 @@
+SamplerState g_sSamp : register(s0);
+SamplerComparisonState g_sSampCmp : register(s1);
+
+uniform Texture1D <float4> g_tTex : register(t3);
+
+float4 main() : SV_Target0
+{
+    // This texture is used with both shadow modes.  It will need post-compilation
+    // legalization.
+    g_tTex.SampleCmp(g_sSampCmp, 0.1, 0.75);
+    g_tTex.Sample(g_sSamp, 0.1);
+
+    return 0;
+}

+ 113 - 0
3rdparty/glslang/Test/hlsl.subpass.frag

@@ -0,0 +1,113 @@
+
+layout(input_attachment_index = 1) SubpassInput<float4> subpass_f4 : register(t1);
+layout(input_attachment_index = 2) SubpassInput<int4>   subpass_i4;
+layout(input_attachment_index = 3) SubpassInput<uint4>  subpass_u4;
+
+layout(input_attachment_index = 4) SubpassInputMS<float4> subpass_ms_f4;
+layout(input_attachment_index = 5) SubpassInputMS<int4>   subpass_ms_i4;
+layout(input_attachment_index = 6) SubpassInputMS<uint4>  subpass_ms_u4;
+
+layout(input_attachment_index = 1) SubpassInput<float3> subpass_f3;
+layout(input_attachment_index = 2) SubpassInput<int3>   subpass_i3;
+layout(input_attachment_index = 3) SubpassInput<uint3>  subpass_u3;
+
+layout(input_attachment_index = 4) SubpassInputMS<float3> subpass_ms_f3;
+layout(input_attachment_index = 5) SubpassInputMS<int3>   subpass_ms_i3;
+layout(input_attachment_index = 6) SubpassInputMS<uint3>  subpass_ms_u3;
+
+layout(input_attachment_index = 1) SubpassInput<float2> subpass_f2;
+layout(input_attachment_index = 2) SubpassInput<int2>   subpass_i2;
+layout(input_attachment_index = 3) SubpassInput<uint2>  subpass_u2;
+
+layout(input_attachment_index = 4) SubpassInputMS<float2> subpass_ms_f2;
+layout(input_attachment_index = 5) SubpassInputMS<int2>   subpass_ms_i2;
+layout(input_attachment_index = 6) SubpassInputMS<uint2>  subpass_ms_u2;
+
+layout(input_attachment_index = 1) SubpassInput<float> subpass_f;
+layout(input_attachment_index = 2) SubpassInput<int>   subpass_i;
+layout(input_attachment_index = 3) SubpassInput<uint>  subpass_u;
+
+layout(input_attachment_index = 4) SubpassInputMS<float> subpass_ms_f;
+layout(input_attachment_index = 5) SubpassInputMS<int>   subpass_ms_i;
+layout(input_attachment_index = 6) SubpassInputMS<uint>  subpass_ms_u;
+
+[[vk::input_attachment_index(7)]] SubpassInput subpass_2;
+
+struct mystruct_f_t
+{
+    float  c0;
+    float2 c1;
+    float  c2;
+};
+
+struct mystruct_i_t
+{
+    int  c0;
+    int2 c1;
+    int  c2;
+};
+
+struct mystruct_u_t
+{
+    uint  c0;
+    uint2 c1;
+    uint  c2;
+};
+
+// TODO: ...
+// layout(input_attachment_index = 7) SubpassInput<mystruct_f_t>    subpass_fs;
+// layout(input_attachment_index = 8) SubpassInputMS<mystruct_f_t>  subpass_ms_fs;
+
+// layout(input_attachment_index = 7) SubpassInput<mystruct_i_t>    subpass_is;
+// layout(input_attachment_index = 8) SubpassInputMS<mystruct_i_t>  subpass_ms_is;
+
+// layout(input_attachment_index = 7) SubpassInput<mystruct_u_t>    subpass_us;
+// layout(input_attachment_index = 8) SubpassInputMS<mystruct_u_t>  subpass_ms_us;
+
+float4 main() : SV_Target0
+{
+    float4 result00 = subpass_f4.SubpassLoad();
+    int4   result01 = subpass_i4.SubpassLoad();
+    uint4  result02 = subpass_u4.SubpassLoad();
+
+    float4 result10 = subpass_ms_f4.SubpassLoad(3);
+    int4   result11 = subpass_ms_i4.SubpassLoad(3);
+    uint4  result12 = subpass_ms_u4.SubpassLoad(3);
+
+    float3 result20 = subpass_f3.SubpassLoad();
+    int3   result21 = subpass_i3.SubpassLoad();
+    uint3  result22 = subpass_u3.SubpassLoad();
+
+    float3 result30 = subpass_ms_f3.SubpassLoad(3);
+    int3   result31 = subpass_ms_i3.SubpassLoad(3);
+    uint3  result32 = subpass_ms_u3.SubpassLoad(3);
+
+    float2 result40 = subpass_f2.SubpassLoad();
+    int2   result41 = subpass_i2.SubpassLoad();
+    uint2  result42 = subpass_u2.SubpassLoad();
+
+    float2 result50 = subpass_ms_f2.SubpassLoad(2);
+    int2   result51 = subpass_ms_i2.SubpassLoad(2);
+    uint2  result52 = subpass_ms_u2.SubpassLoad(2);
+
+    float  result60 = subpass_f.SubpassLoad();
+    int    result61 = subpass_i.SubpassLoad();
+    uint   result62 = subpass_u.SubpassLoad();
+
+    float  result70 = subpass_ms_f.SubpassLoad(2);
+    int    result71 = subpass_ms_i.SubpassLoad(2);
+    uint   result72 = subpass_ms_u.SubpassLoad(2);
+
+    float4 result73 = subpass_2.SubpassLoad();
+
+    // TODO: 
+    // mystruct_f_t result80 = subpass_fs.SubpassLoad();
+    // mystruct_i_t result81 = subpass_is.SubpassLoad();
+    // mystruct_u_t result82 = subpass_us.SubpassLoad();
+
+    // mystruct_f_t result90 = subpass_ms_sf.SubpassLoad(2);
+    // mystruct_i_t result91 = subpass_ms_if.SubpassLoad(2);
+    // mystruct_u_t result92 = subpass_ms_uf.SubpassLoad(2);
+
+    return 0;
+}

+ 15 - 0
3rdparty/glslang/Test/spv.register.subpass.frag

@@ -0,0 +1,15 @@
+
+// Test binding autoassignment and offset for SubpassInput objects
+
+layout(input_attachment_index = 1) SubpassInput<float4> subpass_f4 : register(t1);
+layout(input_attachment_index = 4) SubpassInputMS<float4> subpass_ms_f4;
+[[vk::input_attachment_index(7)]] SubpassInput subpass_2;
+
+float4 main() : SV_Target0
+{
+    float4 result00 = subpass_f4.SubpassLoad();
+    float4 result10 = subpass_ms_f4.SubpassLoad(3);
+    float4 result73 = subpass_2.SubpassLoad();
+
+    return 0;
+}

+ 3 - 2
3rdparty/glslang/glslang/Include/intermediate.h

@@ -417,8 +417,8 @@ enum TOperator {
     EOpAtomicExchange,
     EOpAtomicCompSwap,
 
-    EOpAtomicCounterIncrement,
-    EOpAtomicCounterDecrement,
+    EOpAtomicCounterIncrement, // results in pre-increment value
+    EOpAtomicCounterDecrement, // results in post-decrement value
     EOpAtomicCounter,
     EOpAtomicCounterAdd,
     EOpAtomicCounterSubtract,
@@ -979,6 +979,7 @@ public:
         constSubtree(nullptr)
           { name = n; }
     virtual int getId() const { return id; }
+    virtual void setId(int newId) { id = newId; }
     virtual const TString& getName() const { return name; }
     virtual void traverse(TIntermTraverser*);
     virtual       TIntermSymbol* getAsSymbolNode()       { return this; }

+ 7 - 0
3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp

@@ -196,6 +196,7 @@ bool TOutputTraverser::visitBinary(TVisit /* visit */, TIntermBinary* node)
     case EOpLogicalOr:  out.debug << "logical-or";   break;
     case EOpLogicalXor: out.debug << "logical-xor"; break;
     case EOpLogicalAnd: out.debug << "logical-and"; break;
+
     default: out.debug << "<unknown op>";
     }
 
@@ -491,6 +492,9 @@ bool TOutputTraverser::visitUnary(TVisit /* visit */, TIntermUnary* node)
     case EOpConvUint16ToUint64:     out.debug << "Convert uint16 to uint64";    break;
 #endif
 
+    case EOpSubpassLoad:   out.debug << "subpassLoad";   break;
+    case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
+
     default: out.debug.message(EPrefixError, "Bad unary op");
     }
 
@@ -791,6 +795,9 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
     case EOpWorkgroupMemoryBarrier:           out.debug << "WorkgroupMemoryBarrier";           break;
     case EOpWorkgroupMemoryBarrierWithGroupSync: out.debug << "WorkgroupMemoryBarrierWithGroupSync"; break;
 
+    case EOpSubpassLoad:   out.debug << "subpassLoad";   break;
+    case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
+
     default: out.debug.message(EPrefixError, "Bad aggregation op");
     }
 

+ 2 - 1
3rdparty/glslang/glslang/MachineIndependent/iomapper.cpp

@@ -497,7 +497,8 @@ protected:
     }
 
     static bool isTextureType(const glslang::TType& type) {
-        return type.getBasicType() == glslang::EbtSampler && type.getSampler().isTexture();
+        return (type.getBasicType() == glslang::EbtSampler && 
+                (type.getSampler().isTexture() || type.getSampler().isSubpass()));
     }
 
     static bool isUboType(const glslang::TType& type) {

+ 8 - 1
3rdparty/glslang/gtests/Hlsl.FromFile.cpp

@@ -99,6 +99,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.assoc.frag", "PixelShaderFunction"},
         {"hlsl.attribute.frag", "PixelShaderFunction"},
         {"hlsl.attribute.expression.comp", "main"},
+        {"hlsl.attributeC11.frag", "main"},
         {"hlsl.basic.comp", "main"},
         {"hlsl.basic.geom", "main"},
         {"hlsl.boolConv.vert", "main"},
@@ -152,6 +153,8 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.flattenOpaque.frag", "main"},
         {"hlsl.flattenOpaqueInit.vert", "main"},
         {"hlsl.flattenOpaqueInitMix.vert", "main"},
+        {"hlsl.flattenSubset.frag", "main"},
+        {"hlsl.flattenSubset2.frag", "main"},
         {"hlsl.forLoop.frag", "PixelShaderFunction"},
         {"hlsl.gather.array.dx10.frag", "main"},
         {"hlsl.gather.basic.dx10.frag", "main"},
@@ -216,6 +219,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.load.rwtexture.array.dx10.frag", "main"},
         {"hlsl.load.offset.dx10.frag", "main"},
         {"hlsl.load.offsetarray.dx10.frag", "main"},
+        {"hlsl.localStructuredBuffer.comp", "main"},
         {"hlsl.logical.binary.frag", "main"},
         {"hlsl.logical.binary.vec.frag", "main"},
         {"hlsl.logicalConvert.frag", "main"},
@@ -266,6 +270,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.samplebias.offsetarray.dx10.frag", "main"},
         {"hlsl.samplecmp.array.dx10.frag", "main"},
         {"hlsl.samplecmp.basic.dx10.frag", "main"},
+        {"hlsl.samplecmp.dualmode.frag", "main"},
         {"hlsl.samplecmp.offset.dx10.frag", "main"},
         {"hlsl.samplecmp.offsetarray.dx10.frag", "main"},
         {"hlsl.samplecmp.negative.frag", "main"},
@@ -317,6 +322,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.structin.vert", "main"},
         {"hlsl.structIoFourWay.frag", "main"},
         {"hlsl.structStructName.frag", "main"},
+        {"hlsl.subpass.frag", "main"},
         {"hlsl.synthesizeInput.frag", "main"},
         {"hlsl.texture.struct.frag", "main"},
         {"hlsl.texture.subvec4.frag", "main"},
@@ -374,7 +380,8 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.aliasOpaque.frag", "main"},
         {"hlsl.flattenOpaque.frag", "main"},
         {"hlsl.flattenOpaqueInit.vert", "main"},
-        {"hlsl.flattenOpaqueInitMix.vert", "main"}
+        {"hlsl.flattenOpaqueInitMix.vert", "main"},
+        {"hlsl.flattenSubset.frag", "main"}
     }),
     FileNameAsCustomTestSuffix
 );

+ 1 - 0
3rdparty/glslang/gtests/Spv.FromFile.cpp

@@ -334,6 +334,7 @@ INSTANTIATE_TEST_CASE_P(
         { "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
         { "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, 30, false, false },
         { "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, 30, true, true },
+        { "spv.register.subpass.frag", "main", 0, 20, 0, 0, 0, true, true },
         { "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
         { "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
         { "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },

+ 19 - 3
3rdparty/glslang/hlsl/hlslAttributes.cpp

@@ -40,11 +40,27 @@
 namespace glslang {
     // Map the given string to an attribute enum from TAttributeType,
     // or EatNone if invalid.
-    TAttributeType TAttributeMap::attributeFromName(const TString& name)
+    TAttributeType TAttributeMap::attributeFromName(const TString& nameSpace, const TString& name)
     {
         // These are case insensitive.
         TString lowername(name);
         std::transform(lowername.begin(), lowername.end(), lowername.begin(), ::tolower);
+        TString lowernameSpace(nameSpace);
+        std::transform(lowernameSpace.begin(), lowernameSpace.end(), lowernameSpace.begin(), ::tolower);
+
+        // handle names within a namespace
+
+        if (lowernameSpace == "vk") {
+            if (lowername == "input_attachment_index")
+                return EatInputAttachment;
+            else if (lowername == "location")
+                return EatLocation;
+            else if (lowername == "binding")
+                return EatBinding;
+        } else if (lowernameSpace.size() > 0)
+            return EatNone;
+
+        // handle names with no namespace
 
         if (lowername == "allow_uav_condition")
             return EatAllow_uav_condition;
@@ -88,12 +104,12 @@ namespace glslang {
 
     // Look up entry, inserting if it's not there, and if name is a valid attribute name
     // as known by attributeFromName.
-    TAttributeType TAttributeMap::setAttribute(const TString* name, TIntermAggregate* value)
+    TAttributeType TAttributeMap::setAttribute(const TString& nameSpace, const TString* name, TIntermAggregate* value)
     {
         if (name == nullptr)
             return EatNone;
 
-        const TAttributeType attr = attributeFromName(*name);
+        const TAttributeType attr = attributeFromName(nameSpace, *name);
 
         if (attr != EatNone)
             attributes[attr] = value;

+ 5 - 2
3rdparty/glslang/hlsl/hlslAttributes.h

@@ -63,6 +63,9 @@ namespace glslang {
         EatPatchSize,
         EatUnroll,
         EatLoop,
+        EatBinding,
+        EatLocation,
+        EatInputAttachment
     };
 }
 
@@ -82,7 +85,7 @@ namespace glslang {
     public:
         // Search for and potentially add the attribute into the map.  Return the
         // attribute type enum for it, if found, else EatNone.
-        TAttributeType setAttribute(const TString* name, TIntermAggregate* value);
+        TAttributeType setAttribute(const TString& nameSpace, const TString* name, TIntermAggregate* value);
 
         // Const lookup: search for (but do not modify) the attribute in the map.
         const TIntermAggregate* operator[](TAttributeType) const;
@@ -92,7 +95,7 @@ namespace glslang {
 
     protected:
         // Find an attribute enum given its name.
-        static TAttributeType attributeFromName(const TString&);
+        static TAttributeType attributeFromName(const TString& nameSpace, const TString& name);
 
         std::unordered_map<TAttributeType, TIntermAggregate*> attributes;
     };

+ 120 - 10
3rdparty/glslang/hlsl/hlslGrammar.cpp

@@ -295,13 +295,16 @@ bool HlslGrammar::acceptSamplerDeclarationDX9(TType& /*type*/)
 }
 
 // declaration
+//      : attributes attributed_declaration
+//      | NAMESPACE IDENTIFIER LEFT_BRACE declaration_list RIGHT_BRACE
+//
+// attributed_declaration
 //      : sampler_declaration_dx9 post_decls SEMICOLON
 //      | 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
-//      | NAMESPACE IDENTIFIER LEFT_BRACE declaration_list RIGHT_BRACE
 //
 // declarator_list
 //      : declarator COMMA declarator COMMA declarator...  // zero or more declarators
@@ -376,6 +379,8 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
     if (! acceptFullySpecifiedType(declaredType, nodeList))
         return false;
 
+    parseContext.transferTypeAttributes(declarator.attributes, declaredType);
+
     // cbuffer and tbuffer end with the closing '}'.
     // No semicolon is included.
     if (forbidDeclarators)
@@ -1083,6 +1088,69 @@ bool HlslGrammar::acceptAnnotations(TQualifier&)
     return true;
 }
 
+// subpass input type
+//      : SUBPASSINPUT
+//      | SUBPASSINPUT VECTOR LEFT_ANGLE template_type RIGHT_ANGLE
+//      | SUBPASSINPUTMS
+//      | SUBPASSINPUTMS VECTOR LEFT_ANGLE template_type RIGHT_ANGLE
+bool HlslGrammar::acceptSubpassInputType(TType& type)
+{
+    // read subpass type
+    const EHlslTokenClass subpassInputType = peek();
+
+    bool multisample;
+
+    switch (subpassInputType) {
+    case EHTokSubpassInput:   multisample = false; break;
+    case EHTokSubpassInputMS: multisample = true;  break;
+    default:
+        return false;  // not a subpass input declaration
+    }
+
+    advanceToken();  // consume the sampler type keyword
+
+    TType subpassType(EbtFloat, EvqUniform, 4); // default type is float4
+
+    if (acceptTokenClass(EHTokLeftAngle)) {
+        if (! acceptType(subpassType)) {
+            expected("scalar or vector type");
+            return false;
+        }
+
+        const TBasicType basicRetType = subpassType.getBasicType() ;
+
+        switch (basicRetType) {
+        case EbtFloat:
+        case EbtUint:
+        case EbtInt:
+        case EbtStruct:
+            break;
+        default:
+            unimplemented("basic type in subpass input");
+            return false;
+        }
+
+        if (! acceptTokenClass(EHTokRightAngle)) {
+            expected("right angle bracket");
+            return false;
+        }
+    }
+
+    const TBasicType subpassBasicType = subpassType.isStruct() ? (*subpassType.getStruct())[0].type->getBasicType()
+        : subpassType.getBasicType();
+
+    TSampler sampler;
+    sampler.setSubpass(subpassBasicType, multisample);
+
+    // Remember the declared return type.  Function returns false on error.
+    if (!parseContext.setTextureReturnType(sampler, subpassType, token.loc))
+        return false;
+
+    type.shallowCopy(TType(sampler, EvqUniform));
+
+    return true;
+}
+
 // sampler_type
 //      : SAMPLER
 //      | SAMPLER1D
@@ -1352,6 +1420,11 @@ bool HlslGrammar::acceptType(TType& type, TIntermNode*& nodeList)
         return acceptSamplerType(type);
         break;
 
+    case EHTokSubpassInput:           // fall through
+    case EHTokSubpassInputMS:         // ...
+        return acceptSubpassInputType(type);
+        break;
+
     case EHTokBuffer:                 // fall through
     case EHTokTexture1d:              // ...
     case EHTokTexture1darray:         // ...
@@ -2371,16 +2444,25 @@ bool HlslGrammar::acceptDefaultParameterDeclaration(const TType& type, TIntermTy
 }
 
 // parameter_declaration
+//      : attributes attributed_declaration
+//
+// attributed_declaration
 //      : fully_specified_type post_decls [ = default_parameter_declaration ]
 //      | fully_specified_type identifier array_specifier post_decls [ = default_parameter_declaration ]
 //
 bool HlslGrammar::acceptParameterDeclaration(TFunction& function)
 {
+    // attributes
+    TAttributeMap attributes;
+    acceptAttributes(attributes);
+
     // fully_specified_type
     TType* type = new TType;
     if (! acceptFullySpecifiedType(*type))
         return false;
 
+    parseContext.transferTypeAttributes(attributes, *type);
+
     // identifier
     HlslToken idToken;
     acceptIdentifier(idToken);
@@ -3256,7 +3338,15 @@ bool HlslGrammar::acceptStatement(TIntermNode*& statement)
 }
 
 // attributes
-//      : list of zero or more of:  LEFT_BRACKET attribute RIGHT_BRACKET
+//      : [zero or more:] bracketed-attribute
+//
+// bracketed-attribute:
+//      : LEFT_BRACKET scoped-attribute RIGHT_BRACKET
+//      : LEFT_BRACKET LEFT_BRACKET scoped-attribute RIGHT_BRACKET RIGHT_BRACKET
+//
+// scoped-attribute:
+//      : attribute
+//      | namespace COLON COLON attribute
 //
 // attribute:
 //      : UNROLL
@@ -3283,18 +3373,33 @@ void HlslGrammar::acceptAttributes(TAttributeMap& attributes)
     // numthreads, which is used to set the CS local size.
     // TODO: subset to correct set?  Pass on?
     do {
-        HlslToken idToken;
+        HlslToken attributeToken;
 
         // LEFT_BRACKET?
         if (! acceptTokenClass(EHTokLeftBracket))
             return;
+        // another LEFT_BRACKET?
+        bool doubleBrackets = false;
+        if (acceptTokenClass(EHTokLeftBracket))
+            doubleBrackets = true;
+
+        // attribute? (could be namespace; will adjust later)
+        if (!acceptIdentifier(attributeToken)) {
+            if (!peekTokenClass(EHTokRightBracket)) {
+                expected("namespace or attribute identifier");
+                advanceToken();
+            }
+        }
 
-        // attribute
-        if (acceptIdentifier(idToken)) {
-            // 'idToken.string' is the attribute
-        } else if (! peekTokenClass(EHTokRightBracket)) {
-            expected("identifier");
-            advanceToken();
+        TString nameSpace;
+        if (acceptTokenClass(EHTokColonColon)) {
+            // namespace COLON COLON
+            nameSpace = *attributeToken.string;
+            // attribute
+            if (!acceptIdentifier(attributeToken)) {
+                expected("attribute identifier");
+                return;
+            }
         }
 
         TIntermAggregate* expressions = nullptr;
@@ -3327,10 +3432,15 @@ void HlslGrammar::acceptAttributes(TAttributeMap& attributes)
             expected("]");
             return;
         }
+        // another RIGHT_BRACKET?
+        if (doubleBrackets && !acceptTokenClass(EHTokRightBracket)) {
+            expected("]]");
+            return;
+        }
 
         // Add any values we found into the attribute map.  This accepts
         // (and ignores) values not mapping to a known TAttributeType;
-        attributes.setAttribute(idToken.string, expressions);
+        attributes.setAttribute(nameSpace, attributeToken.string, expressions);
     } while (true);
 }
 

+ 1 - 0
3rdparty/glslang/hlsl/hlslGrammar.h

@@ -87,6 +87,7 @@ namespace glslang {
         bool acceptAnnotations(TQualifier&);
         bool acceptSamplerType(TType&);
         bool acceptTextureType(TType&);
+        bool acceptSubpassInputType(TType&);
         bool acceptStructBufferType(TType&);
         bool acceptConstantBufferType(TType&);
         bool acceptStruct(TType&, TIntermNode*& nodeList);

+ 190 - 55
3rdparty/glslang/hlsl/hlslParseHelper.cpp

@@ -1379,6 +1379,44 @@ TIntermTyped* HlslParseContext::flattenAccess(int uniqueId, int member, const TT
     return subsetSymbol;
 }
 
+// For finding where the first leaf is in a subtree of a multi-level aggregate
+// that is just getting a subset assigned. Follows the same logic as flattenAccess,
+// but logically going down the "left-most" tree branch each step of the way.
+//
+// Returns the offset into the first leaf of the subset.
+int HlslParseContext::findSubtreeOffset(const TIntermNode& node) const
+{
+    const TIntermSymbol* sym = node.getAsSymbolNode();
+    if (sym == nullptr)
+        return 0;
+    if (!sym->isArray() && !sym->isStruct())
+        return 0;
+    int subset = sym->getFlattenSubset();
+    if (subset == -1)
+        return 0;
+
+    // Getting this far means a partial aggregate is identified by the flatten subset.
+    // Find the first leaf of the subset.
+
+    const auto flattenData = flattenMap.find(sym->getId());
+    if (flattenData == flattenMap.end())
+        return 0;
+
+    return findSubtreeOffset(sym->getType(), subset, flattenData->second.offsets);
+
+    do {
+        subset = flattenData->second.offsets[subset];
+    } while (true);
+}
+// Recursively do the desent
+int HlslParseContext::findSubtreeOffset(const TType& type, int subset, const TVector<int>& offsets) const
+{
+    if (!type.isArray() && !type.isStruct())
+        return offsets[subset];
+    TType derefType(type, 0);
+    return findSubtreeOffset(derefType, offsets[subset], offsets);
+};
+
 // Find and return the split IO TVariable for id, or nullptr if none.
 TVariable* HlslParseContext::getSplitNonIoVar(int id) const
 {
@@ -1666,7 +1704,6 @@ TIntermAggregate* HlslParseContext::handleFunctionDefinition(const TSourceLoc& l
     return paramNodes;
 }
 
-
 // Handle all [attrib] attribute for the shader entry point
 void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const TAttributeMap& attributes)
 {
@@ -1815,6 +1852,44 @@ void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const T
     }
 }
 
+// Update the given type with any type-like attribute information in the
+// attributes.
+void HlslParseContext::transferTypeAttributes(const TAttributeMap& attributes, TType& type)
+{
+    // extract integers out of attribute arguments stored in attribute aggregate
+    const auto getInt = [&](TAttributeType attr, int argNum, int& value) -> bool {
+        const TIntermAggregate* attrAgg = attributes[attr];
+        if (attrAgg == nullptr)
+            return false;
+        if (argNum >= (int)attrAgg->getSequence().size())
+            return false;
+        const TConstUnion& intConst = attrAgg->getSequence()[argNum]->getAsConstantUnion()->getConstArray()[0];
+        if (intConst.getType() != EbtInt)
+            return false;
+        value = intConst.getIConst();
+        return true;
+    };
+
+    // location
+    int value;
+    if (getInt(EatLocation, 0, value))
+        type.getQualifier().layoutLocation = value;
+
+    // binding
+    if (getInt(EatBinding, 0, value)) {
+        type.getQualifier().layoutBinding = value;
+        type.getQualifier().layoutSet = 0;
+    }
+
+    // set
+    if (getInt(EatBinding, 1, value))
+        type.getQualifier().layoutSet = value;
+
+    // input attachment
+    if (getInt(EatInputAttachment, 0, value))
+        type.getQualifier().layoutAttachment = value;
+}
+
 //
 // Do all special handling for the entry point, including wrapping
 // the shader's entry point with the official entry point that will call it.
@@ -2558,30 +2633,29 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
         }
     }
 
-    int memberIdx = 0;
-
     // When dealing with split arrayed structures of built-ins, the arrayness is moved to the extracted built-in
     // variables, which is awkward when copying between split and unsplit structures.  This variable tracks
     // array indirections so they can be percolated from outer structs to inner variables.
     std::vector <int> arrayElement;
 
-    // We track the outer-most aggregate, so that we can use its storage class later.
-    const TIntermTyped* outerLeft  = left;
-    const TIntermTyped* outerRight = right;
+    TStorageQualifier leftStorage = left->getType().getQualifier().storage;
+    TStorageQualifier rightStorage = right->getType().getQualifier().storage;
 
-    const auto getMember = [&](bool isLeft, TIntermTyped* node, int member, TIntermTyped* splitNode, int splitMember)
+    int leftOffset = findSubtreeOffset(*left);
+    int rightOffset = findSubtreeOffset(*right);
+
+    const auto getMember = [&](bool isLeft, const TType& type, int member, TIntermTyped* splitNode, int splitMember)
                            -> TIntermTyped * {
         const bool flattened = isLeft ? isFlattenLeft : isFlattenRight;
         const bool split     = isLeft ? isSplitLeft   : isSplitRight;
 
         TIntermTyped* subTree;
-        const TType derefType(node->getType(), member);
+        const TType derefType(type, member);
         const TVariable* builtInVar = nullptr;
         if ((flattened || split) && derefType.isBuiltIn()) {
-            const TIntermTyped* outer = isLeft ? outerLeft : outerRight;
             auto splitPair = splitBuiltIns.find(HlslParseContext::tInterstageIoData(
                                                    derefType.getQualifier().builtIn,
-                                                   outer->getType().getQualifier().storage));
+                                                   isLeft ? leftStorage : rightStorage));
             if (splitPair != splitBuiltIns.end())
                 builtInVar = splitPair->second;
         }
@@ -2598,12 +2672,14 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
                 subTree->setType(splitDerefType);
             }
         } else if (flattened && isFinalFlattening(derefType)) {
-            const TVector<TVariable*>& flatVariables = isLeft ? *leftVariables : *rightVariables;
-            subTree = intermediate.addSymbol(*flatVariables[memberIdx++]);
+            if (isLeft)
+                subTree = intermediate.addSymbol(*(*leftVariables)[leftOffset++]);
+            else
+                subTree = intermediate.addSymbol(*(*rightVariables)[rightOffset++]);
         } else {
             // Index operator if it's an aggregate, else EOpNull
-            const TOperator accessOp = node->getType().isArray()  ? EOpIndexDirect
-                                     : node->getType().isStruct() ? EOpIndexDirectStruct
+            const TOperator accessOp = type.isArray()  ? EOpIndexDirect
+                                     : type.isStruct() ? EOpIndexDirectStruct
                                      : EOpNull;
             if (accessOp == EOpNull) {
                 subTree = splitNode;
@@ -2644,12 +2720,12 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
                 arrayElement.push_back(element);
 
                 // Add a new AST symbol node if we have a temp variable holding a complex RHS.
-                TIntermTyped* subLeft  = getMember(true,  left,  element, left, element);
-                TIntermTyped* subRight = getMember(false, right, element, right, element);
+                TIntermTyped* subLeft  = getMember(true,  left->getType(),  element, left, element);
+                TIntermTyped* subRight = getMember(false, right->getType(), element, right, element);
 
-                TIntermTyped* subSplitLeft =  isSplitLeft  ? getMember(true,  left,  element, splitLeft, element)
+                TIntermTyped* subSplitLeft =  isSplitLeft  ? getMember(true,  left->getType(),  element, splitLeft, element)
                                                            : subLeft;
-                TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right, element, splitRight, element)
+                TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right->getType(), element, splitRight, element)
                                                            : subRight;
 
                 traverse(subLeft, subRight, subSplitLeft, subSplitRight);
@@ -2674,13 +2750,13 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
                 const TType& typeL = *membersL[member].type;
                 const TType& typeR = *membersR[member].type;
 
-                TIntermTyped* subLeft  = getMember(true,  left, member, left, member);
-                TIntermTyped* subRight = getMember(false, right, member, right, member);
+                TIntermTyped* subLeft  = getMember(true,  left->getType(), member, left, member);
+                TIntermTyped* subRight = getMember(false, right->getType(), member, right, member);
 
                 // If there is no splitting, use the same values to avoid inefficiency.
-                TIntermTyped* subSplitLeft =  isSplitLeft  ? getMember(true,  left,  member, splitLeft, memberL)
+                TIntermTyped* subSplitLeft =  isSplitLeft  ? getMember(true,  left->getType(),  member, splitLeft, memberL)
                                                            : subLeft;
-                TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right, member, splitRight, memberR)
+                TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right->getType(), member, splitRight, memberR)
                                                            : subRight;
 
                 if (isClipOrCullDistance(subSplitLeft->getType()) || isClipOrCullDistance(subSplitRight->getType())) {
@@ -2860,37 +2936,66 @@ TIntermAggregate* HlslParseContext::handleSamplerTextureCombine(const TSourceLoc
 
     TSampler samplerType = argTex->getType().getSampler();
     samplerType.combined = true;
-    samplerType.shadow   = argSampler->getType().getSampler().shadow;
 
+    // TODO:
+    // This block exists until the spec no longer requires shadow modes on texture objects.
+    // It can be deleted after that, along with the shadowTextureVariant member.
     {
-        // ** TODO: **
-        // This forces the texture's shadow state to be the sampler's
-        // shadow state.  This can't work if a single texture is used with
-        // both comparison and non-comparison samplers, so an error is
-        // reported if the shader does that.
-        //
-        // If this code is ever removed (possibly due to a relaxation in the
-        // SPIR-V rules), also remove the textureShadowMode member variable.
+        const bool shadowMode = argSampler->getType().getSampler().shadow;
+
         TIntermSymbol* texSymbol = argTex->getAsSymbolNode();
 
         if (texSymbol == nullptr)
             texSymbol = argTex->getAsBinaryNode()->getLeft()->getAsSymbolNode();
 
-        if (texSymbol != nullptr) {
-            const auto textureShadowModeEntry = textureShadowMode.find(texSymbol->getId());
+        if (texSymbol == nullptr) {
+            error(loc, "unable to find texture symbol", "", "");
+            return nullptr;
+        }
 
-            // Check to see if this texture has been given a different shadow mode already.
-            if (textureShadowModeEntry != textureShadowMode.end() &&
-                textureShadowModeEntry->second != samplerType.shadow) {
-                error(loc, "all uses of texture must use the same shadow mode", "", "");
-                return nullptr;
-            }
+        // This forces the texture's shadow state to be the sampler's
+        // shadow state.  This depends on downstream optimization to
+        // DCE one variant in [shadow, nonshadow] if both are present,
+        // or the SPIR-V module would be invalid.
+        int newId = texSymbol->getId();
+
+        // Check to see if this texture has been given a shadow mode already.
+        // If so, look up the one we already have.
+        const auto textureShadowEntry = textureShadowVariant.find(texSymbol->getId());
+
+        if (textureShadowEntry != textureShadowVariant.end())
+            newId = textureShadowEntry->second->get(shadowMode);
+        else
+            textureShadowVariant[texSymbol->getId()] = new tShadowTextureSymbols;
+
+        // Sometimes we have to create another symbol (if this texture has been seen before,
+        // and we haven't created the form for this shadow mode).
+        if (newId == -1) {
+            TType texType;
+            texType.shallowCopy(argTex->getType());
+            texType.getSampler().shadow = shadowMode;  // set appropriate shadow mode.
+            globalQualifierFix(loc, texType.getQualifier());
+
+            TVariable* newTexture = makeInternalVariable(texSymbol->getName(), texType);
 
-            argTex->getWritableType().getSampler().shadow = samplerType.shadow;
-            textureShadowMode[texSymbol->getId()] = samplerType.shadow;
+            trackLinkage(*newTexture);
+
+            newId = newTexture->getUniqueId();
         }
-    }
 
+        assert(newId != -1);
+
+        if (textureShadowVariant.find(newId) == textureShadowVariant.end())
+            textureShadowVariant[newId] = textureShadowVariant[texSymbol->getId()];
+
+        textureShadowVariant[newId]->set(shadowMode, newId);
+
+        // Remember this shadow mode in the texture and the merged type.
+        argTex->getWritableType().getSampler().shadow = shadowMode;
+        samplerType.shadow = shadowMode;
+
+        texSymbol->setId(newId);
+    }
 
     txcombine->setType(TType(samplerType, EvqTemporary));
     txcombine->setLoc(loc);
@@ -4178,6 +4283,25 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
             break;
         }
 
+    case EOpSubpassLoad:
+        {
+            const TIntermTyped* argSubpass = 
+                argAggregate ? argAggregate->getSequence()[0]->getAsTyped() :
+                arguments->getAsTyped();
+
+            const TSampler& sampler = argSubpass->getType().getSampler();
+
+            // subpass load: the multisample form is overloaded.  Here, we convert that to
+            // the EOpSubpassLoadMS opcode.
+            if (argAggregate != nullptr && argAggregate->getSequence().size() > 1)
+                node->getAsOperator()->setOp(EOpSubpassLoadMS);
+
+            node = convertReturn(node, sampler);
+
+            break;
+        }
+        
+
     default:
         break; // most pass through unchanged
     }
@@ -7383,7 +7507,7 @@ TIntermNode* HlslParseContext::declareVariable(const TSourceLoc& loc, const TStr
         error(loc, "initializer requires a variable, not a member", identifier.c_str(), "");
         return nullptr;
     }
-    return executeInitializer(loc, initializer, variable, flattenVar);
+    return executeInitializer(loc, initializer, variable);
 }
 
 // Pick up global defaults from the provide global defaults into dst.
@@ -7451,8 +7575,7 @@ TVariable* HlslParseContext::declareNonArray(const TSourceLoc& loc, const TStrin
 // Returning nullptr just means there is no code to execute to handle the
 // initializer, which will, for example, be the case for constant initializers.
 //
-TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyped* initializer, TVariable* variable,
-                                                  bool flattened)
+TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyped* initializer, TVariable* variable)
 {
     //
     // Identifier must be of type constant, a global, or a temporary, and
@@ -8195,8 +8318,9 @@ void HlslParseContext::declareBlock(const TSourceLoc& loc, TType& type, const TS
         return;
     }
 
-    // Save it in the AST for linker use.
-    trackLinkage(variable);
+	// Save it in the AST for linker use.
+    if (symbolTable.atGlobalLevel())
+        trackLinkage(variable);
 }
 
 //
@@ -8916,6 +9040,12 @@ bool HlslParseContext::setTextureReturnType(TSampler& sampler, const TType& retT
         return false;
     }
 
+    // TODO: Subpass doesn't handle struct returns, due to some oddities with fn overloading.
+    if (sampler.isSubpass()) {
+        error(loc, "Unimplemented: structure template type in subpass input", "", "");
+        return false;
+    }
+
     TTypeList* members = retType.getWritableStruct();
 
     // Check for too many or not enough structure members.
@@ -9406,14 +9536,19 @@ void HlslParseContext::fixTextureShadowModes()
         TSampler& sampler = (*symbol)->getWritableType().getSampler();
 
         if (sampler.isTexture()) {
-            const auto shadowMode = textureShadowMode.find((*symbol)->getUniqueId());
-            if (shadowMode != textureShadowMode.end())
-                sampler.shadow = shadowMode->second;
+            const auto shadowMode = textureShadowVariant.find((*symbol)->getUniqueId());
+            if (shadowMode != textureShadowVariant.end()) {
+
+                if (shadowMode->second->overloaded())
+                    // Texture needs legalization if it's been seen with both shadow and non-shadow modes.
+                    intermediate.setNeedsLegalization();
+
+                sampler.shadow = shadowMode->second->isShadowId((*symbol)->getUniqueId());
+            }
         }
     }
 }
 
-
 // post-processing
 void HlslParseContext::finish()
 {
@@ -9423,15 +9558,15 @@ void HlslParseContext::finish()
         error(mipsOperatorMipArg.back().loc, "unterminated mips operator:", "", "");
     }
 
+    removeUnusedStructBufferCounters();
+    addPatchConstantInvocation();
+    fixTextureShadowModes();
+
     // Communicate out (esp. for command line) that we formed AST that will make
     // illegal AST SPIR-V and it needs transforms to legalize it.
     if (intermediate.needsLegalization())
         infoSink.info << "WARNING: AST will form illegal SPIR-V; need to transform to legalize";
 
-    removeUnusedStructBufferCounters();
-    addPatchConstantInvocation();
-    fixTextureShadowModes();
-
     TParseContextBase::finish();
 }
 

+ 27 - 5
3rdparty/glslang/hlsl/hlslParseHelper.h

@@ -83,6 +83,7 @@ public:
     TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&, const TAttributeMap&, TIntermNode*& entryPointTree);
     TIntermNode* transformEntryPoint(const TSourceLoc&, TFunction&, const TAttributeMap&);
     void handleEntryPointAttributes(const TSourceLoc&, const TAttributeMap&);
+    void transferTypeAttributes(const TAttributeMap&, TType&);
     void handleFunctionBody(const TSourceLoc&, TFunction&, TIntermNode* functionBody, TIntermNode*& node);
     void remapEntryPointIO(TFunction& function, TVariable*& returnValue, TVector<TVariable*>& inputs, TVector<TVariable*>& outputs);
     void remapNonEntryPointIO(TFunction& function);
@@ -233,7 +234,7 @@ protected:
     TIntermSymbol* makeInternalVariableNode(const TSourceLoc&, const char* name, const TType&) const;
     TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&, bool track);
     void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&, bool track);
-    TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable, bool flattened);
+    TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
     TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer, TIntermTyped* scalarInit);
     bool isScalarConstructor(const TIntermNode*);
     TOperator mapAtomicOp(const TSourceLoc& loc, TOperator op, bool isImage);
@@ -244,6 +245,8 @@ protected:
     // Array and struct flattening
     TIntermTyped* flattenAccess(TIntermTyped* base, int member);
     TIntermTyped* flattenAccess(int uniqueId, int member, const TType&, int subset = -1);
+    int findSubtreeOffset(const TIntermNode&) const;
+    int findSubtreeOffset(const TType&, int subset, const TVector<int>& offsets) const;
     bool shouldFlatten(const TType&) const;
     bool wasFlattened(const TIntermTyped* node) const;
     bool wasFlattened(int id) const { return flattenMap.find(id) != flattenMap.end(); }
@@ -454,10 +457,29 @@ protected:
 
     TVector<tMipsOperatorData> mipsOperatorMipArg;
 
-    // This can be removed if and when the texture shadow workarounnd in
-    // HlslParseContext::handleSamplerTextureCombine is removed.  It maps
-    // texture symbol IDs to the shadow modes of samplers they were combined with.
-    TMap<int, bool> textureShadowMode;
+    // A texture object may be used with shadow and non-shadow samplers, but both may not be
+    // alive post-DCE in the same shader.  We do not know at compilation time which are alive: that's
+    // only known post-DCE.  If a texture is used both ways, we create two textures, and
+    // leave the elimiation of one to the optimizer.  This maps the shader variant to
+    // the shadow variant.
+    //
+    // This can be removed if and when the texture shadow code in
+    // HlslParseContext::handleSamplerTextureCombine is removed.
+    struct tShadowTextureSymbols {
+        tShadowTextureSymbols() { symId.fill(-1); }
+
+        void set(bool shadow, int id) { symId[int(shadow)] = id; }
+        int get(bool shadow) const { return symId[int(shadow)]; }
+
+        // True if this texture has been seen with both shadow and non-shadow modes
+        bool overloaded() const { return symId[0] != -1 && symId[1] != -1; }
+        bool isShadowId(int id) const { return symId[1] == id; }
+
+    private:
+        std::array<int, 2> symId;
+    };
+
+    TMap<int, tShadowTextureSymbols*> textureShadowVariant;
 };
 
 // This is the prefix we use for built-in methods to avoid namespace collisions with

+ 43 - 15
3rdparty/glslang/hlsl/hlslParseables.cpp

@@ -68,14 +68,21 @@ const char* BaseTypeName(const char argOrder, const char* scalarName, const char
     }
 }
 
-bool IsSamplerType(const char argType) { return argType == 'S' || argType == 's'; }
-bool IsArrayed(const char argOrder)    { return argOrder == '@' || argOrder == '&' || argOrder == '#'; }
-bool IsTextureMS(const char argOrder)  { return argOrder == '$' || argOrder == '&'; }
-bool IsBuffer(const char argOrder)     { return argOrder == '*' || argOrder == '~'; }
-bool IsImage(const char argOrder)      { return argOrder == '!' || argOrder == '#' || argOrder == '~'; }
+// arg order queries
+bool IsSamplerType(const char argType)     { return argType == 'S' || argType == 's'; }
+bool IsArrayed(const char argOrder)        { return argOrder == '@' || argOrder == '&' || argOrder == '#'; }
+bool IsTextureNonMS(const char argOrder)   { return argOrder == '%'; }
+bool IsSubpassInput(const char argOrder)   { return argOrder == '[' || argOrder == ']'; }
+bool IsArrayedTexture(const char argOrder) { return argOrder == '@'; }
+bool IsTextureMS(const char argOrder)      { return argOrder == '$' || argOrder == '&'; }
+bool IsMS(const char argOrder)             { return IsTextureMS(argOrder) || argOrder == ']'; }
+bool IsBuffer(const char argOrder)         { return argOrder == '*' || argOrder == '~'; }
+bool IsImage(const char argOrder)          { return argOrder == '!' || argOrder == '#' || argOrder == '~'; }
+
 bool IsTextureType(const char argOrder)
 {
-    return argOrder == '%' || argOrder == '@' || IsTextureMS(argOrder) || IsBuffer(argOrder) | IsImage(argOrder);
+    return IsTextureNonMS(argOrder) || IsArrayedTexture(argOrder) ||
+           IsTextureMS(argOrder) || IsBuffer(argOrder) || IsImage(argOrder);
 }
 
 // Reject certain combinations that are illegal sample methods.  For example,
@@ -222,15 +229,16 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
     const bool isTexture   = IsTextureType(argOrder[0]);
     const bool isArrayed   = IsArrayed(argOrder[0]);
     const bool isSampler   = IsSamplerType(argType[0]);
-    const bool isMS        = IsTextureMS(argOrder[0]);
+    const bool isMS        = IsMS(argOrder[0]);
     const bool isBuffer    = IsBuffer(argOrder[0]);
     const bool isImage     = IsImage(argOrder[0]);
+    const bool isSubpass   = IsSubpassInput(argOrder[0]);
 
     char type  = *argType;
 
     if (isTranspose) {  // Take transpose of matrix dimensions
         std::swap(dim0, dim1);
-    } else if (isTexture) {
+    } else if (isTexture || isSubpass) {
         if (type == 'F')       // map base type to texture of that type.
             type = 'T';        // e.g, int -> itexture, uint -> utexture, etc.
         else if (type == 'I')
@@ -255,16 +263,23 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
         case 'S': s += "sampler";                             break;
         case 's': s += "SamplerComparisonState";              break;
         case 'T': s += ((isBuffer && isImage) ? "RWBuffer" :
+                        isSubpass ? "SubpassInput" :
                         isBuffer ? "Buffer" :
                         isImage  ? "RWTexture" : "Texture");  break;
         case 'i': s += ((isBuffer && isImage) ? "RWBuffer" :
+                        isSubpass ? "SubpassInput" :
                         isBuffer ? "Buffer" :
                         isImage ? "RWTexture" : "Texture");   break;
         case 'u': s += ((isBuffer && isImage) ? "RWBuffer" :
+                        isSubpass ? "SubpassInput" :
                         isBuffer ? "Buffer" :
                         isImage ? "RWTexture" : "Texture");   break;
         default:  s += "UNKNOWN_TYPE";                        break;
         }
+
+        if (isSubpass && isMS)
+            s += "MS";
+
     } else {
         switch (type) {
         case '-': s += "void"; break;
@@ -282,6 +297,7 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
                 s += type;
 
             s += ((isImage && isBuffer) ? "imageBuffer"   :
+                  isSubpass             ? "subpassInput" :
                   isImage               ? "image"         :
                   isBuffer              ? "samplerBuffer" :
                   "texture");
@@ -296,6 +312,9 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
     if (fixedVecSize != 0)
         dim0 = dim1 = fixedVecSize;
 
+    const char dim0Char = ('0' + char(dim0));
+    const char dim1Char = ('0' + char(dim1));
+
     // Add sampler dimensions
     if (isSampler || isTexture) {
         if ((order == 'V' || isTexture) && !isBuffer) {
@@ -320,12 +339,12 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
         case '-': break;  // no dimensions for voids
         case 'S': break;  // no dimensions on scalars
         case 'V':
-            s += ('0' + char(dim0));
+            s += dim0Char;
             break;
         case 'M':
-            s += ('0' + char(dim0));
+            s += dim0Char;
             s += 'x';
-            s += ('0' + char(dim1));
+            s += dim1Char;
             break;
         default:
             break;
@@ -339,9 +358,9 @@ glslang::TString& AppendTypeName(glslang::TString& s, const char* argOrder, cons
     // For HLSL, append return type for texture types
     if (UseHlslTypes) {
         switch (type) {
-        case 'i': s += "<int4>";   break;
-        case 'u': s += "<uint4>";  break;
-        case 'T': s += "<float4>"; break;
+        case 'i': s += "<int";   s += dim0Char; s += ">"; break;
+        case 'u': s += "<uint";  s += dim0Char; s += ">"; break;
+        case 'T': s += "<float"; s += dim0Char; s += ">"; break;
         default: break;
         }
     }
@@ -414,7 +433,7 @@ inline void FindVectorMatrixBounds(const char* argOrder, int fixedVecSize, int&
         const char* nthArgOrder(NthArg(argOrder, arg));
         if (nthArgOrder == nullptr)
             break;
-        else if (*nthArgOrder == 'V')
+        else if (*nthArgOrder == 'V' || IsSubpassInput(*nthArgOrder))
             dim0Max = 4;
         else if (*nthArgOrder == 'M')
             dim0Max = dim1Max = 4;
@@ -537,6 +556,7 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c
     // '!' as first letter of order creates image object
     // '#' as first letter of order creates arrayed image object
     // '~' as first letter of order creates an image buffer object
+    // '[' / ']' as first letter of order creates a SubpassInput/SubpassInputMS object
 
     static const struct {
         const char*   name;      // intrinsic name
@@ -882,6 +902,10 @@ void TBuiltInParseablesHlsl::initialize(int /*version*/, EProfile /*profile*/, c
         { "DecrementCounter",                 nullptr, nullptr,   "-",              "-",              EShLangAll,   true },
         { "Consume",                          nullptr, nullptr,   "-",              "-",              EShLangAll,   true },
 
+        // Methods for subpass input objects
+        { "SubpassLoad",                      "V4",    nullptr,   "[",              "FIU",            EShLangPS,    true },
+        { "SubpassLoad",                      "V4",    nullptr,   "],S",            "FIU,I",          EShLangPS,    true },
+
         // Mark end of list, since we want to avoid a range-based for, as some compilers don't handle it yet.
         { nullptr,                            nullptr, nullptr,   nullptr,      nullptr,  0, false },
     };
@@ -1219,6 +1243,10 @@ void TBuiltInParseablesHlsl::identifyBuiltIns(int /*version*/, EProfile /*profil
     // GS methods
     symbolTable.relateToOperator(BUILTIN_PREFIX "Append",                      EOpMethodAppend);
     symbolTable.relateToOperator(BUILTIN_PREFIX "RestartStrip",                EOpMethodRestartStrip);
+
+    // Subpass input methods
+    symbolTable.relateToOperator(BUILTIN_PREFIX "SubpassLoad",                 EOpSubpassLoad);
+    symbolTable.relateToOperator(BUILTIN_PREFIX "SubpassLoadMS",               EOpSubpassLoadMS);
 }
 
 //

+ 4 - 0
3rdparty/glslang/hlsl/hlslScanContext.cpp

@@ -336,6 +336,8 @@ void HlslScanContext::fillInKeywordMap()
     (*KeywordMap)["RWTexture2DArray"] =        EHTokRWTexture2darray;
     (*KeywordMap)["RWTexture3D"] =             EHTokRWTexture3d;
     (*KeywordMap)["RWBuffer"] =                EHTokRWBuffer;
+    (*KeywordMap)["SubpassInput"] =            EHTokSubpassInput;
+    (*KeywordMap)["SubpassInputMS"] =          EHTokSubpassInputMS;
 
     (*KeywordMap)["AppendStructuredBuffer"] =  EHTokAppendStructuredBuffer;
     (*KeywordMap)["ByteAddressBuffer"] =       EHTokByteAddressBuffer;
@@ -827,6 +829,8 @@ EHlslTokenClass HlslScanContext::tokenizeIdentifier()
     case EHTokRWByteAddressBuffer:
     case EHTokRWStructuredBuffer:
     case EHTokStructuredBuffer:
+    case EHTokSubpassInput:
+    case EHTokSubpassInputMS:
         return keyword;
 
     // variable, user type, ...

+ 2 - 0
3rdparty/glslang/hlsl/hlslTokens.h

@@ -273,6 +273,8 @@ enum EHlslTokenClass {
     EHTokRWTexture2darray,
     EHTokRWTexture3d,
     EHTokRWBuffer,
+    EHTokSubpassInput,
+    EHTokSubpassInputMS,
 
     // Structure buffer variants
     EHTokAppendStructuredBuffer,