Branimir Karadžić пре 8 година
родитељ
комит
f53a43ed07
36 измењених фајлова са 2841 додато и 1676 уклоњено
  1. 16 15
      3rdparty/glslang/README.md
  2. 9 3
      3rdparty/glslang/SPIRV/GlslangToSpv.cpp
  3. 37 32
      3rdparty/glslang/Test/baseLegalResults/hlsl.aliasOpaque.frag.out
  4. 53 45
      3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaque.frag.out
  5. 40 41
      3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out
  6. 32 32
      3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out
  7. 48 28
      3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset.frag.out
  8. 30 18
      3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset2.frag.out
  9. 90 72
      3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenLocal.vert.out
  10. 26 20
      3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenMixed.vert.out
  11. 143 0
      3rdparty/glslang/Test/baseResults/hlsl.PointSize.geom.out
  12. 69 0
      3rdparty/glslang/Test/baseResults/hlsl.PointSize.vert.out
  13. 140 105
      3rdparty/glslang/Test/baseResults/hlsl.aliasOpaque.frag.out
  14. 573 0
      3rdparty/glslang/Test/baseResults/hlsl.color.hull.tesc.out
  15. 305 156
      3rdparty/glslang/Test/baseResults/hlsl.flattenOpaque.frag.out
  16. 171 253
      3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInit.vert.out
  17. 120 165
      3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInitMix.vert.out
  18. 120 122
      3rdparty/glslang/Test/baseResults/hlsl.flattenSubset.frag.out
  19. 149 108
      3rdparty/glslang/Test/baseResults/hlsl.flattenSubset2.frag.out
  20. 104 0
      3rdparty/glslang/Test/baseResults/hlsl.layoutOverride.vert.out
  21. 7 37
      3rdparty/glslang/Test/baseResults/hlsl.localStructuredBuffer.comp.out
  22. 180 171
      3rdparty/glslang/Test/baseResults/hlsl.partialFlattenLocal.vert.out
  23. 67 50
      3rdparty/glslang/Test/baseResults/hlsl.partialFlattenMixed.vert.out
  24. 54 64
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.fn.frag.out
  25. 76 84
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn.frag.out
  26. 43 45
      3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn2.comp.out
  27. 11 0
      3rdparty/glslang/Test/hlsl.PointSize.geom
  28. 4 0
      3rdparty/glslang/Test/hlsl.PointSize.vert
  29. 74 0
      3rdparty/glslang/Test/hlsl.color.hull.tesc
  30. 1 0
      3rdparty/glslang/Test/hlsl.flattenOpaqueInit.vert
  31. 7 0
      3rdparty/glslang/Test/hlsl.layoutOverride.vert
  32. 4 0
      3rdparty/glslang/gtests/Hlsl.FromFile.cpp
  33. 3 1
      3rdparty/glslang/hlsl/hlslAttributes.cpp
  34. 4 1
      3rdparty/glslang/hlsl/hlslAttributes.h
  35. 11 3
      3rdparty/glslang/hlsl/hlslGrammar.cpp
  36. 20 5
      3rdparty/glslang/hlsl/hlslParseHelper.cpp

+ 16 - 15
3rdparty/glslang/README.md

@@ -57,20 +57,22 @@ branch.
 
 
 ### Dependencies
 ### Dependencies
 
 
+* A C++11 compiler
 * [CMake][cmake]: for generating compilation targets.
 * [CMake][cmake]: for generating compilation targets.
+* make: _Linux_, ninja is an alternative, if configured.
 * [Python 2.7][python]: for executing SPIRV-Tools scripts. (Optional if not using SPIRV-Tools.)
 * [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).
 * [bison][bison]: _optional_, but needed when changing the grammar (glslang.y).
 * [googletest][googletest]: _optional_, but should use if making any changes to glslang.
 * [googletest][googletest]: _optional_, but should use if making any changes to glslang.
 
 
 ### Build steps
 ### Build steps
 
 
+The following steps assume a Bash shell. On Windows, that could be the Git Bash
+shell or some other shell of your choosing.
+
 #### 1) Check-Out this project 
 #### 1) Check-Out this project 
 
 
 ```bash
 ```bash
 cd <parent of where you want glslang to be>
 cd <parent of where you want glslang to be>
-# If using SSH
-git clone [email protected]:KhronosGroup/glslang.git
-# Or if using HTTPS
 git clone https://github.com/KhronosGroup/glslang.git
 git clone https://github.com/KhronosGroup/glslang.git
 ```
 ```
 
 
@@ -89,28 +91,27 @@ spirv-tools with this:
 ./update_glslang_sources.py
 ./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
 #### 3) Configure
 
 
-Assume the source directory is `$SOURCE_DIR` and
-the build directory is `$BUILD_DIR`:
-
-For building on Linux (assuming using the Ninja generator):
+Assume the source directory is `$SOURCE_DIR` and the build directory is
+`$BUILD_DIR`. First ensure the build directory exists, then navigate to it:
 
 
 ```bash
 ```bash
+mkdir -p $BUILD_DIR
 cd $BUILD_DIR
 cd $BUILD_DIR
+```
+
+For building on Linux:
 
 
-cmake -GNinja -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} \
-      -DCMAKE_INSTALL_PREFIX=`pwd`/install $SOURCE_DIR
+```bash
+cmake -DCMAKE_BUILD_TYPE={Debug|Release|RelWithDebInfo} \
+      -DCMAKE_INSTALL_PREFIX="$(pwd)/install" $SOURCE_DIR
 ```
 ```
 
 
 For building on Windows:
 For building on Windows:
 
 
 ```bash
 ```bash
-cmake $SOURCE_DIR -DCMAKE_INSTALL_PREFIX=`pwd`/install
+cmake $SOURCE_DIR -DCMAKE_INSTALL_PREFIX="$(pwd)/install"
 # The CMAKE_INSTALL_PREFIX part is for testing (explained later).
 # The CMAKE_INSTALL_PREFIX part is for testing (explained later).
 ```
 ```
 
 
@@ -120,7 +121,7 @@ The CMake GUI also works for Windows (version 3.4.1 tested).
 
 
 ```bash
 ```bash
 # for Linux:
 # for Linux:
-ninja install
+make -j4 install
 
 
 # for Windows:
 # for Windows:
 cmake --build . --config {Release|Debug|MinSizeRel|RelWithDebInfo} \
 cmake --build . --config {Release|Debug|MinSizeRel|RelWithDebInfo} \

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

@@ -2966,8 +2966,14 @@ bool TGlslangToSpvTraverser::isShaderEntryPoint(const glslang::TIntermAggregate*
 }
 }
 
 
 // Does parameter need a place to keep writes, separate from the original?
 // Does parameter need a place to keep writes, separate from the original?
+// Assumes called after originalParam(), which filters out block/buffer/opaque-based
+// qualifiers such that we should have only in/out/inout/constreadonly here.
 bool TGlslangToSpvTraverser::writableParam(glslang::TStorageQualifier qualifier)
 bool TGlslangToSpvTraverser::writableParam(glslang::TStorageQualifier qualifier)
 {
 {
+    assert(qualifier == glslang::EvqIn ||
+           qualifier == glslang::EvqOut ||
+           qualifier == glslang::EvqInOut ||
+           qualifier == glslang::EvqConstReadOnly);
     return qualifier != glslang::EvqConstReadOnly;
     return qualifier != glslang::EvqConstReadOnly;
 }
 }
 
 
@@ -2978,7 +2984,7 @@ bool TGlslangToSpvTraverser::originalParam(glslang::TStorageQualifier qualifier,
     if (implicitThisParam)                                                                     // implicit this
     if (implicitThisParam)                                                                     // implicit this
         return true;
         return true;
     if (glslangIntermediate->getSource() == glslang::EShSourceHlsl)
     if (glslangIntermediate->getSource() == glslang::EShSourceHlsl)
-        return false;
+        return paramType.getBasicType() == glslang::EbtBlock;
     return paramType.containsOpaque() ||                                                       // sampler, etc.
     return paramType.containsOpaque() ||                                                       // sampler, etc.
            (paramType.getBasicType() == glslang::EbtBlock && qualifier == glslang::EvqBuffer); // SSBO
            (paramType.getBasicType() == glslang::EbtBlock && qualifier == glslang::EvqBuffer); // SSBO
 }
 }
@@ -3609,8 +3615,8 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
         glslangArgs[a]->traverse(this);
         glslangArgs[a]->traverse(this);
         argTypes.push_back(&paramType);
         argTypes.push_back(&paramType);
         // keep outputs and pass-by-originals as l-values, evaluate others as r-values
         // keep outputs and pass-by-originals as l-values, evaluate others as r-values
-        if (writableParam(qualifiers[a]) ||
-            originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0)) {
+        if (originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0) ||
+            writableParam(qualifiers[a])) {
             // save l-value
             // save l-value
             lValues.push_back(builder.getAccessChain());
             lValues.push_back(builder.getAccessChain());
         } else {
         } else {

+ 37 - 32
3rdparty/glslang/Test/baseLegalResults/hlsl.aliasOpaque.frag.out

@@ -2,49 +2,54 @@ hlsl.aliasOpaque.frag
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 81
+// Id's are bound by 87
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 57
+                              EntryPoint Fragment 4  "main" 62
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
-                              Name 37  "gss2"
-                              Name 39  "gss"
-                              Name 43  "gtex"
-                              Name 57  "@entryPointOutput"
-                              Decorate 37(gss2) DescriptorSet 0
-                              Decorate 39(gss) DescriptorSet 0
-                              Decorate 43(gtex) DescriptorSet 0
-                              Decorate 57(@entryPointOutput) Location 0
+                              Name 9  "OS"
+                              MemberName 9(OS) 0  "ss"
+                              MemberName 9(OS) 1  "a"
+                              MemberName 9(OS) 2  "tex"
+                              Name 44  "gss2"
+                              Name 47  "gss"
+                              Name 51  "gtex"
+                              Name 62  "@entryPointOutput"
+                              Decorate 44(gss2) DescriptorSet 0
+                              Decorate 47(gss) DescriptorSet 0
+                              Decorate 51(gtex) DescriptorSet 0
+                              Decorate 62(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeSampler
                6:             TypeSampler
-               8:             TypeFloat 32
-              10:             TypeImage 8(float) 2D sampled format:Unknown
-              12:             TypeVector 8(float) 4
-              25:             TypeSampledImage 10
-              27:             TypeVector 8(float) 2
-              28:    8(float) Constant 1045220557
-              29:    8(float) Constant 1050253722
-              30:   27(fvec2) ConstantComposite 28 29
-              36:             TypePointer UniformConstant 6
-        37(gss2):     36(ptr) Variable UniformConstant
-         39(gss):     36(ptr) Variable UniformConstant
-              42:             TypePointer UniformConstant 10
-        43(gtex):     42(ptr) Variable UniformConstant
-              46:    8(float) Constant 1077936128
-              56:             TypePointer Output 12(fvec4)
-57(@entryPointOutput):     56(ptr) Variable Output
+               7:             TypeFloat 32
+               8:             TypeImage 7(float) 2D sampled format:Unknown
+           9(OS):             TypeStruct 6 7(float) 8
+              11:             TypeVector 7(float) 4
+              32:             TypeSampledImage 8
+              34:             TypeVector 7(float) 2
+              35:    7(float) Constant 1045220557
+              36:    7(float) Constant 1050253722
+              37:   34(fvec2) ConstantComposite 35 36
+              43:             TypePointer UniformConstant 6
+        44(gss2):     43(ptr) Variable UniformConstant
+         47(gss):     43(ptr) Variable UniformConstant
+              50:             TypePointer UniformConstant 8
+        51(gtex):     50(ptr) Variable UniformConstant
+              54:    7(float) Constant 1077936128
+              61:             TypePointer Output 11(fvec4)
+62(@entryPointOutput):     61(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-              68:           6 Load 39(gss)
-              69:          10 Load 43(gtex)
-              78:          25 SampledImage 69 68
-              79:   12(fvec4) ImageSampleImplicitLod 78 30
-              80:   12(fvec4) VectorTimesScalar 79 46
-                              Store 57(@entryPointOutput) 80
+              70:           6 Load 47(gss)
+              72:           8 Load 51(gtex)
+              84:          32 SampledImage 72 70
+              85:   11(fvec4) ImageSampleImplicitLod 84 37
+              86:   11(fvec4) VectorTimesScalar 85 54
+                              Store 62(@entryPointOutput) 86
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd

+ 53 - 45
3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaque.frag.out

@@ -1,65 +1,73 @@
 hlsl.flattenOpaque.frag
 hlsl.flattenOpaque.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 144
+// Id's are bound by 185
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 97
+                              EntryPoint Fragment 4  "main" 120
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
+                              Name 7  "os"
+                              MemberName 7(os) 0  "s2D"
+                              Name 23  "os2"
+                              MemberName 23(os2) 0  "s2D"
+                              MemberName 23(os2) 1  "tex"
                               Name 38  "tex"
                               Name 38  "tex"
-                              Name 70  "s.s2D"
-                              Name 79  "s2.s2D"
-                              Name 80  "s2.tex"
-                              Name 97  "@entryPointOutput"
+                              Name 82  "s.s2D"
+                              Name 97  "s2.s2D"
+                              Name 100  "s2.tex"
+                              Name 120  "@entryPointOutput"
                               Decorate 38(tex) DescriptorSet 0
                               Decorate 38(tex) DescriptorSet 0
-                              Decorate 70(s.s2D) DescriptorSet 0
-                              Decorate 79(s2.s2D) DescriptorSet 0
-                              Decorate 80(s2.tex) DescriptorSet 0
-                              Decorate 97(@entryPointOutput) Location 0
+                              Decorate 82(s.s2D) DescriptorSet 0
+                              Decorate 97(s2.s2D) DescriptorSet 0
+                              Decorate 100(s2.tex) DescriptorSet 0
+                              Decorate 120(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeSampler
                6:             TypeSampler
-               8:             TypeFloat 32
-               9:             TypeVector 8(float) 4
-              14:             TypeVector 8(float) 2
-              21:             TypeImage 8(float) 2D sampled format:Unknown
-              37:             TypePointer UniformConstant 21
+           7(os):             TypeStruct 6
+               9:             TypeFloat 32
+              10:             TypeVector 9(float) 4
+              15:             TypeVector 9(float) 2
+              22:             TypeImage 9(float) 2D sampled format:Unknown
+         23(os2):             TypeStruct 6 22
+              37:             TypePointer UniformConstant 22
          38(tex):     37(ptr) Variable UniformConstant
          38(tex):     37(ptr) Variable UniformConstant
-              41:             TypeSampledImage 21
-              43:    8(float) Constant 1045220557
-              44:    8(float) Constant 1050253722
-              45:   14(fvec2) ConstantComposite 43 44
-              69:             TypePointer UniformConstant 6
-       70(s.s2D):     69(ptr) Variable UniformConstant
-      79(s2.s2D):     69(ptr) Variable UniformConstant
-      80(s2.tex):     37(ptr) Variable UniformConstant
-              96:             TypePointer Output 9(fvec4)
-97(@entryPointOutput):     96(ptr) Variable Output
+              45:             TypeSampledImage 22
+              47:    9(float) Constant 1045220557
+              48:    9(float) Constant 1050253722
+              49:   15(fvec2) ConstantComposite 47 48
+              81:             TypePointer UniformConstant 6
+       82(s.s2D):     81(ptr) Variable UniformConstant
+      97(s2.s2D):     81(ptr) Variable UniformConstant
+     100(s2.tex):     37(ptr) Variable UniformConstant
+             119:             TypePointer Output 10(fvec4)
+120(@entryPointOutput):    119(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-             109:           6 Load 70(s.s2D)
-             123:          21 Load 38(tex)
-             125:          41 SampledImage 123 109
-             126:    9(fvec4) ImageSampleImplicitLod 125 45
-             111:           6 Load 70(s.s2D)
-             128:          21 Load 38(tex)
-             130:          41 SampledImage 128 111
-             132:    9(fvec4) ImageSampleImplicitLod 130 45
-             113:    9(fvec4) FAdd 126 132
-             114:           6 Load 79(s2.s2D)
-             115:          21 Load 80(s2.tex)
-             136:          41 SampledImage 115 114
-             137:    9(fvec4) ImageSampleImplicitLod 136 45
-             117:    9(fvec4) FAdd 113 137
-             118:           6 Load 79(s2.s2D)
-             119:          21 Load 80(s2.tex)
-             141:          41 SampledImage 119 118
-             143:    9(fvec4) ImageSampleImplicitLod 141 45
-             121:    9(fvec4) FAdd 117 143
-                              Store 97(@entryPointOutput) 121
+             134:           6 Load 82(s.s2D)
+             158:          22 Load 38(tex)
+             161:          45 SampledImage 158 134
+             162:   10(fvec4) ImageSampleImplicitLod 161 49
+             138:           6 Load 82(s.s2D)
+             164:          22 Load 38(tex)
+             167:          45 SampledImage 164 138
+             169:   10(fvec4) ImageSampleImplicitLod 167 49
+             142:   10(fvec4) FAdd 162 169
+             143:           6 Load 97(s2.s2D)
+             145:          22 Load 100(s2.tex)
+             175:          45 SampledImage 145 143
+             176:   10(fvec4) ImageSampleImplicitLod 175 49
+             149:   10(fvec4) FAdd 142 176
+             150:           6 Load 97(s2.s2D)
+             152:          22 Load 100(s2.tex)
+             182:          45 SampledImage 152 150
+             184:   10(fvec4) ImageSampleImplicitLod 182 49
+             156:   10(fvec4) FAdd 149 184
+                              Store 120(@entryPointOutput) 156
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd

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

@@ -2,57 +2,56 @@ hlsl.flattenOpaqueInit.vert
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 176
+// Id's are bound by 134
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 99
+                              EntryPoint Vertex 4  "main" 80
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
-                              Name 17  "FxaaTex"
-                              MemberName 17(FxaaTex) 0  "smpl"
-                              MemberName 17(FxaaTex) 1  "tex"
-                              Name 38  "g_tInputTexture_sampler"
-                              Name 42  "g_tInputTexture"
-                              Name 99  "@entryPointOutput"
-                              Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
-                              Decorate 42(g_tInputTexture) DescriptorSet 0
-                              Decorate 99(@entryPointOutput) Location 0
+                              Name 9  "FxaaTex"
+                              MemberName 9(FxaaTex) 0  "smpl"
+                              MemberName 9(FxaaTex) 1  "tex"
+                              Name 43  "g_tInputTexture_sampler"
+                              Name 47  "g_tInputTexture"
+                              Name 80  "@entryPointOutput"
+                              Decorate 43(g_tInputTexture_sampler) DescriptorSet 0
+                              Decorate 47(g_tInputTexture) DescriptorSet 0
+                              Decorate 80(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeSampler
                6:             TypeSampler
-               8:             TypeFloat 32
-               9:             TypeImage 8(float) 2D sampled format:Unknown
-              11:             TypeVector 8(float) 4
-     17(FxaaTex):             TypeStruct 6 9
-              26:             TypeSampledImage 9
-              28:             TypeVector 8(float) 2
-              29:    8(float) Constant 1050253722
-              30:    8(float) Constant 1053609165
-              31:   28(fvec2) ConstantComposite 29 30
-              32:    8(float) Constant 0
-              37:             TypePointer UniformConstant 6
-38(g_tInputTexture_sampler):     37(ptr) Variable UniformConstant
-              41:             TypePointer UniformConstant 9
-42(g_tInputTexture):     41(ptr) Variable UniformConstant
-              98:             TypePointer Output 11(fvec4)
-99(@entryPointOutput):     98(ptr) Variable Output
-             175: 17(FxaaTex) Undef
+               7:             TypeFloat 32
+               8:             TypeImage 7(float) 2D sampled format:Unknown
+      9(FxaaTex):             TypeStruct 6 8
+              11:             TypeVector 7(float) 4
+              31:             TypeSampledImage 8
+              33:             TypeVector 7(float) 2
+              34:    7(float) Constant 1050253722
+              35:    7(float) Constant 1053609165
+              36:   33(fvec2) ConstantComposite 34 35
+              37:    7(float) Constant 0
+              42:             TypePointer UniformConstant 6
+43(g_tInputTexture_sampler):     42(ptr) Variable UniformConstant
+              46:             TypePointer UniformConstant 8
+47(g_tInputTexture):     46(ptr) Variable UniformConstant
+              79:             TypePointer Output 11(fvec4)
+80(@entryPointOutput):     79(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-             117:           6 Load 38(g_tInputTexture_sampler)
-             118:           9 Load 42(g_tInputTexture)
-             148:          26 SampledImage 118 117
-             149:   11(fvec4) ImageSampleExplicitLod 148 31 Lod 32
-             172:           6 CompositeExtract 175 0
-             174:           9 CompositeExtract 175 1
-             160:          26 SampledImage 174 172
-             161:   11(fvec4) ImageSampleExplicitLod 160 31 Lod 32
-             136:   11(fvec4) FAdd 149 161
-             165:          26 SampledImage 118 117
-             166:   11(fvec4) ImageSampleExplicitLod 165 31 Lod 32
-             143:   11(fvec4) FAdd 136 166
-                              Store 99(@entryPointOutput) 143
+              90:           6 Load 43(g_tInputTexture_sampler)
+              91:           8 Load 47(g_tInputTexture)
+             111:          31 SampledImage 91 90
+             112:   11(fvec4) ImageSampleExplicitLod 111 36 Lod 37
+             115:           6 Load 43(g_tInputTexture_sampler)
+             117:           8 Load 47(g_tInputTexture)
+             125:          31 SampledImage 117 115
+             126:   11(fvec4) ImageSampleExplicitLod 125 36 Lod 37
+              99:   11(fvec4) FAdd 112 126
+             132:          31 SampledImage 91 90
+             133:   11(fvec4) ImageSampleExplicitLod 132 36 Lod 37
+             104:   11(fvec4) FAdd 99 133
+                              Store 80(@entryPointOutput) 104
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd

+ 32 - 32
3rdparty/glslang/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out

@@ -2,48 +2,48 @@ hlsl.flattenOpaqueInitMix.vert
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 100
+// Id's are bound by 80
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 68
+                              EntryPoint Vertex 4  "main" 57
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
-                              Name 34  "FxaaTex"
-                              MemberName 34(FxaaTex) 0  "smpl"
-                              MemberName 34(FxaaTex) 1  "tex"
-                              MemberName 34(FxaaTex) 2  "f"
-                              Name 38  "g_tInputTexture_sampler"
-                              Name 41  "g_tInputTexture"
-                              Name 68  "@entryPointOutput"
-                              Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
-                              Decorate 41(g_tInputTexture) DescriptorSet 0
-                              Decorate 68(@entryPointOutput) Location 0
+                              Name 9  "FxaaTex"
+                              MemberName 9(FxaaTex) 0  "smpl"
+                              MemberName 9(FxaaTex) 1  "tex"
+                              MemberName 9(FxaaTex) 2  "f"
+                              Name 44  "g_tInputTexture_sampler"
+                              Name 47  "g_tInputTexture"
+                              Name 57  "@entryPointOutput"
+                              Decorate 44(g_tInputTexture_sampler) DescriptorSet 0
+                              Decorate 47(g_tInputTexture) DescriptorSet 0
+                              Decorate 57(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeSampler
                6:             TypeSampler
-               8:             TypeFloat 32
-               9:             TypeImage 8(float) 2D sampled format:Unknown
-              12:             TypeVector 8(float) 4
-              24:             TypeSampledImage 9
-              28:             TypeVector 8(float) 2
-              30:    8(float) Constant 0
-     34(FxaaTex):             TypeStruct 6 9 8(float)
-              37:             TypePointer UniformConstant 6
-38(g_tInputTexture_sampler):     37(ptr) Variable UniformConstant
-              40:             TypePointer UniformConstant 9
-41(g_tInputTexture):     40(ptr) Variable UniformConstant
-              43:    8(float) Constant 1056964608
-              67:             TypePointer Output 12(fvec4)
-68(@entryPointOutput):     67(ptr) Variable Output
+               7:             TypeFloat 32
+               8:             TypeImage 7(float) 2D sampled format:Unknown
+      9(FxaaTex):             TypeStruct 6 8 7(float)
+              11:             TypeVector 7(float) 4
+              28:             TypeSampledImage 8
+              36:             TypeVector 7(float) 2
+              38:    7(float) Constant 0
+              43:             TypePointer UniformConstant 6
+44(g_tInputTexture_sampler):     43(ptr) Variable UniformConstant
+              46:             TypePointer UniformConstant 8
+47(g_tInputTexture):     46(ptr) Variable UniformConstant
+              49:    7(float) Constant 1056964608
+              56:             TypePointer Output 11(fvec4)
+57(@entryPointOutput):     56(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-              79:           6 Load 38(g_tInputTexture_sampler)
-              80:           9 Load 41(g_tInputTexture)
-              95:          24 SampledImage 80 79
-              98:   28(fvec2) CompositeConstruct 43 43
-              99:   12(fvec4) ImageSampleExplicitLod 95 98 Lod 30
-                              Store 68(@entryPointOutput) 99
+              63:           6 Load 44(g_tInputTexture_sampler)
+              64:           8 Load 47(g_tInputTexture)
+              73:          28 SampledImage 64 63
+              78:   36(fvec2) CompositeConstruct 49 49
+              79:   11(fvec4) ImageSampleExplicitLod 73 78 Lod 38
+                              Store 57(@entryPointOutput) 79
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd

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

@@ -2,47 +2,67 @@ hlsl.flattenSubset.frag
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 85
+// Id's are bound by 66
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 54 57
+                              EntryPoint Fragment 4  "main" 47 50
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               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
+                              Name 15  "S0"
+                              MemberName 15(S0) 0  "x"
+                              MemberName 15(S0) 1  "y"
+                              MemberName 15(S0) 2  "ss"
+                              Name 16  "S1"
+                              MemberName 16(S1) 0  "b"
+                              MemberName 16(S1) 1  "samplerState"
+                              MemberName 16(S1) 2  "s0"
+                              MemberName 16(S1) 3  "a"
+                              Name 21  "samp"
+                              Name 25  "S2"
+                              MemberName 25(S2) 0  "a1"
+                              MemberName 25(S2) 1  "a2"
+                              MemberName 25(S2) 2  "a3"
+                              MemberName 25(S2) 3  "a4"
+                              MemberName 25(S2) 4  "a5"
+                              MemberName 25(S2) 5  "resources"
+                              Name 33  "tex"
+                              Name 47  "vpos"
+                              Name 50  "@entryPointOutput"
+                              Decorate 21(samp) DescriptorSet 0
+                              Decorate 33(tex) DescriptorSet 0
+                              Decorate 47(vpos) Location 0
+                              Decorate 50(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
                7:             TypeVector 6(float) 4
                7:             TypeVector 6(float) 4
               13:             TypeSampler
               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
+              14:             TypeInt 32 1
+          15(S0):             TypeStruct 14(int) 14(int) 13
+          16(S1):             TypeStruct 6(float) 13 15(S0) 14(int)
+              20:             TypePointer UniformConstant 13
+        21(samp):     20(ptr) Variable UniformConstant
+          25(S2):             TypeStruct 14(int) 14(int) 14(int) 14(int) 14(int) 16(S1)
+              31:             TypeImage 6(float) 2D sampled format:Unknown
+              32:             TypePointer UniformConstant 31
+         33(tex):     32(ptr) Variable UniformConstant
+              37:             TypeSampledImage 31
+              39:             TypeVector 6(float) 2
+              40:    6(float) Constant 1056964608
+              41:   39(fvec2) ConstantComposite 40 40
+              46:             TypePointer Input 7(fvec4)
+        47(vpos):     46(ptr) Variable Input
+              49:             TypePointer Output 7(fvec4)
+50(@entryPointOutput):     49(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                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
+              57:          13 Load 21(samp)
+              61:          31 Load 33(tex)
+              64:          37 SampledImage 61 57
+              65:    7(fvec4) ImageSampleImplicitLod 64 41
+                              Store 50(@entryPointOutput) 65
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd

+ 30 - 18
3rdparty/glslang/Test/baseLegalResults/hlsl.flattenSubset2.frag.out

@@ -2,36 +2,48 @@ hlsl.flattenSubset2.frag
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 44
+// Id's are bound by 53
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 40 43
+                              EntryPoint Fragment 4  "main" 49 52
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
-                              Name 31  "someTex"
-                              Name 40  "vpos"
-                              Name 43  "@entryPointOutput"
-                              Decorate 31(someTex) DescriptorSet 0
-                              Decorate 40(vpos) Location 0
-                              Decorate 43(@entryPointOutput) Location 0
+                              Name 14  "Nested"
+                              MemberName 14(Nested) 0  "y"
+                              MemberName 14(Nested) 1  "texNested"
+                              Name 15  "A"
+                              MemberName 15(A) 0  "n"
+                              MemberName 15(A) 1  "x"
+                              Name 25  "B"
+                              MemberName 25(B) 0  "n"
+                              MemberName 25(B) 1  "tex"
+                              Name 36  "someTex"
+                              Name 49  "vpos"
+                              Name 52  "@entryPointOutput"
+                              Decorate 36(someTex) DescriptorSet 0
+                              Decorate 49(vpos) Location 0
+                              Decorate 52(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
                7:             TypeVector 6(float) 4
                7:             TypeVector 6(float) 4
-              17:             TypeImage 6(float) 2D sampled format:Unknown
-              30:             TypePointer UniformConstant 17
-     31(someTex):     30(ptr) Variable UniformConstant
-              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
+              13:             TypeImage 6(float) 2D sampled format:Unknown
+      14(Nested):             TypeStruct 6(float) 13
+           15(A):             TypeStruct 14(Nested) 6(float)
+           25(B):             TypeStruct 14(Nested) 13
+              35:             TypePointer UniformConstant 13
+     36(someTex):     35(ptr) Variable UniformConstant
+              43:    6(float) Constant 0
+              44:    7(fvec4) ConstantComposite 43 43 43 43
+              48:             TypePointer Input 7(fvec4)
+        49(vpos):     48(ptr) Variable Input
+              51:             TypePointer Output 7(fvec4)
+52(@entryPointOutput):     51(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-                              Store 43(@entryPointOutput) 35
+                              Store 52(@entryPointOutput) 44
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd

+ 90 - 72
3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenLocal.vert.out

@@ -2,90 +2,108 @@ hlsl.partialFlattenLocal.vert
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 148
+// Id's are bound by 132
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 90 93
+                              EntryPoint Vertex 4  "main" 83 86
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
-                              Name 17  "tex"
-                              Name 90  "pos"
-                              Name 93  "@entryPointOutput"
-                              Decorate 17(tex) DescriptorSet 0
-                              Decorate 90(pos) Location 0
-                              Decorate 93(@entryPointOutput) BuiltIn Position
+                              Name 22  "Packed"
+                              MemberName 22(Packed) 0  "tex"
+                              MemberName 22(Packed) 1  "pos"
+                              MemberName 22(Packed) 2  "uv"
+                              MemberName 22(Packed) 3  "x"
+                              MemberName 22(Packed) 4  "n"
+                              Name 27  "tex"
+                              Name 83  "pos"
+                              Name 86  "@entryPointOutput"
+                              Decorate 27(tex) DescriptorSet 0
+                              Decorate 83(pos) Location 0
+                              Decorate 86(@entryPointOutput) BuiltIn Position
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
                7:             TypeVector 6(float) 4
                7:             TypeVector 6(float) 4
               13:             TypeImage 6(float) 2D sampled format:Unknown
               13:             TypeImage 6(float) 2D sampled format:Unknown
-              16:             TypePointer UniformConstant 13
-         17(tex):     16(ptr) Variable UniformConstant
-              19:             TypeVector 6(float) 3
-              20:             TypeInt 32 0
-              21:     20(int) Constant 3
-              22:             TypeArray 19(fvec3) 21
-              23:             TypePointer Function 22
-              25:             TypeInt 32 1
-              26:     25(int) Constant 0
-              27:    6(float) Constant 0
-              28:   19(fvec3) ConstantComposite 27 27 27
-              29:             TypePointer Function 19(fvec3)
-              31:             TypeVector 6(float) 2
-              32:     20(int) Constant 2
-              33:             TypeArray 31(fvec2) 32
-              34:             TypePointer Function 33
-              36:    6(float) Constant 1065353216
-              37:   31(fvec2) ConstantComposite 27 36
-              38:             TypePointer Function 31(fvec2)
-              52:     25(int) Constant 1
-              53:             TypeBool
-              89:             TypePointer Input 7(fvec4)
-         90(pos):     89(ptr) Variable Input
-              92:             TypePointer Output 7(fvec4)
-93(@entryPointOutput):     92(ptr) Variable Output
+              14:             TypeVector 6(float) 3
+              15:             TypeInt 32 0
+              16:     15(int) Constant 3
+              17:             TypeArray 14(fvec3) 16
+              18:             TypeVector 6(float) 2
+              19:     15(int) Constant 2
+              20:             TypeArray 18(fvec2) 19
+              21:             TypeInt 32 1
+      22(Packed):             TypeStruct 13 17 20 6(float) 21(int)
+              23:             TypePointer Function 22(Packed)
+              25:     21(int) Constant 0
+              26:             TypePointer UniformConstant 13
+         27(tex):     26(ptr) Variable UniformConstant
+              29:             TypePointer Function 13
+              31:     21(int) Constant 1
+              32:    6(float) Constant 0
+              33:   14(fvec3) ConstantComposite 32 32 32
+              34:             TypePointer Function 14(fvec3)
+              36:     21(int) Constant 2
+              37:    6(float) Constant 1065353216
+              38:   18(fvec2) ConstantComposite 32 37
+              39:             TypePointer Function 18(fvec2)
+              41:     21(int) Constant 3
+              42:             TypePointer Function 6(float)
+              44:     21(int) Constant 4
+              45:             TypePointer Function 21(int)
+              54:             TypeBool
+              82:             TypePointer Input 7(fvec4)
+         83(pos):     82(ptr) Variable Input
+              85:             TypePointer Output 7(fvec4)
+86(@entryPointOutput):     85(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-              98:     23(ptr) Variable Function
-              99:     34(ptr) Variable Function
-              91:    7(fvec4) Load 90(pos)
-             110:     29(ptr) AccessChain 98 26
-                              Store 110 28
-             111:     38(ptr) AccessChain 99 26
-                              Store 111 37
-                              Branch 112
-             112:             Label
-             147:     25(int) Phi 26 5 131 114
-                              LoopMerge 113 114 None
-                              Branch 115
-             115:             Label
-             117:    53(bool) SLessThan 147 52
-                              BranchConditional 117 118 113
-             118:               Label
-             121:     38(ptr)   AccessChain 99 147
-             122:   31(fvec2)   Load 121
-             123:     29(ptr)   AccessChain 98 147
-             124:   19(fvec3)   Load 123
-             125:   31(fvec2)   VectorShuffle 124 124 0 1
-             126:   31(fvec2)   FAdd 125 122
-             127:     29(ptr)   AccessChain 98 147
-             128:   19(fvec3)   Load 127
-             129:   19(fvec3)   VectorShuffle 128 126 3 4 2
-                                Store 127 129
-                                Branch 114
-             114:               Label
-             131:     25(int)   IAdd 147 52
-                                Branch 112
-             113:             Label
-             133:          22 Load 98
-             146:   19(fvec3) CompositeExtract 133 0
-             140:    6(float) CompositeExtract 146 0
-             141:    6(float) CompositeExtract 146 1
-             142:    6(float) CompositeExtract 146 2
-             143:    7(fvec4) CompositeConstruct 140 141 142 27
-             144:    7(fvec4) FAdd 91 143
-                              Store 93(@entryPointOutput) 144
+              90:     23(ptr) Variable Function
+              84:    7(fvec4) Load 83(pos)
+              94:          13 Load 27(tex)
+              95:     29(ptr) AccessChain 90 25
+                              Store 95 94
+              96:     34(ptr) AccessChain 90 31 25
+                              Store 96 33
+              97:     39(ptr) AccessChain 90 36 25
+                              Store 97 38
+              98:     42(ptr) AccessChain 90 41
+                              Store 98 37
+              99:     45(ptr) AccessChain 90 44
+                              Store 99 41
+                              Branch 100
+             100:             Label
+             131:     21(int) Phi 25 5 119 102
+                              LoopMerge 101 102 None
+                              Branch 103
+             103:             Label
+             105:    54(bool) SLessThan 131 31
+                              BranchConditional 105 106 101
+             106:               Label
+             109:     39(ptr)   AccessChain 90 36 131
+             110:   18(fvec2)   Load 109
+             111:     34(ptr)   AccessChain 90 31 131
+             112:   14(fvec3)   Load 111
+             113:   18(fvec2)   VectorShuffle 112 112 0 1
+             114:   18(fvec2)   FAdd 113 110
+             115:     34(ptr)   AccessChain 90 31 131
+             116:   14(fvec3)   Load 115
+             117:   14(fvec3)   VectorShuffle 116 114 3 4 2
+                                Store 115 117
+                                Branch 102
+             102:               Label
+             119:     21(int)   IAdd 131 31
+                                Branch 100
+             101:             Label
+             120:  22(Packed) Load 90
+             130:   14(fvec3) CompositeExtract 120 1 0
+             124:    6(float) CompositeExtract 130 0
+             125:    6(float) CompositeExtract 130 1
+             126:    6(float) CompositeExtract 130 2
+             127:    7(fvec4) CompositeConstruct 124 125 126 32
+             128:    7(fvec4) FAdd 84 127
+                              Store 86(@entryPointOutput) 128
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd

+ 26 - 20
3rdparty/glslang/Test/baseLegalResults/hlsl.partialFlattenMixed.vert.out

@@ -2,37 +2,43 @@ hlsl.partialFlattenMixed.vert
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 WARNING: AST will form illegal SPIR-V; need to transform to legalize
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 31
+// Id's are bound by 36
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 27 30
+                              EntryPoint Vertex 4  "main" 32 35
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
-                              Name 20  "tex"
-                              Name 27  "pos"
-                              Name 30  "@entryPointOutput"
-                              Decorate 20(tex) DescriptorSet 0
-                              Decorate 27(pos) Location 0
-                              Decorate 30(@entryPointOutput) BuiltIn Position
+                              Name 18  "Packed"
+                              MemberName 18(Packed) 0  "a"
+                              MemberName 18(Packed) 1  "membTex"
+                              MemberName 18(Packed) 2  "b"
+                              Name 23  "tex"
+                              Name 32  "pos"
+                              Name 35  "@entryPointOutput"
+                              Decorate 23(tex) DescriptorSet 0
+                              Decorate 32(pos) Location 0
+                              Decorate 35(@entryPointOutput) BuiltIn Position
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
                7:             TypeVector 6(float) 4
                7:             TypeVector 6(float) 4
-              13:             TypeImage 6(float) 2D sampled format:Unknown
-              14:             TypeInt 32 0
-              15:     14(int) Constant 2
-              16:             TypeArray 13 15
-              19:             TypePointer UniformConstant 16
-         20(tex):     19(ptr) Variable UniformConstant
-              26:             TypePointer Input 7(fvec4)
-         27(pos):     26(ptr) Variable Input
-              29:             TypePointer Output 7(fvec4)
-30(@entryPointOutput):     29(ptr) Variable Output
+              13:             TypeInt 32 1
+              14:             TypeImage 6(float) 2D sampled format:Unknown
+              15:             TypeInt 32 0
+              16:     15(int) Constant 2
+              17:             TypeArray 14 16
+      18(Packed):             TypeStruct 13(int) 17 13(int)
+              22:             TypePointer UniformConstant 17
+         23(tex):     22(ptr) Variable UniformConstant
+              31:             TypePointer Input 7(fvec4)
+         32(pos):     31(ptr) Variable Input
+              34:             TypePointer Output 7(fvec4)
+35(@entryPointOutput):     34(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-              28:    7(fvec4) Load 27(pos)
-                              Store 30(@entryPointOutput) 28
+              33:    7(fvec4) Load 32(pos)
+                              Store 35(@entryPointOutput) 33
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd

+ 143 - 0
3rdparty/glslang/Test/baseResults/hlsl.PointSize.geom.out

@@ -0,0 +1,143 @@
+hlsl.PointSize.geom
+Shader version: 500
+invocations = -1
+max_vertices = 4
+input primitive = triangles
+output primitive = line_strip
+0:? Sequence
+0:8  Function Definition: @main(u1[3];struct-S-f11; ( temp void)
+0:8    Function Parameters: 
+0:8      'ps' ( in 3-element array of uint)
+0:8      'OutputStream' ( out structure{ temp float ps})
+0:?     Sequence
+0:10      Sequence
+0:10        Sequence
+0:10          move second child to first child ( temp float)
+0:?             'OutputStream.ps' ( out float PointSize)
+0:10            ps: direct index for structure ( temp float)
+0:10              's' ( temp structure{ temp float ps})
+0:10              Constant:
+0:10                0 (const int)
+0:10        EmitVertex ( temp void)
+0:8  Function Definition: main( ( temp void)
+0:8    Function Parameters: 
+0:?     Sequence
+0:8      move second child to first child ( temp 3-element array of uint)
+0:?         'ps' ( temp 3-element array of uint)
+0:?         'ps' ( in 3-element array of uint PointSize)
+0:8      Function Call: @main(u1[3];struct-S-f11; ( temp void)
+0:?         'ps' ( temp 3-element array of uint)
+0:?         'OutputStream' ( temp structure{ temp float ps})
+0:?   Linker Objects
+0:?     'ps' ( in 3-element array of uint PointSize)
+0:?     'OutputStream.ps' ( out float PointSize)
+
+
+Linked geometry stage:
+
+
+Shader version: 500
+invocations = 1
+max_vertices = 4
+input primitive = triangles
+output primitive = line_strip
+0:? Sequence
+0:8  Function Definition: @main(u1[3];struct-S-f11; ( temp void)
+0:8    Function Parameters: 
+0:8      'ps' ( in 3-element array of uint)
+0:8      'OutputStream' ( out structure{ temp float ps})
+0:?     Sequence
+0:10      Sequence
+0:10        Sequence
+0:10          move second child to first child ( temp float)
+0:?             'OutputStream.ps' ( out float PointSize)
+0:10            ps: direct index for structure ( temp float)
+0:10              's' ( temp structure{ temp float ps})
+0:10              Constant:
+0:10                0 (const int)
+0:10        EmitVertex ( temp void)
+0:8  Function Definition: main( ( temp void)
+0:8    Function Parameters: 
+0:?     Sequence
+0:8      move second child to first child ( temp 3-element array of uint)
+0:?         'ps' ( temp 3-element array of uint)
+0:?         'ps' ( in 3-element array of uint PointSize)
+0:8      Function Call: @main(u1[3];struct-S-f11; ( temp void)
+0:?         'ps' ( temp 3-element array of uint)
+0:?         'OutputStream' ( temp structure{ temp float ps})
+0:?   Linker Objects
+0:?     'ps' ( in 3-element array of uint PointSize)
+0:?     'OutputStream.ps' ( out float PointSize)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 36
+
+                              Capability Geometry
+                              Capability GeometryPointSize
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Geometry 4  "main" 19 28
+                              ExecutionMode 4 Triangles
+                              ExecutionMode 4 Invocations 1
+                              ExecutionMode 4 OutputLineStrip
+                              ExecutionMode 4 OutputVertices 4
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 11  "S"
+                              MemberName 11(S) 0  "ps"
+                              Name 16  "@main(u1[3];struct-S-f11;"
+                              Name 14  "ps"
+                              Name 15  "OutputStream"
+                              Name 19  "OutputStream.ps"
+                              Name 20  "s"
+                              Name 26  "ps"
+                              Name 28  "ps"
+                              Name 30  "OutputStream"
+                              Name 31  "param"
+                              Name 33  "param"
+                              Decorate 19(OutputStream.ps) BuiltIn PointSize
+                              Decorate 28(ps) BuiltIn PointSize
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeInt 32 0
+               7:      6(int) Constant 3
+               8:             TypeArray 6(int) 7
+               9:             TypePointer Function 8
+              10:             TypeFloat 32
+           11(S):             TypeStruct 10(float)
+              12:             TypePointer Function 11(S)
+              13:             TypeFunction 2 9(ptr) 12(ptr)
+              18:             TypePointer Output 10(float)
+19(OutputStream.ps):     18(ptr) Variable Output
+              21:             TypeInt 32 1
+              22:     21(int) Constant 0
+              23:             TypePointer Function 10(float)
+              27:             TypePointer Input 8
+          28(ps):     27(ptr) Variable Input
+         4(main):           2 Function None 3
+               5:             Label
+          26(ps):      9(ptr) Variable Function
+30(OutputStream):     12(ptr) Variable Function
+       31(param):      9(ptr) Variable Function
+       33(param):     12(ptr) Variable Function
+              29:           8 Load 28(ps)
+                              Store 26(ps) 29
+              32:           8 Load 26(ps)
+                              Store 31(param) 32
+              34:           2 FunctionCall 16(@main(u1[3];struct-S-f11;) 31(param) 33(param)
+              35:       11(S) Load 33(param)
+                              Store 30(OutputStream) 35
+                              Return
+                              FunctionEnd
+16(@main(u1[3];struct-S-f11;):           2 Function None 13
+          14(ps):      9(ptr) FunctionParameter
+15(OutputStream):     12(ptr) FunctionParameter
+              17:             Label
+           20(s):     12(ptr) Variable Function
+              24:     23(ptr) AccessChain 20(s) 22
+              25:   10(float) Load 24
+                              Store 19(OutputStream.ps) 25
+                              EmitVertex
+                              Return
+                              FunctionEnd

+ 69 - 0
3rdparty/glslang/Test/baseResults/hlsl.PointSize.vert.out

@@ -0,0 +1,69 @@
+hlsl.PointSize.vert
+Shader version: 500
+0:? Sequence
+0:2  Function Definition: @main( ( temp float)
+0:2    Function Parameters: 
+0:?     Sequence
+0:3      Branch: Return with expression
+0:3        Constant:
+0:3          2.300000
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      move second child to first child ( temp float)
+0:?         '@entryPointOutput' ( out float PointSize)
+0:2        Function Call: @main( ( temp float)
+0:?   Linker Objects
+0:?     '@entryPointOutput' ( out float PointSize)
+
+
+Linked vertex stage:
+
+
+Shader version: 500
+0:? Sequence
+0:2  Function Definition: @main( ( temp float)
+0:2    Function Parameters: 
+0:?     Sequence
+0:3      Branch: Return with expression
+0:3        Constant:
+0:3          2.300000
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      move second child to first child ( temp float)
+0:?         '@entryPointOutput' ( out float PointSize)
+0:2        Function Call: @main( ( temp float)
+0:?   Linker Objects
+0:?     '@entryPointOutput' ( out float PointSize)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 16
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 14
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 8  "@main("
+                              Name 14  "@entryPointOutput"
+                              Decorate 14(@entryPointOutput) BuiltIn PointSize
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeFunction 6(float)
+              10:    6(float) Constant 1075000115
+              13:             TypePointer Output 6(float)
+14(@entryPointOutput):     13(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              15:    6(float) FunctionCall 8(@main()
+                              Store 14(@entryPointOutput) 15
+                              Return
+                              FunctionEnd
+       8(@main():    6(float) Function None 7
+               9:             Label
+                              ReturnValue 10
+                              FunctionEnd

+ 140 - 105
3rdparty/glslang/Test/baseResults/hlsl.aliasOpaque.frag.out

@@ -5,17 +5,24 @@ gl_FragCoord origin is upper left
 0:? Sequence
 0:? Sequence
 0:12  Function Definition: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float)
 0:12  Function Definition: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float)
 0:12    Function Parameters: 
 0:12    Function Parameters: 
-0:?       's.ss' ( in sampler)
-0:?       's.a' ( in float)
-0:?       's.tex' ( in texture2D)
+0:12      's' ( in structure{ temp sampler ss,  temp float a,  temp texture2D tex})
 0:?     Sequence
 0:?     Sequence
 0:13      Branch: Return with expression
 0:13      Branch: Return with expression
 0:13        vector-scale ( temp 4-component vector of float)
 0:13        vector-scale ( temp 4-component vector of float)
-0:?           's.a' ( in float)
+0:13          a: direct index for structure ( temp float)
+0:13            's' ( in structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:13            Constant:
+0:13              1 (const int)
 0:13          texture ( temp 4-component vector of float)
 0:13          texture ( temp 4-component vector of float)
 0:13            Construct combined texture-sampler ( temp sampler2D)
 0:13            Construct combined texture-sampler ( temp sampler2D)
-0:?               's.tex' ( in texture2D)
-0:?               's.ss' ( in sampler)
+0:13              tex: direct index for structure ( temp texture2D)
+0:13                's' ( in structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:13                Constant:
+0:13                  2 (const int)
+0:13              ss: direct index for structure ( temp sampler)
+0:13                's' ( in structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:13                Constant:
+0:13                  0 (const int)
 0:?             Constant:
 0:?             Constant:
 0:?               0.200000
 0:?               0.200000
 0:?               0.300000
 0:?               0.300000
@@ -23,23 +30,33 @@ gl_FragCoord origin is upper left
 0:17    Function Parameters: 
 0:17    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
 0:19      move second child to first child ( temp sampler)
 0:19      move second child to first child ( temp sampler)
-0:?         'os.ss' ( temp sampler)
+0:19        ss: direct index for structure ( temp sampler)
+0:19          'os' ( temp structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:19          Constant:
+0:19            0 (const int)
 0:19        'gss2' ( uniform sampler)
 0:19        'gss2' ( uniform sampler)
 0:20      move second child to first child ( temp sampler)
 0:20      move second child to first child ( temp sampler)
-0:?         'os.ss' ( temp sampler)
+0:20        ss: direct index for structure ( temp sampler)
+0:20          'os' ( temp structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:20          Constant:
+0:20            0 (const int)
 0:20        'gss' ( uniform sampler)
 0:20        'gss' ( uniform sampler)
 0:21      move second child to first child ( temp texture2D)
 0:21      move second child to first child ( temp texture2D)
-0:?         'os.tex' ( temp texture2D)
+0:21        tex: direct index for structure ( temp texture2D)
+0:21          'os' ( temp structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:21          Constant:
+0:21            2 (const int)
 0:21        'gtex' ( uniform texture2D)
 0:21        'gtex' ( uniform texture2D)
 0:22      move second child to first child ( temp float)
 0:22      move second child to first child ( temp float)
-0:?         'os.a' ( temp float)
+0:22        a: direct index for structure ( temp float)
+0:22          'os' ( temp structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:22          Constant:
+0:22            1 (const int)
 0:22        Constant:
 0:22        Constant:
 0:22          3.000000
 0:22          3.000000
 0:28      Branch: Return with expression
 0:28      Branch: Return with expression
 0:28        Function Call: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float)
 0:28        Function Call: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float)
-0:?           'os.ss' ( temp sampler)
-0:?           'os.a' ( temp float)
-0:?           'os.tex' ( temp texture2D)
+0:28          'os' ( temp structure{ temp sampler ss,  temp float a,  temp texture2D tex})
 0:17  Function Definition: main( ( temp void)
 0:17  Function Definition: main( ( temp void)
 0:17    Function Parameters: 
 0:17    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
@@ -61,17 +78,24 @@ gl_FragCoord origin is upper left
 0:? Sequence
 0:? Sequence
 0:12  Function Definition: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float)
 0:12  Function Definition: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float)
 0:12    Function Parameters: 
 0:12    Function Parameters: 
-0:?       's.ss' ( in sampler)
-0:?       's.a' ( in float)
-0:?       's.tex' ( in texture2D)
+0:12      's' ( in structure{ temp sampler ss,  temp float a,  temp texture2D tex})
 0:?     Sequence
 0:?     Sequence
 0:13      Branch: Return with expression
 0:13      Branch: Return with expression
 0:13        vector-scale ( temp 4-component vector of float)
 0:13        vector-scale ( temp 4-component vector of float)
-0:?           's.a' ( in float)
+0:13          a: direct index for structure ( temp float)
+0:13            's' ( in structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:13            Constant:
+0:13              1 (const int)
 0:13          texture ( temp 4-component vector of float)
 0:13          texture ( temp 4-component vector of float)
 0:13            Construct combined texture-sampler ( temp sampler2D)
 0:13            Construct combined texture-sampler ( temp sampler2D)
-0:?               's.tex' ( in texture2D)
-0:?               's.ss' ( in sampler)
+0:13              tex: direct index for structure ( temp texture2D)
+0:13                's' ( in structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:13                Constant:
+0:13                  2 (const int)
+0:13              ss: direct index for structure ( temp sampler)
+0:13                's' ( in structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:13                Constant:
+0:13                  0 (const int)
 0:?             Constant:
 0:?             Constant:
 0:?               0.200000
 0:?               0.200000
 0:?               0.300000
 0:?               0.300000
@@ -79,23 +103,33 @@ gl_FragCoord origin is upper left
 0:17    Function Parameters: 
 0:17    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
 0:19      move second child to first child ( temp sampler)
 0:19      move second child to first child ( temp sampler)
-0:?         'os.ss' ( temp sampler)
+0:19        ss: direct index for structure ( temp sampler)
+0:19          'os' ( temp structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:19          Constant:
+0:19            0 (const int)
 0:19        'gss2' ( uniform sampler)
 0:19        'gss2' ( uniform sampler)
 0:20      move second child to first child ( temp sampler)
 0:20      move second child to first child ( temp sampler)
-0:?         'os.ss' ( temp sampler)
+0:20        ss: direct index for structure ( temp sampler)
+0:20          'os' ( temp structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:20          Constant:
+0:20            0 (const int)
 0:20        'gss' ( uniform sampler)
 0:20        'gss' ( uniform sampler)
 0:21      move second child to first child ( temp texture2D)
 0:21      move second child to first child ( temp texture2D)
-0:?         'os.tex' ( temp texture2D)
+0:21        tex: direct index for structure ( temp texture2D)
+0:21          'os' ( temp structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:21          Constant:
+0:21            2 (const int)
 0:21        'gtex' ( uniform texture2D)
 0:21        'gtex' ( uniform texture2D)
 0:22      move second child to first child ( temp float)
 0:22      move second child to first child ( temp float)
-0:?         'os.a' ( temp float)
+0:22        a: direct index for structure ( temp float)
+0:22          'os' ( temp structure{ temp sampler ss,  temp float a,  temp texture2D tex})
+0:22          Constant:
+0:22            1 (const int)
 0:22        Constant:
 0:22        Constant:
 0:22          3.000000
 0:22          3.000000
 0:28      Branch: Return with expression
 0:28      Branch: Return with expression
 0:28        Function Call: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float)
 0:28        Function Call: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float)
-0:?           'os.ss' ( temp sampler)
-0:?           'os.a' ( temp float)
-0:?           'os.tex' ( temp texture2D)
+0:28          'os' ( temp structure{ temp sampler ss,  temp float a,  temp texture2D tex})
 0:17  Function Definition: main( ( temp void)
 0:17  Function Definition: main( ( temp void)
 0:17    Function Parameters: 
 0:17    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
@@ -110,98 +144,99 @@ gl_FragCoord origin is upper left
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 59
+// Id's are bound by 64
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 57
+                              EntryPoint Fragment 4  "main" 62
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
-                              Name 17  "osCall(struct-OS-p1-f1-t211;"
-                              Name 14  "s.ss"
-                              Name 15  "s.a"
-                              Name 16  "s.tex"
-                              Name 20  "@main("
-                              Name 35  "os.ss"
-                              Name 37  "gss2"
-                              Name 39  "gss"
-                              Name 41  "os.tex"
-                              Name 43  "gtex"
-                              Name 45  "os.a"
-                              Name 47  "param"
-                              Name 49  "param"
-                              Name 51  "param"
-                              Name 57  "@entryPointOutput"
-                              Decorate 37(gss2) DescriptorSet 0
-                              Decorate 39(gss) DescriptorSet 0
-                              Decorate 43(gtex) DescriptorSet 0
-                              Decorate 57(@entryPointOutput) Location 0
+                              Name 9  "OS"
+                              MemberName 9(OS) 0  "ss"
+                              MemberName 9(OS) 1  "a"
+                              MemberName 9(OS) 2  "tex"
+                              Name 14  "osCall(struct-OS-p1-f1-t211;"
+                              Name 13  "s"
+                              Name 17  "@main("
+                              Name 42  "os"
+                              Name 44  "gss2"
+                              Name 47  "gss"
+                              Name 51  "gtex"
+                              Name 56  "param"
+                              Name 62  "@entryPointOutput"
+                              Decorate 44(gss2) DescriptorSet 0
+                              Decorate 47(gss) DescriptorSet 0
+                              Decorate 51(gtex) DescriptorSet 0
+                              Decorate 62(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeSampler
                6:             TypeSampler
-               7:             TypePointer Function 6
-               8:             TypeFloat 32
-               9:             TypePointer Function 8(float)
-              10:             TypeImage 8(float) 2D sampled format:Unknown
-              11:             TypePointer Function 10
-              12:             TypeVector 8(float) 4
-              13:             TypeFunction 12(fvec4) 7(ptr) 9(ptr) 11(ptr)
-              19:             TypeFunction 12(fvec4)
-              25:             TypeSampledImage 10
-              27:             TypeVector 8(float) 2
-              28:    8(float) Constant 1045220557
-              29:    8(float) Constant 1050253722
-              30:   27(fvec2) ConstantComposite 28 29
-              36:             TypePointer UniformConstant 6
-        37(gss2):     36(ptr) Variable UniformConstant
-         39(gss):     36(ptr) Variable UniformConstant
-              42:             TypePointer UniformConstant 10
-        43(gtex):     42(ptr) Variable UniformConstant
-              46:    8(float) Constant 1077936128
-              56:             TypePointer Output 12(fvec4)
-57(@entryPointOutput):     56(ptr) Variable Output
+               7:             TypeFloat 32
+               8:             TypeImage 7(float) 2D sampled format:Unknown
+           9(OS):             TypeStruct 6 7(float) 8
+              10:             TypePointer Function 9(OS)
+              11:             TypeVector 7(float) 4
+              12:             TypeFunction 11(fvec4) 10(ptr)
+              16:             TypeFunction 11(fvec4)
+              19:             TypeInt 32 1
+              20:     19(int) Constant 1
+              21:             TypePointer Function 7(float)
+              24:     19(int) Constant 2
+              25:             TypePointer Function 8
+              28:     19(int) Constant 0
+              29:             TypePointer Function 6
+              32:             TypeSampledImage 8
+              34:             TypeVector 7(float) 2
+              35:    7(float) Constant 1045220557
+              36:    7(float) Constant 1050253722
+              37:   34(fvec2) ConstantComposite 35 36
+              43:             TypePointer UniformConstant 6
+        44(gss2):     43(ptr) Variable UniformConstant
+         47(gss):     43(ptr) Variable UniformConstant
+              50:             TypePointer UniformConstant 8
+        51(gtex):     50(ptr) Variable UniformConstant
+              54:    7(float) Constant 1077936128
+              61:             TypePointer Output 11(fvec4)
+62(@entryPointOutput):     61(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-              58:   12(fvec4) FunctionCall 20(@main()
-                              Store 57(@entryPointOutput) 58
+              63:   11(fvec4) FunctionCall 17(@main()
+                              Store 62(@entryPointOutput) 63
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
-17(osCall(struct-OS-p1-f1-t211;):   12(fvec4) Function None 13
-        14(s.ss):      7(ptr) FunctionParameter
-         15(s.a):      9(ptr) FunctionParameter
-       16(s.tex):     11(ptr) FunctionParameter
-              18:             Label
-              22:    8(float) Load 15(s.a)
-              23:          10 Load 16(s.tex)
-              24:           6 Load 14(s.ss)
-              26:          25 SampledImage 23 24
-              31:   12(fvec4) ImageSampleImplicitLod 26 30
-              32:   12(fvec4) VectorTimesScalar 31 22
-                              ReturnValue 32
+14(osCall(struct-OS-p1-f1-t211;):   11(fvec4) Function None 12
+           13(s):     10(ptr) FunctionParameter
+              15:             Label
+              22:     21(ptr) AccessChain 13(s) 20
+              23:    7(float) Load 22
+              26:     25(ptr) AccessChain 13(s) 24
+              27:           8 Load 26
+              30:     29(ptr) AccessChain 13(s) 28
+              31:           6 Load 30
+              33:          32 SampledImage 27 31
+              38:   11(fvec4) ImageSampleImplicitLod 33 37
+              39:   11(fvec4) VectorTimesScalar 38 23
+                              ReturnValue 39
                               FunctionEnd
                               FunctionEnd
-      20(@main():   12(fvec4) Function None 19
-              21:             Label
-       35(os.ss):      7(ptr) Variable Function
-      41(os.tex):     11(ptr) Variable Function
-        45(os.a):      9(ptr) Variable Function
-       47(param):      7(ptr) Variable Function
-       49(param):      9(ptr) Variable Function
-       51(param):     11(ptr) Variable Function
-              38:           6 Load 37(gss2)
-                              Store 35(os.ss) 38
-              40:           6 Load 39(gss)
-                              Store 35(os.ss) 40
-              44:          10 Load 43(gtex)
-                              Store 41(os.tex) 44
-                              Store 45(os.a) 46
-              48:           6 Load 35(os.ss)
-                              Store 47(param) 48
-              50:    8(float) Load 45(os.a)
-                              Store 49(param) 50
-              52:          10 Load 41(os.tex)
-                              Store 51(param) 52
-              53:   12(fvec4) FunctionCall 17(osCall(struct-OS-p1-f1-t211;) 47(param) 49(param) 51(param)
-                              ReturnValue 53
+      17(@main():   11(fvec4) Function None 16
+              18:             Label
+          42(os):     10(ptr) Variable Function
+       56(param):     10(ptr) Variable Function
+              45:           6 Load 44(gss2)
+              46:     29(ptr) AccessChain 42(os) 28
+                              Store 46 45
+              48:           6 Load 47(gss)
+              49:     29(ptr) AccessChain 42(os) 28
+                              Store 49 48
+              52:           8 Load 51(gtex)
+              53:     25(ptr) AccessChain 42(os) 24
+                              Store 53 52
+              55:     21(ptr) AccessChain 42(os) 20
+                              Store 55 54
+              57:       9(OS) Load 42(os)
+                              Store 56(param) 57
+              58:   11(fvec4) FunctionCall 14(osCall(struct-OS-p1-f1-t211;) 56(param)
+                              ReturnValue 58
                               FunctionEnd
                               FunctionEnd

+ 573 - 0
3rdparty/glslang/Test/baseResults/hlsl.color.hull.tesc.out

@@ -0,0 +1,573 @@
+hlsl.color.hull.tesc
+Shader version: 500
+vertices = 3
+vertex spacing = equal_spacing
+triangle order = cw
+0:? Sequence
+0:37  Function Definition: ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1; ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:37    Function Parameters: 
+0:37      'inputPatch' ( in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:37      'patchId' ( in uint)
+0:?     Sequence
+0:42      move second child to first child ( temp float)
+0:42        direct index ( temp float)
+0:42          edges: direct index for structure ( temp 3-element array of float)
+0:42            'output' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:42            Constant:
+0:42              0 (const int)
+0:42          Constant:
+0:42            0 (const int)
+0:42        tessellationAmount: direct index for structure (layout( row_major std140) uniform float)
+0:42          'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding})
+0:42          Constant:
+0:42            0 (const uint)
+0:43      move second child to first child ( temp float)
+0:43        direct index ( temp float)
+0:43          edges: direct index for structure ( temp 3-element array of float)
+0:43            'output' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:43            Constant:
+0:43              0 (const int)
+0:43          Constant:
+0:43            1 (const int)
+0:43        tessellationAmount: direct index for structure (layout( row_major std140) uniform float)
+0:43          'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding})
+0:43          Constant:
+0:43            0 (const uint)
+0:44      move second child to first child ( temp float)
+0:44        direct index ( temp float)
+0:44          edges: direct index for structure ( temp 3-element array of float)
+0:44            'output' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:44            Constant:
+0:44              0 (const int)
+0:44          Constant:
+0:44            2 (const int)
+0:44        tessellationAmount: direct index for structure (layout( row_major std140) uniform float)
+0:44          'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding})
+0:44          Constant:
+0:44            0 (const uint)
+0:47      move second child to first child ( temp float)
+0:47        inside: direct index for structure ( temp float)
+0:47          'output' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:47          Constant:
+0:47            1 (const int)
+0:47        tessellationAmount: direct index for structure (layout( row_major std140) uniform float)
+0:47          'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding})
+0:47          Constant:
+0:47            0 (const uint)
+0:49      Branch: Return with expression
+0:49        'output' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:63  Function Definition: @main(struct-HullInputType-vf3-vf41[3];u1;u1; ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:63    Function Parameters: 
+0:63      'patch' ( in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:63      'pointId' ( in uint)
+0:63      'patchId' ( in uint)
+0:?     Sequence
+0:67      move second child to first child ( temp 3-component vector of float)
+0:67        position: direct index for structure ( temp 3-component vector of float)
+0:67          'output' ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:67          Constant:
+0:67            0 (const int)
+0:67        position: direct index for structure ( temp 3-component vector of float)
+0:67          indirect index ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:67            'patch' ( in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:67            'pointId' ( in uint)
+0:67          Constant:
+0:67            0 (const int)
+0:70      move second child to first child ( temp 4-component vector of float)
+0:70        color: direct index for structure ( temp 4-component vector of float)
+0:70          'output' ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:70          Constant:
+0:70            1 (const int)
+0:70        color: direct index for structure ( temp 4-component vector of float)
+0:70          indirect index ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:70            'patch' ( in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:70            'pointId' ( in uint)
+0:70          Constant:
+0:70            1 (const int)
+0:72      Branch: Return with expression
+0:72        'output' ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:63  Function Definition: main( ( temp void)
+0:63    Function Parameters: 
+0:?     Sequence
+0:63      move second child to first child ( temp 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?         'patch' ( temp 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?         'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:63      move second child to first child ( temp uint)
+0:?         'pointId' ( temp uint)
+0:?         'pointId' ( in uint InvocationID)
+0:63      move second child to first child ( temp uint)
+0:?         'patchId' ( temp uint)
+0:?         'patchId' ( in uint PrimitiveID)
+0:63      move second child to first child ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:63        indirect index (layout( location=0) out structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?           'pointId' ( in uint InvocationID)
+0:63        Function Call: @main(struct-HullInputType-vf3-vf41[3];u1;u1; ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?           'patch' ( temp 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?           'pointId' ( temp uint)
+0:?           'patchId' ( temp uint)
+0:?       Barrier ( temp void)
+0:?       Test condition and select ( temp void)
+0:?         Condition
+0:?         Compare Equal ( temp bool)
+0:?           'pointId' ( in uint InvocationID)
+0:?           Constant:
+0:?             0 (const int)
+0:?         true case
+0:?         Sequence
+0:?           move second child to first child ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?             '@patchConstantResult' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?             Function Call: ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1; ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?               'patch' ( temp 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?               'patchId' ( in uint PrimitiveID)
+0:?           Sequence
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               direct index ( temp float)
+0:?                 edges: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?               direct index ( temp float)
+0:?                 edges: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?               direct index ( temp float)
+0:?                 edges: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelInner)
+0:?                 '@patchConstantOutput.inside' ( patch out 2-element array of float TessLevelInner)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               inside: direct index for structure ( temp float)
+0:?                 '@patchConstantResult' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?                 Constant:
+0:?                   1 (const int)
+0:?   Linker Objects
+0:?     'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding})
+0:?     '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?     'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?     'pointId' ( in uint InvocationID)
+0:?     'patchId' ( in uint PrimitiveID)
+0:?     '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput.inside' ( patch out 2-element array of float TessLevelInner)
+
+
+Linked tessellation control stage:
+
+
+Shader version: 500
+vertices = 3
+vertex spacing = equal_spacing
+triangle order = cw
+0:? Sequence
+0:37  Function Definition: ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1; ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:37    Function Parameters: 
+0:37      'inputPatch' ( in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:37      'patchId' ( in uint)
+0:?     Sequence
+0:42      move second child to first child ( temp float)
+0:42        direct index ( temp float)
+0:42          edges: direct index for structure ( temp 3-element array of float)
+0:42            'output' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:42            Constant:
+0:42              0 (const int)
+0:42          Constant:
+0:42            0 (const int)
+0:42        tessellationAmount: direct index for structure (layout( row_major std140) uniform float)
+0:42          'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding})
+0:42          Constant:
+0:42            0 (const uint)
+0:43      move second child to first child ( temp float)
+0:43        direct index ( temp float)
+0:43          edges: direct index for structure ( temp 3-element array of float)
+0:43            'output' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:43            Constant:
+0:43              0 (const int)
+0:43          Constant:
+0:43            1 (const int)
+0:43        tessellationAmount: direct index for structure (layout( row_major std140) uniform float)
+0:43          'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding})
+0:43          Constant:
+0:43            0 (const uint)
+0:44      move second child to first child ( temp float)
+0:44        direct index ( temp float)
+0:44          edges: direct index for structure ( temp 3-element array of float)
+0:44            'output' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:44            Constant:
+0:44              0 (const int)
+0:44          Constant:
+0:44            2 (const int)
+0:44        tessellationAmount: direct index for structure (layout( row_major std140) uniform float)
+0:44          'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding})
+0:44          Constant:
+0:44            0 (const uint)
+0:47      move second child to first child ( temp float)
+0:47        inside: direct index for structure ( temp float)
+0:47          'output' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:47          Constant:
+0:47            1 (const int)
+0:47        tessellationAmount: direct index for structure (layout( row_major std140) uniform float)
+0:47          'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding})
+0:47          Constant:
+0:47            0 (const uint)
+0:49      Branch: Return with expression
+0:49        'output' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:63  Function Definition: @main(struct-HullInputType-vf3-vf41[3];u1;u1; ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:63    Function Parameters: 
+0:63      'patch' ( in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:63      'pointId' ( in uint)
+0:63      'patchId' ( in uint)
+0:?     Sequence
+0:67      move second child to first child ( temp 3-component vector of float)
+0:67        position: direct index for structure ( temp 3-component vector of float)
+0:67          'output' ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:67          Constant:
+0:67            0 (const int)
+0:67        position: direct index for structure ( temp 3-component vector of float)
+0:67          indirect index ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:67            'patch' ( in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:67            'pointId' ( in uint)
+0:67          Constant:
+0:67            0 (const int)
+0:70      move second child to first child ( temp 4-component vector of float)
+0:70        color: direct index for structure ( temp 4-component vector of float)
+0:70          'output' ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:70          Constant:
+0:70            1 (const int)
+0:70        color: direct index for structure ( temp 4-component vector of float)
+0:70          indirect index ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:70            'patch' ( in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:70            'pointId' ( in uint)
+0:70          Constant:
+0:70            1 (const int)
+0:72      Branch: Return with expression
+0:72        'output' ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:63  Function Definition: main( ( temp void)
+0:63    Function Parameters: 
+0:?     Sequence
+0:63      move second child to first child ( temp 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?         'patch' ( temp 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?         'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:63      move second child to first child ( temp uint)
+0:?         'pointId' ( temp uint)
+0:?         'pointId' ( in uint InvocationID)
+0:63      move second child to first child ( temp uint)
+0:?         'patchId' ( temp uint)
+0:?         'patchId' ( in uint PrimitiveID)
+0:63      move second child to first child ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:63        indirect index (layout( location=0) out structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?           'pointId' ( in uint InvocationID)
+0:63        Function Call: @main(struct-HullInputType-vf3-vf41[3];u1;u1; ( temp structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?           'patch' ( temp 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?           'pointId' ( temp uint)
+0:?           'patchId' ( temp uint)
+0:?       Barrier ( temp void)
+0:?       Test condition and select ( temp void)
+0:?         Condition
+0:?         Compare Equal ( temp bool)
+0:?           'pointId' ( in uint InvocationID)
+0:?           Constant:
+0:?             0 (const int)
+0:?         true case
+0:?         Sequence
+0:?           move second child to first child ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?             '@patchConstantResult' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?             Function Call: ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1; ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?               'patch' ( temp 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?               'patchId' ( in uint PrimitiveID)
+0:?           Sequence
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               direct index ( temp float)
+0:?                 edges: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?               direct index ( temp float)
+0:?                 edges: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?               direct index ( temp float)
+0:?                 edges: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?                   Constant:
+0:?                     0 (const int)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelInner)
+0:?                 '@patchConstantOutput.inside' ( patch out 2-element array of float TessLevelInner)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               inside: direct index for structure ( temp float)
+0:?                 '@patchConstantResult' ( temp structure{ temp 3-element array of float edges,  temp float inside})
+0:?                 Constant:
+0:?                   1 (const int)
+0:?   Linker Objects
+0:?     'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform float tessellationAmount, layout( row_major std140) uniform 3-component vector of float padding})
+0:?     '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?     'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float position,  temp 4-component vector of float color})
+0:?     'pointId' ( in uint InvocationID)
+0:?     'patchId' ( in uint PrimitiveID)
+0:?     '@patchConstantOutput.edges' ( patch out 4-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput.inside' ( patch out 2-element array of float TessLevelInner)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 128
+
+                              Capability Tessellation
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint TessellationControl 4  "main" 72 76 79 83 111 124
+                              ExecutionMode 4 OutputVertices 3
+                              ExecutionMode 4 Triangles
+                              ExecutionMode 4 SpacingEqual
+                              ExecutionMode 4 VertexOrderCw
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 9  "HullInputType"
+                              MemberName 9(HullInputType) 0  "position"
+                              MemberName 9(HullInputType) 1  "color"
+                              Name 16  "ConstantOutputType"
+                              MemberName 16(ConstantOutputType) 0  "edges"
+                              MemberName 16(ConstantOutputType) 1  "inside"
+                              Name 20  "ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1;"
+                              Name 18  "inputPatch"
+                              Name 19  "patchId"
+                              Name 22  "HullOutputType"
+                              MemberName 22(HullOutputType) 0  "position"
+                              MemberName 22(HullOutputType) 1  "color"
+                              Name 27  "@main(struct-HullInputType-vf3-vf41[3];u1;u1;"
+                              Name 24  "patch"
+                              Name 25  "pointId"
+                              Name 26  "patchId"
+                              Name 30  "output"
+                              Name 33  "TessellationBuffer"
+                              MemberName 33(TessellationBuffer) 0  "tessellationAmount"
+                              MemberName 33(TessellationBuffer) 1  "padding"
+                              Name 35  ""
+                              Name 56  "output"
+                              Name 70  "patch"
+                              Name 72  "patch"
+                              Name 74  "pointId"
+                              Name 76  "pointId"
+                              Name 78  "patchId"
+                              Name 79  "patchId"
+                              Name 83  "@entryPointOutput"
+                              Name 85  "param"
+                              Name 87  "param"
+                              Name 89  "param"
+                              Name 102  "@patchConstantResult"
+                              Name 103  "param"
+                              Name 105  "param"
+                              Name 111  "@patchConstantOutput.edges"
+                              Name 124  "@patchConstantOutput.inside"
+                              MemberDecorate 33(TessellationBuffer) 0 Offset 0
+                              MemberDecorate 33(TessellationBuffer) 1 Offset 4
+                              Decorate 33(TessellationBuffer) Block
+                              Decorate 35 DescriptorSet 0
+                              Decorate 35 Binding 0
+                              Decorate 72(patch) Location 0
+                              Decorate 76(pointId) BuiltIn InvocationId
+                              Decorate 79(patchId) BuiltIn PrimitiveId
+                              Decorate 83(@entryPointOutput) Location 0
+                              Decorate 111(@patchConstantOutput.edges) Patch
+                              Decorate 111(@patchConstantOutput.edges) BuiltIn TessLevelOuter
+                              Decorate 124(@patchConstantOutput.inside) Patch
+                              Decorate 124(@patchConstantOutput.inside) BuiltIn TessLevelInner
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 3
+               8:             TypeVector 6(float) 4
+9(HullInputType):             TypeStruct 7(fvec3) 8(fvec4)
+              10:             TypeInt 32 0
+              11:     10(int) Constant 3
+              12:             TypeArray 9(HullInputType) 11
+              13:             TypePointer Function 12
+              14:             TypePointer Function 10(int)
+              15:             TypeArray 6(float) 11
+16(ConstantOutputType):             TypeStruct 15 6(float)
+              17:             TypeFunction 16(ConstantOutputType) 13(ptr) 14(ptr)
+22(HullOutputType):             TypeStruct 7(fvec3) 8(fvec4)
+              23:             TypeFunction 22(HullOutputType) 13(ptr) 14(ptr) 14(ptr)
+              29:             TypePointer Function 16(ConstantOutputType)
+              31:             TypeInt 32 1
+              32:     31(int) Constant 0
+33(TessellationBuffer):             TypeStruct 6(float) 7(fvec3)
+              34:             TypePointer Uniform 33(TessellationBuffer)
+              35:     34(ptr) Variable Uniform
+              36:             TypePointer Uniform 6(float)
+              39:             TypePointer Function 6(float)
+              41:     31(int) Constant 1
+              45:     31(int) Constant 2
+              55:             TypePointer Function 22(HullOutputType)
+              58:             TypePointer Function 7(fvec3)
+              63:             TypePointer Function 8(fvec4)
+              71:             TypePointer Input 12
+       72(patch):     71(ptr) Variable Input
+              75:             TypePointer Input 10(int)
+     76(pointId):     75(ptr) Variable Input
+     79(patchId):     75(ptr) Variable Input
+              81:             TypeArray 22(HullOutputType) 11
+              82:             TypePointer Output 81
+83(@entryPointOutput):     82(ptr) Variable Output
+              92:             TypePointer Output 22(HullOutputType)
+              94:     10(int) Constant 2
+              95:     10(int) Constant 1
+              96:     10(int) Constant 0
+              98:             TypeBool
+             108:     10(int) Constant 4
+             109:             TypeArray 6(float) 108
+             110:             TypePointer Output 109
+111(@patchConstantOutput.edges):    110(ptr) Variable Output
+             114:             TypePointer Output 6(float)
+             122:             TypeArray 6(float) 94
+             123:             TypePointer Output 122
+124(@patchConstantOutput.inside):    123(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+       70(patch):     13(ptr) Variable Function
+     74(pointId):     14(ptr) Variable Function
+     78(patchId):     14(ptr) Variable Function
+       85(param):     13(ptr) Variable Function
+       87(param):     14(ptr) Variable Function
+       89(param):     14(ptr) Variable Function
+102(@patchConstantResult):     29(ptr) Variable Function
+      103(param):     13(ptr) Variable Function
+      105(param):     14(ptr) Variable Function
+              73:          12 Load 72(patch)
+                              Store 70(patch) 73
+              77:     10(int) Load 76(pointId)
+                              Store 74(pointId) 77
+              80:     10(int) Load 79(patchId)
+                              Store 78(patchId) 80
+              84:     10(int) Load 76(pointId)
+              86:          12 Load 70(patch)
+                              Store 85(param) 86
+              88:     10(int) Load 74(pointId)
+                              Store 87(param) 88
+              90:     10(int) Load 78(patchId)
+                              Store 89(param) 90
+              91:22(HullOutputType) FunctionCall 27(@main(struct-HullInputType-vf3-vf41[3];u1;u1;) 85(param) 87(param) 89(param)
+              93:     92(ptr) AccessChain 83(@entryPointOutput) 84
+                              Store 93 91
+                              ControlBarrier 94 95 96
+              97:     10(int) Load 76(pointId)
+              99:    98(bool) IEqual 97 32
+                              SelectionMerge 101 None
+                              BranchConditional 99 100 101
+             100:               Label
+             104:          12   Load 70(patch)
+                                Store 103(param) 104
+             106:     10(int)   Load 79(patchId)
+                                Store 105(param) 106
+             107:16(ConstantOutputType)   FunctionCall 20(ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1;) 103(param) 105(param)
+                                Store 102(@patchConstantResult) 107
+             112:     39(ptr)   AccessChain 102(@patchConstantResult) 32 32
+             113:    6(float)   Load 112
+             115:    114(ptr)   AccessChain 111(@patchConstantOutput.edges) 32
+                                Store 115 113
+             116:     39(ptr)   AccessChain 102(@patchConstantResult) 32 41
+             117:    6(float)   Load 116
+             118:    114(ptr)   AccessChain 111(@patchConstantOutput.edges) 41
+                                Store 118 117
+             119:     39(ptr)   AccessChain 102(@patchConstantResult) 32 45
+             120:    6(float)   Load 119
+             121:    114(ptr)   AccessChain 111(@patchConstantOutput.edges) 45
+                                Store 121 120
+             125:     39(ptr)   AccessChain 102(@patchConstantResult) 41
+             126:    6(float)   Load 125
+             127:    114(ptr)   AccessChain 124(@patchConstantOutput.inside) 32
+                                Store 127 126
+                                Branch 101
+             101:             Label
+                              Return
+                              FunctionEnd
+20(ColorPatchConstantFunction(struct-HullInputType-vf3-vf41[3];u1;):16(ConstantOutputType) Function None 17
+  18(inputPatch):     13(ptr) FunctionParameter
+     19(patchId):     14(ptr) FunctionParameter
+              21:             Label
+      30(output):     29(ptr) Variable Function
+              37:     36(ptr) AccessChain 35 32
+              38:    6(float) Load 37
+              40:     39(ptr) AccessChain 30(output) 32 32
+                              Store 40 38
+              42:     36(ptr) AccessChain 35 32
+              43:    6(float) Load 42
+              44:     39(ptr) AccessChain 30(output) 32 41
+                              Store 44 43
+              46:     36(ptr) AccessChain 35 32
+              47:    6(float) Load 46
+              48:     39(ptr) AccessChain 30(output) 32 45
+                              Store 48 47
+              49:     36(ptr) AccessChain 35 32
+              50:    6(float) Load 49
+              51:     39(ptr) AccessChain 30(output) 41
+                              Store 51 50
+              52:16(ConstantOutputType) Load 30(output)
+                              ReturnValue 52
+                              FunctionEnd
+27(@main(struct-HullInputType-vf3-vf41[3];u1;u1;):22(HullOutputType) Function None 23
+       24(patch):     13(ptr) FunctionParameter
+     25(pointId):     14(ptr) FunctionParameter
+     26(patchId):     14(ptr) FunctionParameter
+              28:             Label
+      56(output):     55(ptr) Variable Function
+              57:     10(int) Load 25(pointId)
+              59:     58(ptr) AccessChain 24(patch) 57 32
+              60:    7(fvec3) Load 59
+              61:     58(ptr) AccessChain 56(output) 32
+                              Store 61 60
+              62:     10(int) Load 25(pointId)
+              64:     63(ptr) AccessChain 24(patch) 62 41
+              65:    8(fvec4) Load 64
+              66:     63(ptr) AccessChain 56(output) 41
+                              Store 66 65
+              67:22(HullOutputType) Load 56(output)
+                              ReturnValue 67
+                              FunctionEnd

+ 305 - 156
3rdparty/glslang/Test/baseResults/hlsl.flattenOpaque.frag.out

@@ -1,54 +1,71 @@
 hlsl.flattenOpaque.frag
 hlsl.flattenOpaque.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
 Shader version: 500
 Shader version: 500
 gl_FragCoord origin is upper left
 gl_FragCoord origin is upper left
 0:? Sequence
 0:? Sequence
 0:15  Function Definition: osCall1(struct-os-p11; ( temp 4-component vector of float)
 0:15  Function Definition: osCall1(struct-os-p11; ( temp 4-component vector of float)
 0:15    Function Parameters: 
 0:15    Function Parameters: 
-0:?       's.s2D' ( in sampler)
+0:15      's' ( in structure{ temp sampler s2D})
 0:?     Sequence
 0:?     Sequence
 0:16      Branch: Return with expression
 0:16      Branch: Return with expression
 0:16        texture ( temp 4-component vector of float)
 0:16        texture ( temp 4-component vector of float)
 0:16          Construct combined texture-sampler ( temp sampler2D)
 0:16          Construct combined texture-sampler ( temp sampler2D)
 0:16            'tex' ( uniform texture2D)
 0:16            'tex' ( uniform texture2D)
-0:?             's.s2D' ( in sampler)
+0:16            s2D: direct index for structure ( temp sampler)
+0:16              's' ( in structure{ temp sampler s2D})
+0:16              Constant:
+0:16                0 (const int)
 0:?           Constant:
 0:?           Constant:
 0:?             0.200000
 0:?             0.200000
 0:?             0.300000
 0:?             0.300000
 0:20  Function Definition: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float)
 0:20  Function Definition: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float)
 0:20    Function Parameters: 
 0:20    Function Parameters: 
-0:?       's.s2D' ( in sampler)
+0:20      's' ( in structure{ temp sampler s2D})
 0:20      'f2' ( in 2-component vector of float)
 0:20      'f2' ( in 2-component vector of float)
 0:?     Sequence
 0:?     Sequence
 0:21      Branch: Return with expression
 0:21      Branch: Return with expression
 0:21        texture ( temp 4-component vector of float)
 0:21        texture ( temp 4-component vector of float)
 0:21          Construct combined texture-sampler ( temp sampler2D)
 0:21          Construct combined texture-sampler ( temp sampler2D)
 0:21            'tex' ( uniform texture2D)
 0:21            'tex' ( uniform texture2D)
-0:?             's.s2D' ( in sampler)
+0:21            s2D: direct index for structure ( temp sampler)
+0:21              's' ( in structure{ temp sampler s2D})
+0:21              Constant:
+0:21                0 (const int)
 0:21          'f2' ( in 2-component vector of float)
 0:21          'f2' ( in 2-component vector of float)
 0:25  Function Definition: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float)
 0:25  Function Definition: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float)
 0:25    Function Parameters: 
 0:25    Function Parameters: 
-0:?       's.s2D' ( in sampler)
-0:?       's.tex' ( in texture2D)
+0:25      's' ( in structure{ temp sampler s2D,  temp texture2D tex})
 0:?     Sequence
 0:?     Sequence
 0:26      Branch: Return with expression
 0:26      Branch: Return with expression
 0:26        texture ( temp 4-component vector of float)
 0:26        texture ( temp 4-component vector of float)
 0:26          Construct combined texture-sampler ( temp sampler2D)
 0:26          Construct combined texture-sampler ( temp sampler2D)
-0:?             's.tex' ( in texture2D)
-0:?             's.s2D' ( in sampler)
+0:26            tex: direct index for structure ( temp texture2D)
+0:26              's' ( in structure{ temp sampler s2D,  temp texture2D tex})
+0:26              Constant:
+0:26                1 (const int)
+0:26            s2D: direct index for structure ( temp sampler)
+0:26              's' ( in structure{ temp sampler s2D,  temp texture2D tex})
+0:26              Constant:
+0:26                0 (const int)
 0:?           Constant:
 0:?           Constant:
 0:?             0.200000
 0:?             0.200000
 0:?             0.300000
 0:?             0.300000
 0:30  Function Definition: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float)
 0:30  Function Definition: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float)
 0:30    Function Parameters: 
 0:30    Function Parameters: 
-0:?       's.s2D' ( in sampler)
-0:?       's.tex' ( in texture2D)
+0:30      's' ( in structure{ temp sampler s2D,  temp texture2D tex})
 0:30      'f2' ( in 2-component vector of float)
 0:30      'f2' ( in 2-component vector of float)
 0:?     Sequence
 0:?     Sequence
 0:31      Branch: Return with expression
 0:31      Branch: Return with expression
 0:31        texture ( temp 4-component vector of float)
 0:31        texture ( temp 4-component vector of float)
 0:31          Construct combined texture-sampler ( temp sampler2D)
 0:31          Construct combined texture-sampler ( temp sampler2D)
-0:?             's.tex' ( in texture2D)
-0:?             's.s2D' ( in sampler)
+0:31            tex: direct index for structure ( temp texture2D)
+0:31              's' ( in structure{ temp sampler s2D,  temp texture2D tex})
+0:31              Constant:
+0:31                1 (const int)
+0:31            s2D: direct index for structure ( temp sampler)
+0:31              's' ( in structure{ temp sampler s2D,  temp texture2D tex})
+0:31              Constant:
+0:31                0 (const int)
 0:31          'f2' ( in 2-component vector of float)
 0:31          'f2' ( in 2-component vector of float)
 0:35  Function Definition: @main( ( temp 4-component vector of float)
 0:35  Function Definition: @main( ( temp 4-component vector of float)
 0:35    Function Parameters: 
 0:35    Function Parameters: 
@@ -58,18 +75,60 @@ gl_FragCoord origin is upper left
 0:37          add ( temp 4-component vector of float)
 0:37          add ( temp 4-component vector of float)
 0:36            add ( temp 4-component vector of float)
 0:36            add ( temp 4-component vector of float)
 0:36              Function Call: osCall1(struct-os-p11; ( temp 4-component vector of float)
 0:36              Function Call: osCall1(struct-os-p11; ( temp 4-component vector of float)
-0:?                 's.s2D' ( uniform sampler)
+0:36                Comma ( temp structure{ temp sampler s2D})
+0:36                  Sequence
+0:36                    move second child to first child ( temp sampler)
+0:36                      s2D: direct index for structure ( temp sampler)
+0:36                        'aggShadow' ( temp structure{ temp sampler s2D})
+0:36                        Constant:
+0:36                          0 (const int)
+0:?                       's.s2D' ( uniform sampler)
+0:36                  'aggShadow' ( temp structure{ temp sampler s2D})
 0:37              Function Call: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float)
 0:37              Function Call: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float)
-0:?                 's.s2D' ( uniform sampler)
+0:37                Comma ( temp structure{ temp sampler s2D})
+0:37                  Sequence
+0:37                    move second child to first child ( temp sampler)
+0:37                      s2D: direct index for structure ( temp sampler)
+0:37                        'aggShadow' ( temp structure{ temp sampler s2D})
+0:37                        Constant:
+0:37                          0 (const int)
+0:?                       's.s2D' ( uniform sampler)
+0:37                  'aggShadow' ( temp structure{ temp sampler s2D})
 0:?                 Constant:
 0:?                 Constant:
 0:?                   0.200000
 0:?                   0.200000
 0:?                   0.300000
 0:?                   0.300000
 0:38            Function Call: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float)
 0:38            Function Call: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float)
-0:?               's2.s2D' ( uniform sampler)
-0:?               's2.tex' ( uniform texture2D)
+0:38              Comma ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:38                Sequence
+0:38                  move second child to first child ( temp sampler)
+0:38                    s2D: direct index for structure ( temp sampler)
+0:38                      'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:38                      Constant:
+0:38                        0 (const int)
+0:?                     's2.s2D' ( uniform sampler)
+0:38                  move second child to first child ( temp texture2D)
+0:38                    tex: direct index for structure ( temp texture2D)
+0:38                      'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:38                      Constant:
+0:38                        1 (const int)
+0:?                     's2.tex' ( uniform texture2D)
+0:38                'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
 0:39          Function Call: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float)
 0:39          Function Call: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float)
-0:?             's2.s2D' ( uniform sampler)
-0:?             's2.tex' ( uniform texture2D)
+0:39            Comma ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:39              Sequence
+0:39                move second child to first child ( temp sampler)
+0:39                  s2D: direct index for structure ( temp sampler)
+0:39                    'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:39                    Constant:
+0:39                      0 (const int)
+0:?                   's2.s2D' ( uniform sampler)
+0:39                move second child to first child ( temp texture2D)
+0:39                  tex: direct index for structure ( temp texture2D)
+0:39                    'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:39                    Constant:
+0:39                      1 (const int)
+0:?                   's2.tex' ( uniform texture2D)
+0:39              'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
 0:?             Constant:
 0:?             Constant:
 0:?               0.200000
 0:?               0.200000
 0:?               0.300000
 0:?               0.300000
@@ -95,51 +154,67 @@ gl_FragCoord origin is upper left
 0:? Sequence
 0:? Sequence
 0:15  Function Definition: osCall1(struct-os-p11; ( temp 4-component vector of float)
 0:15  Function Definition: osCall1(struct-os-p11; ( temp 4-component vector of float)
 0:15    Function Parameters: 
 0:15    Function Parameters: 
-0:?       's.s2D' ( in sampler)
+0:15      's' ( in structure{ temp sampler s2D})
 0:?     Sequence
 0:?     Sequence
 0:16      Branch: Return with expression
 0:16      Branch: Return with expression
 0:16        texture ( temp 4-component vector of float)
 0:16        texture ( temp 4-component vector of float)
 0:16          Construct combined texture-sampler ( temp sampler2D)
 0:16          Construct combined texture-sampler ( temp sampler2D)
 0:16            'tex' ( uniform texture2D)
 0:16            'tex' ( uniform texture2D)
-0:?             's.s2D' ( in sampler)
+0:16            s2D: direct index for structure ( temp sampler)
+0:16              's' ( in structure{ temp sampler s2D})
+0:16              Constant:
+0:16                0 (const int)
 0:?           Constant:
 0:?           Constant:
 0:?             0.200000
 0:?             0.200000
 0:?             0.300000
 0:?             0.300000
 0:20  Function Definition: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float)
 0:20  Function Definition: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float)
 0:20    Function Parameters: 
 0:20    Function Parameters: 
-0:?       's.s2D' ( in sampler)
+0:20      's' ( in structure{ temp sampler s2D})
 0:20      'f2' ( in 2-component vector of float)
 0:20      'f2' ( in 2-component vector of float)
 0:?     Sequence
 0:?     Sequence
 0:21      Branch: Return with expression
 0:21      Branch: Return with expression
 0:21        texture ( temp 4-component vector of float)
 0:21        texture ( temp 4-component vector of float)
 0:21          Construct combined texture-sampler ( temp sampler2D)
 0:21          Construct combined texture-sampler ( temp sampler2D)
 0:21            'tex' ( uniform texture2D)
 0:21            'tex' ( uniform texture2D)
-0:?             's.s2D' ( in sampler)
+0:21            s2D: direct index for structure ( temp sampler)
+0:21              's' ( in structure{ temp sampler s2D})
+0:21              Constant:
+0:21                0 (const int)
 0:21          'f2' ( in 2-component vector of float)
 0:21          'f2' ( in 2-component vector of float)
 0:25  Function Definition: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float)
 0:25  Function Definition: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float)
 0:25    Function Parameters: 
 0:25    Function Parameters: 
-0:?       's.s2D' ( in sampler)
-0:?       's.tex' ( in texture2D)
+0:25      's' ( in structure{ temp sampler s2D,  temp texture2D tex})
 0:?     Sequence
 0:?     Sequence
 0:26      Branch: Return with expression
 0:26      Branch: Return with expression
 0:26        texture ( temp 4-component vector of float)
 0:26        texture ( temp 4-component vector of float)
 0:26          Construct combined texture-sampler ( temp sampler2D)
 0:26          Construct combined texture-sampler ( temp sampler2D)
-0:?             's.tex' ( in texture2D)
-0:?             's.s2D' ( in sampler)
+0:26            tex: direct index for structure ( temp texture2D)
+0:26              's' ( in structure{ temp sampler s2D,  temp texture2D tex})
+0:26              Constant:
+0:26                1 (const int)
+0:26            s2D: direct index for structure ( temp sampler)
+0:26              's' ( in structure{ temp sampler s2D,  temp texture2D tex})
+0:26              Constant:
+0:26                0 (const int)
 0:?           Constant:
 0:?           Constant:
 0:?             0.200000
 0:?             0.200000
 0:?             0.300000
 0:?             0.300000
 0:30  Function Definition: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float)
 0:30  Function Definition: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float)
 0:30    Function Parameters: 
 0:30    Function Parameters: 
-0:?       's.s2D' ( in sampler)
-0:?       's.tex' ( in texture2D)
+0:30      's' ( in structure{ temp sampler s2D,  temp texture2D tex})
 0:30      'f2' ( in 2-component vector of float)
 0:30      'f2' ( in 2-component vector of float)
 0:?     Sequence
 0:?     Sequence
 0:31      Branch: Return with expression
 0:31      Branch: Return with expression
 0:31        texture ( temp 4-component vector of float)
 0:31        texture ( temp 4-component vector of float)
 0:31          Construct combined texture-sampler ( temp sampler2D)
 0:31          Construct combined texture-sampler ( temp sampler2D)
-0:?             's.tex' ( in texture2D)
-0:?             's.s2D' ( in sampler)
+0:31            tex: direct index for structure ( temp texture2D)
+0:31              's' ( in structure{ temp sampler s2D,  temp texture2D tex})
+0:31              Constant:
+0:31                1 (const int)
+0:31            s2D: direct index for structure ( temp sampler)
+0:31              's' ( in structure{ temp sampler s2D,  temp texture2D tex})
+0:31              Constant:
+0:31                0 (const int)
 0:31          'f2' ( in 2-component vector of float)
 0:31          'f2' ( in 2-component vector of float)
 0:35  Function Definition: @main( ( temp 4-component vector of float)
 0:35  Function Definition: @main( ( temp 4-component vector of float)
 0:35    Function Parameters: 
 0:35    Function Parameters: 
@@ -149,18 +224,60 @@ gl_FragCoord origin is upper left
 0:37          add ( temp 4-component vector of float)
 0:37          add ( temp 4-component vector of float)
 0:36            add ( temp 4-component vector of float)
 0:36            add ( temp 4-component vector of float)
 0:36              Function Call: osCall1(struct-os-p11; ( temp 4-component vector of float)
 0:36              Function Call: osCall1(struct-os-p11; ( temp 4-component vector of float)
-0:?                 's.s2D' ( uniform sampler)
+0:36                Comma ( temp structure{ temp sampler s2D})
+0:36                  Sequence
+0:36                    move second child to first child ( temp sampler)
+0:36                      s2D: direct index for structure ( temp sampler)
+0:36                        'aggShadow' ( temp structure{ temp sampler s2D})
+0:36                        Constant:
+0:36                          0 (const int)
+0:?                       's.s2D' ( uniform sampler)
+0:36                  'aggShadow' ( temp structure{ temp sampler s2D})
 0:37              Function Call: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float)
 0:37              Function Call: osCall2(struct-os-p11;vf2; ( temp 4-component vector of float)
-0:?                 's.s2D' ( uniform sampler)
+0:37                Comma ( temp structure{ temp sampler s2D})
+0:37                  Sequence
+0:37                    move second child to first child ( temp sampler)
+0:37                      s2D: direct index for structure ( temp sampler)
+0:37                        'aggShadow' ( temp structure{ temp sampler s2D})
+0:37                        Constant:
+0:37                          0 (const int)
+0:?                       's.s2D' ( uniform sampler)
+0:37                  'aggShadow' ( temp structure{ temp sampler s2D})
 0:?                 Constant:
 0:?                 Constant:
 0:?                   0.200000
 0:?                   0.200000
 0:?                   0.300000
 0:?                   0.300000
 0:38            Function Call: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float)
 0:38            Function Call: os2Call1(struct-os2-p1-t211; ( temp 4-component vector of float)
-0:?               's2.s2D' ( uniform sampler)
-0:?               's2.tex' ( uniform texture2D)
+0:38              Comma ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:38                Sequence
+0:38                  move second child to first child ( temp sampler)
+0:38                    s2D: direct index for structure ( temp sampler)
+0:38                      'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:38                      Constant:
+0:38                        0 (const int)
+0:?                     's2.s2D' ( uniform sampler)
+0:38                  move second child to first child ( temp texture2D)
+0:38                    tex: direct index for structure ( temp texture2D)
+0:38                      'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:38                      Constant:
+0:38                        1 (const int)
+0:?                     's2.tex' ( uniform texture2D)
+0:38                'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
 0:39          Function Call: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float)
 0:39          Function Call: os2Call2(struct-os2-p1-t211;vf2; ( temp 4-component vector of float)
-0:?             's2.s2D' ( uniform sampler)
-0:?             's2.tex' ( uniform texture2D)
+0:39            Comma ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:39              Sequence
+0:39                move second child to first child ( temp sampler)
+0:39                  s2D: direct index for structure ( temp sampler)
+0:39                    'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:39                    Constant:
+0:39                      0 (const int)
+0:?                   's2.s2D' ( uniform sampler)
+0:39                move second child to first child ( temp texture2D)
+0:39                  tex: direct index for structure ( temp texture2D)
+0:39                    'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
+0:39                    Constant:
+0:39                      1 (const int)
+0:?                   's2.tex' ( uniform texture2D)
+0:39              'aggShadow' ( temp structure{ temp sampler s2D,  temp texture2D tex})
 0:?             Constant:
 0:?             Constant:
 0:?               0.200000
 0:?               0.200000
 0:?               0.300000
 0:?               0.300000
@@ -179,151 +296,183 @@ gl_FragCoord origin is upper left
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 99
+// Id's are bound by 122
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 97
+                              EntryPoint Fragment 4  "main" 120
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
-                              Name 12  "osCall1(struct-os-p11;"
-                              Name 11  "s.s2D"
-                              Name 19  "osCall2(struct-os-p11;vf2;"
-                              Name 17  "s.s2D"
-                              Name 18  "f2"
-                              Name 26  "os2Call1(struct-os2-p1-t211;"
-                              Name 24  "s.s2D"
-                              Name 25  "s.tex"
+                              Name 7  "os"
+                              MemberName 7(os) 0  "s2D"
+                              Name 13  "osCall1(struct-os-p11;"
+                              Name 12  "s"
+                              Name 20  "osCall2(struct-os-p11;vf2;"
+                              Name 18  "s"
+                              Name 19  "f2"
+                              Name 23  "os2"
+                              MemberName 23(os2) 0  "s2D"
+                              MemberName 23(os2) 1  "tex"
+                              Name 27  "os2Call1(struct-os2-p1-t211;"
+                              Name 26  "s"
                               Name 32  "os2Call2(struct-os2-p1-t211;vf2;"
                               Name 32  "os2Call2(struct-os2-p1-t211;vf2;"
-                              Name 29  "s.s2D"
-                              Name 30  "s.tex"
+                              Name 30  "s"
                               Name 31  "f2"
                               Name 31  "f2"
                               Name 35  "@main("
                               Name 35  "@main("
                               Name 38  "tex"
                               Name 38  "tex"
-                              Name 70  "s.s2D"
-                              Name 71  "param"
-                              Name 74  "param"
-                              Name 76  "param"
-                              Name 79  "s2.s2D"
-                              Name 80  "s2.tex"
-                              Name 81  "param"
-                              Name 83  "param"
-                              Name 87  "param"
-                              Name 89  "param"
+                              Name 80  "aggShadow"
+                              Name 82  "s.s2D"
+                              Name 85  "param"
+                              Name 88  "aggShadow"
                               Name 91  "param"
                               Name 91  "param"
-                              Name 97  "@entryPointOutput"
+                              Name 93  "param"
+                              Name 96  "aggShadow"
+                              Name 97  "s2.s2D"
+                              Name 100  "s2.tex"
+                              Name 103  "param"
+                              Name 107  "aggShadow"
+                              Name 112  "param"
+                              Name 114  "param"
+                              Name 120  "@entryPointOutput"
                               Decorate 38(tex) DescriptorSet 0
                               Decorate 38(tex) DescriptorSet 0
-                              Decorate 70(s.s2D) DescriptorSet 0
-                              Decorate 79(s2.s2D) DescriptorSet 0
-                              Decorate 80(s2.tex) DescriptorSet 0
-                              Decorate 97(@entryPointOutput) Location 0
+                              Decorate 82(s.s2D) DescriptorSet 0
+                              Decorate 97(s2.s2D) DescriptorSet 0
+                              Decorate 100(s2.tex) DescriptorSet 0
+                              Decorate 120(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeSampler
                6:             TypeSampler
-               7:             TypePointer Function 6
-               8:             TypeFloat 32
-               9:             TypeVector 8(float) 4
-              10:             TypeFunction 9(fvec4) 7(ptr)
-              14:             TypeVector 8(float) 2
-              15:             TypePointer Function 14(fvec2)
-              16:             TypeFunction 9(fvec4) 7(ptr) 15(ptr)
-              21:             TypeImage 8(float) 2D sampled format:Unknown
-              22:             TypePointer Function 21
-              23:             TypeFunction 9(fvec4) 7(ptr) 22(ptr)
-              28:             TypeFunction 9(fvec4) 7(ptr) 22(ptr) 15(ptr)
-              34:             TypeFunction 9(fvec4)
-              37:             TypePointer UniformConstant 21
+           7(os):             TypeStruct 6
+               8:             TypePointer Function 7(os)
+               9:             TypeFloat 32
+              10:             TypeVector 9(float) 4
+              11:             TypeFunction 10(fvec4) 8(ptr)
+              15:             TypeVector 9(float) 2
+              16:             TypePointer Function 15(fvec2)
+              17:             TypeFunction 10(fvec4) 8(ptr) 16(ptr)
+              22:             TypeImage 9(float) 2D sampled format:Unknown
+         23(os2):             TypeStruct 6 22
+              24:             TypePointer Function 23(os2)
+              25:             TypeFunction 10(fvec4) 24(ptr)
+              29:             TypeFunction 10(fvec4) 24(ptr) 16(ptr)
+              34:             TypeFunction 10(fvec4)
+              37:             TypePointer UniformConstant 22
          38(tex):     37(ptr) Variable UniformConstant
          38(tex):     37(ptr) Variable UniformConstant
-              41:             TypeSampledImage 21
-              43:    8(float) Constant 1045220557
-              44:    8(float) Constant 1050253722
-              45:   14(fvec2) ConstantComposite 43 44
-              69:             TypePointer UniformConstant 6
-       70(s.s2D):     69(ptr) Variable UniformConstant
-      79(s2.s2D):     69(ptr) Variable UniformConstant
-      80(s2.tex):     37(ptr) Variable UniformConstant
-              96:             TypePointer Output 9(fvec4)
-97(@entryPointOutput):     96(ptr) Variable Output
+              40:             TypeInt 32 1
+              41:     40(int) Constant 0
+              42:             TypePointer Function 6
+              45:             TypeSampledImage 22
+              47:    9(float) Constant 1045220557
+              48:    9(float) Constant 1050253722
+              49:   15(fvec2) ConstantComposite 47 48
+              61:     40(int) Constant 1
+              62:             TypePointer Function 22
+              81:             TypePointer UniformConstant 6
+       82(s.s2D):     81(ptr) Variable UniformConstant
+      97(s2.s2D):     81(ptr) Variable UniformConstant
+     100(s2.tex):     37(ptr) Variable UniformConstant
+             119:             TypePointer Output 10(fvec4)
+120(@entryPointOutput):    119(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-              98:    9(fvec4) FunctionCall 35(@main()
-                              Store 97(@entryPointOutput) 98
+             121:   10(fvec4) FunctionCall 35(@main()
+                              Store 120(@entryPointOutput) 121
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
-12(osCall1(struct-os-p11;):    9(fvec4) Function None 10
-       11(s.s2D):      7(ptr) FunctionParameter
-              13:             Label
-              39:          21 Load 38(tex)
-              40:           6 Load 11(s.s2D)
-              42:          41 SampledImage 39 40
-              46:    9(fvec4) ImageSampleImplicitLod 42 45
-                              ReturnValue 46
+13(osCall1(struct-os-p11;):   10(fvec4) Function None 11
+           12(s):      8(ptr) FunctionParameter
+              14:             Label
+              39:          22 Load 38(tex)
+              43:     42(ptr) AccessChain 12(s) 41
+              44:           6 Load 43
+              46:          45 SampledImage 39 44
+              50:   10(fvec4) ImageSampleImplicitLod 46 49
+                              ReturnValue 50
                               FunctionEnd
                               FunctionEnd
-19(osCall2(struct-os-p11;vf2;):    9(fvec4) Function None 16
-       17(s.s2D):      7(ptr) FunctionParameter
-          18(f2):     15(ptr) FunctionParameter
-              20:             Label
-              49:          21 Load 38(tex)
-              50:           6 Load 17(s.s2D)
-              51:          41 SampledImage 49 50
-              52:   14(fvec2) Load 18(f2)
-              53:    9(fvec4) ImageSampleImplicitLod 51 52
-                              ReturnValue 53
+20(osCall2(struct-os-p11;vf2;):   10(fvec4) Function None 17
+           18(s):      8(ptr) FunctionParameter
+          19(f2):     16(ptr) FunctionParameter
+              21:             Label
+              53:          22 Load 38(tex)
+              54:     42(ptr) AccessChain 18(s) 41
+              55:           6 Load 54
+              56:          45 SampledImage 53 55
+              57:   15(fvec2) Load 19(f2)
+              58:   10(fvec4) ImageSampleImplicitLod 56 57
+                              ReturnValue 58
                               FunctionEnd
                               FunctionEnd
-26(os2Call1(struct-os2-p1-t211;):    9(fvec4) Function None 23
-       24(s.s2D):      7(ptr) FunctionParameter
-       25(s.tex):     22(ptr) FunctionParameter
-              27:             Label
-              56:          21 Load 25(s.tex)
-              57:           6 Load 24(s.s2D)
-              58:          41 SampledImage 56 57
-              59:    9(fvec4) ImageSampleImplicitLod 58 45
-                              ReturnValue 59
+27(os2Call1(struct-os2-p1-t211;):   10(fvec4) Function None 25
+           26(s):     24(ptr) FunctionParameter
+              28:             Label
+              63:     62(ptr) AccessChain 26(s) 61
+              64:          22 Load 63
+              65:     42(ptr) AccessChain 26(s) 41
+              66:           6 Load 65
+              67:          45 SampledImage 64 66
+              68:   10(fvec4) ImageSampleImplicitLod 67 49
+                              ReturnValue 68
                               FunctionEnd
                               FunctionEnd
-32(os2Call2(struct-os2-p1-t211;vf2;):    9(fvec4) Function None 28
-       29(s.s2D):      7(ptr) FunctionParameter
-       30(s.tex):     22(ptr) FunctionParameter
-          31(f2):     15(ptr) FunctionParameter
+32(os2Call2(struct-os2-p1-t211;vf2;):   10(fvec4) Function None 29
+           30(s):     24(ptr) FunctionParameter
+          31(f2):     16(ptr) FunctionParameter
               33:             Label
               33:             Label
-              62:          21 Load 30(s.tex)
-              63:           6 Load 29(s.s2D)
-              64:          41 SampledImage 62 63
-              65:   14(fvec2) Load 31(f2)
-              66:    9(fvec4) ImageSampleImplicitLod 64 65
-                              ReturnValue 66
+              71:     62(ptr) AccessChain 30(s) 61
+              72:          22 Load 71
+              73:     42(ptr) AccessChain 30(s) 41
+              74:           6 Load 73
+              75:          45 SampledImage 72 74
+              76:   15(fvec2) Load 31(f2)
+              77:   10(fvec4) ImageSampleImplicitLod 75 76
+                              ReturnValue 77
                               FunctionEnd
                               FunctionEnd
-      35(@main():    9(fvec4) Function None 34
+      35(@main():   10(fvec4) Function None 34
               36:             Label
               36:             Label
-       71(param):      7(ptr) Variable Function
-       74(param):      7(ptr) Variable Function
-       76(param):     15(ptr) Variable Function
-       81(param):      7(ptr) Variable Function
-       83(param):     22(ptr) Variable Function
-       87(param):      7(ptr) Variable Function
-       89(param):     22(ptr) Variable Function
-       91(param):     15(ptr) Variable Function
-              72:           6 Load 70(s.s2D)
-                              Store 71(param) 72
-              73:    9(fvec4) FunctionCall 12(osCall1(struct-os-p11;) 71(param)
-              75:           6 Load 70(s.s2D)
-                              Store 74(param) 75
-                              Store 76(param) 45
-              77:    9(fvec4) FunctionCall 19(osCall2(struct-os-p11;vf2;) 74(param) 76(param)
-              78:    9(fvec4) FAdd 73 77
-              82:           6 Load 79(s2.s2D)
-                              Store 81(param) 82
-              84:          21 Load 80(s2.tex)
-                              Store 83(param) 84
-              85:    9(fvec4) FunctionCall 26(os2Call1(struct-os2-p1-t211;) 81(param) 83(param)
-              86:    9(fvec4) FAdd 78 85
-              88:           6 Load 79(s2.s2D)
-                              Store 87(param) 88
-              90:          21 Load 80(s2.tex)
-                              Store 89(param) 90
-                              Store 91(param) 45
-              92:    9(fvec4) FunctionCall 32(os2Call2(struct-os2-p1-t211;vf2;) 87(param) 89(param) 91(param)
-              93:    9(fvec4) FAdd 86 92
-                              ReturnValue 93
+   80(aggShadow):      8(ptr) Variable Function
+       85(param):      8(ptr) Variable Function
+   88(aggShadow):      8(ptr) Variable Function
+       91(param):      8(ptr) Variable Function
+       93(param):     16(ptr) Variable Function
+   96(aggShadow):     24(ptr) Variable Function
+      103(param):     24(ptr) Variable Function
+  107(aggShadow):     24(ptr) Variable Function
+      112(param):     24(ptr) Variable Function
+      114(param):     16(ptr) Variable Function
+              83:           6 Load 82(s.s2D)
+              84:     42(ptr) AccessChain 80(aggShadow) 41
+                              Store 84 83
+              86:       7(os) Load 80(aggShadow)
+                              Store 85(param) 86
+              87:   10(fvec4) FunctionCall 13(osCall1(struct-os-p11;) 85(param)
+              89:           6 Load 82(s.s2D)
+              90:     42(ptr) AccessChain 88(aggShadow) 41
+                              Store 90 89
+              92:       7(os) Load 88(aggShadow)
+                              Store 91(param) 92
+                              Store 93(param) 49
+              94:   10(fvec4) FunctionCall 20(osCall2(struct-os-p11;vf2;) 91(param) 93(param)
+              95:   10(fvec4) FAdd 87 94
+              98:           6 Load 97(s2.s2D)
+              99:     42(ptr) AccessChain 96(aggShadow) 41
+                              Store 99 98
+             101:          22 Load 100(s2.tex)
+             102:     62(ptr) AccessChain 96(aggShadow) 61
+                              Store 102 101
+             104:     23(os2) Load 96(aggShadow)
+                              Store 103(param) 104
+             105:   10(fvec4) FunctionCall 27(os2Call1(struct-os2-p1-t211;) 103(param)
+             106:   10(fvec4) FAdd 95 105
+             108:           6 Load 97(s2.s2D)
+             109:     42(ptr) AccessChain 107(aggShadow) 41
+                              Store 109 108
+             110:          22 Load 100(s2.tex)
+             111:     62(ptr) AccessChain 107(aggShadow) 61
+                              Store 111 110
+             113:     23(os2) Load 107(aggShadow)
+                              Store 112(param) 113
+                              Store 114(param) 49
+             115:   10(fvec4) FunctionCall 32(os2Call2(struct-os2-p1-t211;vf2;) 112(param) 114(param)
+             116:   10(fvec4) FAdd 106 115
+                              ReturnValue 116
                               FunctionEnd
                               FunctionEnd

+ 171 - 253
3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInit.vert.out

@@ -4,14 +4,19 @@ Shader version: 500
 0:? Sequence
 0:? Sequence
 0:5  Function Definition: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
 0:5  Function Definition: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
 0:5    Function Parameters: 
 0:5    Function Parameters: 
-0:?       'tex.smpl' ( in sampler)
-0:?       'tex.tex' ( in texture2D)
+0:5      'tex' ( in structure{ temp sampler smpl,  temp texture2D tex})
 0:?     Sequence
 0:?     Sequence
 0:6      Branch: Return with expression
 0:6      Branch: Return with expression
 0:6        texture ( temp 4-component vector of float)
 0:6        texture ( temp 4-component vector of float)
 0:6          Construct combined texture-sampler ( temp sampler2D)
 0:6          Construct combined texture-sampler ( temp sampler2D)
-0:?             'tex.tex' ( in texture2D)
-0:?             'tex.smpl' ( in sampler)
+0:6            tex: direct index for structure ( temp texture2D)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex})
+0:6              Constant:
+0:6                1 (const int)
+0:6            smpl: direct index for structure ( temp sampler)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex})
+0:6              Constant:
+0:6                0 (const int)
 0:?           Constant:
 0:?           Constant:
 0:?             0.300000
 0:?             0.300000
 0:?             0.400000
 0:?             0.400000
@@ -19,10 +24,16 @@ Shader version: 500
 0:10    Function Parameters: 
 0:10    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
 0:12      move second child to first child ( temp sampler)
 0:12      move second child to first child ( temp sampler)
-0:?         't.smpl' ( temp sampler)
+0:12        smpl: direct index for structure ( temp sampler)
+0:12          't' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:12          Constant:
+0:12            0 (const int)
 0:12        'g_tInputTexture_sampler' ( uniform sampler)
 0:12        'g_tInputTexture_sampler' ( uniform sampler)
 0:13      move second child to first child ( temp texture2D)
 0:13      move second child to first child ( temp texture2D)
-0:?         't.tex' ( temp texture2D)
+0:13        tex: direct index for structure ( temp texture2D)
+0:13          't' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:13          Constant:
+0:13            1 (const int)
 0:13        'g_tInputTexture' ( uniform texture2D)
 0:13        'g_tInputTexture' ( uniform texture2D)
 0:14      Branch: Return with expression
 0:14      Branch: Return with expression
 0:14        't' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:14        't' ( temp structure{ temp sampler smpl,  temp texture2D tex})
@@ -30,67 +41,34 @@ Shader version: 500
 0:18    Function Parameters: 
 0:18    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
 0:19      Sequence
 0:19      Sequence
-0:19        Sequence
-0:19          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:19            'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:19            Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:19              'g_tInputTexture_sampler' ( uniform sampler)
-0:19              'g_tInputTexture' ( uniform texture2D)
-0:19          move second child to first child ( temp sampler)
-0:?             'tex1.smpl' ( temp sampler)
-0:19            smpl: direct index for structure ( temp sampler)
-0:19              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:19              Constant:
-0:19                0 (const int)
-0:19          move second child to first child ( temp texture2D)
-0:?             'tex1.tex' ( temp texture2D)
-0:19            tex: direct index for structure ( temp texture2D)
-0:19              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:19              Constant:
-0:19                1 (const int)
+0:19        move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19          'tex1' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19          Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19            'g_tInputTexture_sampler' ( uniform sampler)
+0:19            'g_tInputTexture' ( uniform texture2D)
 0:20      Sequence
 0:20      Sequence
 0:20        move second child to first child ( temp 4-component vector of float)
 0:20        move second child to first child ( temp 4-component vector of float)
 0:20          'res' ( temp 4-component vector of float)
 0:20          'res' ( temp 4-component vector of float)
 0:20          Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
 0:20          Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
-0:?             'tex1.smpl' ( temp sampler)
-0:?             'tex1.tex' ( temp texture2D)
+0:20            'tex1' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:21      Sequence
 0:21      Sequence
-0:21        Sequence
-0:21          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:21            'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:21            Function Call: fillOpaque( ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:21          move second child to first child ( temp sampler)
-0:?             'tex2.smpl' ( temp sampler)
-0:21            smpl: direct index for structure ( temp sampler)
-0:21              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:21              Constant:
-0:21                0 (const int)
-0:21          move second child to first child ( temp texture2D)
-0:?             'tex2.tex' ( temp texture2D)
-0:21            tex: direct index for structure ( temp texture2D)
-0:21              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:21              Constant:
-0:21                1 (const int)
+0:21        move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:21          'tex2' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:21          Function Call: fillOpaque( ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:22      add second child into first child ( temp 4-component vector of float)
 0:22      add second child into first child ( temp 4-component vector of float)
 0:22        'res' ( temp 4-component vector of float)
 0:22        'res' ( temp 4-component vector of float)
 0:22        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
 0:22        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
-0:?           'tex2.smpl' ( temp sampler)
-0:?           'tex2.tex' ( temp texture2D)
+0:22          'tex2' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:23      Sequence
 0:23      Sequence
-0:23        Sequence
-0:23          move second child to first child ( temp sampler)
-0:?             'tex3.smpl' ( temp sampler)
-0:?             'tex1.smpl' ( temp sampler)
-0:23          move second child to first child ( temp texture2D)
-0:?             'tex3.tex' ( temp texture2D)
-0:?             'tex1.tex' ( temp texture2D)
+0:23        move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:23          'tex3' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:23          'tex1' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:24      add second child into first child ( temp 4-component vector of float)
 0:24      add second child into first child ( temp 4-component vector of float)
 0:24        'res' ( temp 4-component vector of float)
 0:24        'res' ( temp 4-component vector of float)
 0:24        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
 0:24        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
-0:?           'tex3.smpl' ( temp sampler)
-0:?           'tex3.tex' ( temp texture2D)
-0:25      Branch: Return with expression
-0:25        'res' ( temp 4-component vector of float)
+0:24          'tex3' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:26      Branch: Return with expression
+0:26        'res' ( temp 4-component vector of float)
 0:18  Function Definition: main( ( temp void)
 0:18  Function Definition: main( ( temp void)
 0:18    Function Parameters: 
 0:18    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
@@ -110,14 +88,19 @@ Shader version: 500
 0:? Sequence
 0:? Sequence
 0:5  Function Definition: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
 0:5  Function Definition: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
 0:5    Function Parameters: 
 0:5    Function Parameters: 
-0:?       'tex.smpl' ( in sampler)
-0:?       'tex.tex' ( in texture2D)
+0:5      'tex' ( in structure{ temp sampler smpl,  temp texture2D tex})
 0:?     Sequence
 0:?     Sequence
 0:6      Branch: Return with expression
 0:6      Branch: Return with expression
 0:6        texture ( temp 4-component vector of float)
 0:6        texture ( temp 4-component vector of float)
 0:6          Construct combined texture-sampler ( temp sampler2D)
 0:6          Construct combined texture-sampler ( temp sampler2D)
-0:?             'tex.tex' ( in texture2D)
-0:?             'tex.smpl' ( in sampler)
+0:6            tex: direct index for structure ( temp texture2D)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex})
+0:6              Constant:
+0:6                1 (const int)
+0:6            smpl: direct index for structure ( temp sampler)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex})
+0:6              Constant:
+0:6                0 (const int)
 0:?           Constant:
 0:?           Constant:
 0:?             0.300000
 0:?             0.300000
 0:?             0.400000
 0:?             0.400000
@@ -125,10 +108,16 @@ Shader version: 500
 0:10    Function Parameters: 
 0:10    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
 0:12      move second child to first child ( temp sampler)
 0:12      move second child to first child ( temp sampler)
-0:?         't.smpl' ( temp sampler)
+0:12        smpl: direct index for structure ( temp sampler)
+0:12          't' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:12          Constant:
+0:12            0 (const int)
 0:12        'g_tInputTexture_sampler' ( uniform sampler)
 0:12        'g_tInputTexture_sampler' ( uniform sampler)
 0:13      move second child to first child ( temp texture2D)
 0:13      move second child to first child ( temp texture2D)
-0:?         't.tex' ( temp texture2D)
+0:13        tex: direct index for structure ( temp texture2D)
+0:13          't' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:13          Constant:
+0:13            1 (const int)
 0:13        'g_tInputTexture' ( uniform texture2D)
 0:13        'g_tInputTexture' ( uniform texture2D)
 0:14      Branch: Return with expression
 0:14      Branch: Return with expression
 0:14        't' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:14        't' ( temp structure{ temp sampler smpl,  temp texture2D tex})
@@ -136,67 +125,34 @@ Shader version: 500
 0:18    Function Parameters: 
 0:18    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
 0:19      Sequence
 0:19      Sequence
-0:19        Sequence
-0:19          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:19            'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:19            Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:19              'g_tInputTexture_sampler' ( uniform sampler)
-0:19              'g_tInputTexture' ( uniform texture2D)
-0:19          move second child to first child ( temp sampler)
-0:?             'tex1.smpl' ( temp sampler)
-0:19            smpl: direct index for structure ( temp sampler)
-0:19              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:19              Constant:
-0:19                0 (const int)
-0:19          move second child to first child ( temp texture2D)
-0:?             'tex1.tex' ( temp texture2D)
-0:19            tex: direct index for structure ( temp texture2D)
-0:19              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:19              Constant:
-0:19                1 (const int)
+0:19        move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19          'tex1' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19          Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19            'g_tInputTexture_sampler' ( uniform sampler)
+0:19            'g_tInputTexture' ( uniform texture2D)
 0:20      Sequence
 0:20      Sequence
 0:20        move second child to first child ( temp 4-component vector of float)
 0:20        move second child to first child ( temp 4-component vector of float)
 0:20          'res' ( temp 4-component vector of float)
 0:20          'res' ( temp 4-component vector of float)
 0:20          Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
 0:20          Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
-0:?             'tex1.smpl' ( temp sampler)
-0:?             'tex1.tex' ( temp texture2D)
+0:20            'tex1' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:21      Sequence
 0:21      Sequence
-0:21        Sequence
-0:21          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:21            'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:21            Function Call: fillOpaque( ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:21          move second child to first child ( temp sampler)
-0:?             'tex2.smpl' ( temp sampler)
-0:21            smpl: direct index for structure ( temp sampler)
-0:21              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:21              Constant:
-0:21                0 (const int)
-0:21          move second child to first child ( temp texture2D)
-0:?             'tex2.tex' ( temp texture2D)
-0:21            tex: direct index for structure ( temp texture2D)
-0:21              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
-0:21              Constant:
-0:21                1 (const int)
+0:21        move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:21          'tex2' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:21          Function Call: fillOpaque( ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:22      add second child into first child ( temp 4-component vector of float)
 0:22      add second child into first child ( temp 4-component vector of float)
 0:22        'res' ( temp 4-component vector of float)
 0:22        'res' ( temp 4-component vector of float)
 0:22        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
 0:22        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
-0:?           'tex2.smpl' ( temp sampler)
-0:?           'tex2.tex' ( temp texture2D)
+0:22          'tex2' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:23      Sequence
 0:23      Sequence
-0:23        Sequence
-0:23          move second child to first child ( temp sampler)
-0:?             'tex3.smpl' ( temp sampler)
-0:?             'tex1.smpl' ( temp sampler)
-0:23          move second child to first child ( temp texture2D)
-0:?             'tex3.tex' ( temp texture2D)
-0:?             'tex1.tex' ( temp texture2D)
+0:23        move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:23          'tex3' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:23          'tex1' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:24      add second child into first child ( temp 4-component vector of float)
 0:24      add second child into first child ( temp 4-component vector of float)
 0:24        'res' ( temp 4-component vector of float)
 0:24        'res' ( temp 4-component vector of float)
 0:24        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
 0:24        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
-0:?           'tex3.smpl' ( temp sampler)
-0:?           'tex3.tex' ( temp texture2D)
-0:25      Branch: Return with expression
-0:25        'res' ( temp 4-component vector of float)
+0:24          'tex3' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:26      Branch: Return with expression
+0:26        'res' ( temp 4-component vector of float)
 0:18  Function Definition: main( ( temp void)
 0:18  Function Definition: main( ( temp void)
 0:18    Function Parameters: 
 0:18    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
@@ -210,164 +166,126 @@ Shader version: 500
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 101
+// Id's are bound by 82
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 99
+                              EntryPoint Vertex 4  "main" 80
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
-                              Name 15  "lookUp(struct-FxaaTex-p1-t211;"
-                              Name 13  "tex.smpl"
-                              Name 14  "tex.tex"
-                              Name 17  "FxaaTex"
-                              MemberName 17(FxaaTex) 0  "smpl"
-                              MemberName 17(FxaaTex) 1  "tex"
-                              Name 19  "fillOpaque("
-                              Name 22  "@main("
-                              Name 36  "t.smpl"
-                              Name 38  "g_tInputTexture_sampler"
-                              Name 40  "t.tex"
-                              Name 42  "g_tInputTexture"
-                              Name 45  "t"
-                              Name 49  "flattenTemp"
-                              Name 53  "tex1.smpl"
-                              Name 58  "tex1.tex"
-                              Name 63  "res"
+                              Name 9  "FxaaTex"
+                              MemberName 9(FxaaTex) 0  "smpl"
+                              MemberName 9(FxaaTex) 1  "tex"
+                              Name 14  "lookUp(struct-FxaaTex-p1-t211;"
+                              Name 13  "tex"
+                              Name 17  "fillOpaque("
+                              Name 20  "@main("
+                              Name 41  "t"
+                              Name 43  "g_tInputTexture_sampler"
+                              Name 47  "g_tInputTexture"
+                              Name 53  "tex1"
+                              Name 58  "res"
+                              Name 59  "param"
+                              Name 62  "tex2"
                               Name 64  "param"
                               Name 64  "param"
-                              Name 66  "param"
-                              Name 69  "flattenTemp"
-                              Name 71  "tex2.smpl"
-                              Name 74  "tex2.tex"
-                              Name 77  "param"
-                              Name 79  "param"
-                              Name 84  "tex3.smpl"
-                              Name 86  "tex3.tex"
-                              Name 88  "param"
-                              Name 90  "param"
-                              Name 99  "@entryPointOutput"
-                              Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
-                              Decorate 42(g_tInputTexture) DescriptorSet 0
-                              Decorate 99(@entryPointOutput) Location 0
+                              Name 69  "tex3"
+                              Name 71  "param"
+                              Name 80  "@entryPointOutput"
+                              Decorate 43(g_tInputTexture_sampler) DescriptorSet 0
+                              Decorate 47(g_tInputTexture) DescriptorSet 0
+                              Decorate 80(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeSampler
                6:             TypeSampler
-               7:             TypePointer Function 6
-               8:             TypeFloat 32
-               9:             TypeImage 8(float) 2D sampled format:Unknown
-              10:             TypePointer Function 9
-              11:             TypeVector 8(float) 4
-              12:             TypeFunction 11(fvec4) 7(ptr) 10(ptr)
-     17(FxaaTex):             TypeStruct 6 9
-              18:             TypeFunction 17(FxaaTex)
-              21:             TypeFunction 11(fvec4)
-              26:             TypeSampledImage 9
-              28:             TypeVector 8(float) 2
-              29:    8(float) Constant 1050253722
-              30:    8(float) Constant 1053609165
-              31:   28(fvec2) ConstantComposite 29 30
-              32:    8(float) Constant 0
-              37:             TypePointer UniformConstant 6
-38(g_tInputTexture_sampler):     37(ptr) Variable UniformConstant
-              41:             TypePointer UniformConstant 9
-42(g_tInputTexture):     41(ptr) Variable UniformConstant
-              44:             TypePointer Function 17(FxaaTex)
-              54:             TypeInt 32 1
-              55:     54(int) Constant 0
-              59:     54(int) Constant 1
-              62:             TypePointer Function 11(fvec4)
-              98:             TypePointer Output 11(fvec4)
-99(@entryPointOutput):     98(ptr) Variable Output
+               7:             TypeFloat 32
+               8:             TypeImage 7(float) 2D sampled format:Unknown
+      9(FxaaTex):             TypeStruct 6 8
+              10:             TypePointer Function 9(FxaaTex)
+              11:             TypeVector 7(float) 4
+              12:             TypeFunction 11(fvec4) 10(ptr)
+              16:             TypeFunction 9(FxaaTex)
+              19:             TypeFunction 11(fvec4)
+              22:             TypeInt 32 1
+              23:     22(int) Constant 1
+              24:             TypePointer Function 8
+              27:     22(int) Constant 0
+              28:             TypePointer Function 6
+              31:             TypeSampledImage 8
+              33:             TypeVector 7(float) 2
+              34:    7(float) Constant 1050253722
+              35:    7(float) Constant 1053609165
+              36:   33(fvec2) ConstantComposite 34 35
+              37:    7(float) Constant 0
+              42:             TypePointer UniformConstant 6
+43(g_tInputTexture_sampler):     42(ptr) Variable UniformConstant
+              46:             TypePointer UniformConstant 8
+47(g_tInputTexture):     46(ptr) Variable UniformConstant
+              57:             TypePointer Function 11(fvec4)
+              79:             TypePointer Output 11(fvec4)
+80(@entryPointOutput):     79(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-             100:   11(fvec4) FunctionCall 22(@main()
-                              Store 99(@entryPointOutput) 100
+              81:   11(fvec4) FunctionCall 20(@main()
+                              Store 80(@entryPointOutput) 81
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
-15(lookUp(struct-FxaaTex-p1-t211;):   11(fvec4) Function None 12
-    13(tex.smpl):      7(ptr) FunctionParameter
-     14(tex.tex):     10(ptr) FunctionParameter
-              16:             Label
-              24:           9 Load 14(tex.tex)
-              25:           6 Load 13(tex.smpl)
-              27:          26 SampledImage 24 25
-              33:   11(fvec4) ImageSampleExplicitLod 27 31 Lod 32
-                              ReturnValue 33
+14(lookUp(struct-FxaaTex-p1-t211;):   11(fvec4) Function None 12
+         13(tex):     10(ptr) FunctionParameter
+              15:             Label
+              25:     24(ptr) AccessChain 13(tex) 23
+              26:           8 Load 25
+              29:     28(ptr) AccessChain 13(tex) 27
+              30:           6 Load 29
+              32:          31 SampledImage 26 30
+              38:   11(fvec4) ImageSampleExplicitLod 32 36 Lod 37
+                              ReturnValue 38
                               FunctionEnd
                               FunctionEnd
- 19(fillOpaque(): 17(FxaaTex) Function None 18
-              20:             Label
-      36(t.smpl):      7(ptr) Variable Function
-       40(t.tex):     10(ptr) Variable Function
-           45(t):     44(ptr) Variable Function
-              39:           6 Load 38(g_tInputTexture_sampler)
-                              Store 36(t.smpl) 39
-              43:           9 Load 42(g_tInputTexture)
-                              Store 40(t.tex) 43
-              46: 17(FxaaTex) Load 45(t)
-                              ReturnValue 46
+ 17(fillOpaque():  9(FxaaTex) Function None 16
+              18:             Label
+           41(t):     10(ptr) Variable Function
+              44:           6 Load 43(g_tInputTexture_sampler)
+              45:     28(ptr) AccessChain 41(t) 27
+                              Store 45 44
+              48:           8 Load 47(g_tInputTexture)
+              49:     24(ptr) AccessChain 41(t) 23
+                              Store 49 48
+              50:  9(FxaaTex) Load 41(t)
+                              ReturnValue 50
                               FunctionEnd
                               FunctionEnd
-      22(@main():   11(fvec4) Function None 21
-              23:             Label
- 49(flattenTemp):     44(ptr) Variable Function
-   53(tex1.smpl):      7(ptr) Variable Function
-    58(tex1.tex):     10(ptr) Variable Function
-         63(res):     62(ptr) Variable Function
-       64(param):      7(ptr) Variable Function
-       66(param):     10(ptr) Variable Function
- 69(flattenTemp):     44(ptr) Variable Function
-   71(tex2.smpl):      7(ptr) Variable Function
-    74(tex2.tex):     10(ptr) Variable Function
-       77(param):      7(ptr) Variable Function
-       79(param):     10(ptr) Variable Function
-   84(tex3.smpl):      7(ptr) Variable Function
-    86(tex3.tex):     10(ptr) Variable Function
-       88(param):      7(ptr) Variable Function
-       90(param):     10(ptr) Variable Function
-              50:           6 Load 38(g_tInputTexture_sampler)
-              51:           9 Load 42(g_tInputTexture)
-              52: 17(FxaaTex) CompositeConstruct 50 51
-                              Store 49(flattenTemp) 52
-              56:      7(ptr) AccessChain 49(flattenTemp) 55
-              57:           6 Load 56
-                              Store 53(tex1.smpl) 57
-              60:     10(ptr) AccessChain 49(flattenTemp) 59
-              61:           9 Load 60
-                              Store 58(tex1.tex) 61
-              65:           6 Load 53(tex1.smpl)
+      20(@main():   11(fvec4) Function None 19
+              21:             Label
+        53(tex1):     10(ptr) Variable Function
+         58(res):     57(ptr) Variable Function
+       59(param):     10(ptr) Variable Function
+        62(tex2):     10(ptr) Variable Function
+       64(param):     10(ptr) Variable Function
+        69(tex3):     10(ptr) Variable Function
+       71(param):     10(ptr) Variable Function
+              54:           6 Load 43(g_tInputTexture_sampler)
+              55:           8 Load 47(g_tInputTexture)
+              56:  9(FxaaTex) CompositeConstruct 54 55
+                              Store 53(tex1) 56
+              60:  9(FxaaTex) Load 53(tex1)
+                              Store 59(param) 60
+              61:   11(fvec4) FunctionCall 14(lookUp(struct-FxaaTex-p1-t211;) 59(param)
+                              Store 58(res) 61
+              63:  9(FxaaTex) FunctionCall 17(fillOpaque()
+                              Store 62(tex2) 63
+              65:  9(FxaaTex) Load 62(tex2)
                               Store 64(param) 65
                               Store 64(param) 65
-              67:           9 Load 58(tex1.tex)
-                              Store 66(param) 67
-              68:   11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 64(param) 66(param)
-                              Store 63(res) 68
-              70: 17(FxaaTex) FunctionCall 19(fillOpaque()
-                              Store 69(flattenTemp) 70
-              72:      7(ptr) AccessChain 69(flattenTemp) 55
-              73:           6 Load 72
-                              Store 71(tex2.smpl) 73
-              75:     10(ptr) AccessChain 69(flattenTemp) 59
-              76:           9 Load 75
-                              Store 74(tex2.tex) 76
-              78:           6 Load 71(tex2.smpl)
-                              Store 77(param) 78
-              80:           9 Load 74(tex2.tex)
-                              Store 79(param) 80
-              81:   11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 77(param) 79(param)
-              82:   11(fvec4) Load 63(res)
-              83:   11(fvec4) FAdd 82 81
-                              Store 63(res) 83
-              85:           6 Load 53(tex1.smpl)
-                              Store 84(tex3.smpl) 85
-              87:           9 Load 58(tex1.tex)
-                              Store 86(tex3.tex) 87
-              89:           6 Load 84(tex3.smpl)
-                              Store 88(param) 89
-              91:           9 Load 86(tex3.tex)
-                              Store 90(param) 91
-              92:   11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 88(param) 90(param)
-              93:   11(fvec4) Load 63(res)
-              94:   11(fvec4) FAdd 93 92
-                              Store 63(res) 94
-              95:   11(fvec4) Load 63(res)
-                              ReturnValue 95
+              66:   11(fvec4) FunctionCall 14(lookUp(struct-FxaaTex-p1-t211;) 64(param)
+              67:   11(fvec4) Load 58(res)
+              68:   11(fvec4) FAdd 67 66
+                              Store 58(res) 68
+              70:  9(FxaaTex) Load 53(tex1)
+                              Store 69(tex3) 70
+              72:  9(FxaaTex) Load 69(tex3)
+                              Store 71(param) 72
+              73:   11(fvec4) FunctionCall 14(lookUp(struct-FxaaTex-p1-t211;) 71(param)
+              74:   11(fvec4) Load 58(res)
+              75:   11(fvec4) FAdd 74 73
+                              Store 58(res) 75
+              76:   11(fvec4) Load 58(res)
+                              ReturnValue 76
                               FunctionEnd
                               FunctionEnd

+ 120 - 165
3rdparty/glslang/Test/baseResults/hlsl.flattenOpaqueInitMix.vert.out

@@ -4,53 +4,42 @@ Shader version: 500
 0:? Sequence
 0:? Sequence
 0:5  Function Definition: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float)
 0:5  Function Definition: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float)
 0:5    Function Parameters: 
 0:5    Function Parameters: 
-0:?       'tex.smpl' ( in sampler)
-0:?       'tex.tex' ( in texture2D)
-0:?       'tex.f' ( in float)
+0:5      'tex' ( in structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
 0:?     Sequence
 0:?     Sequence
 0:6      Branch: Return with expression
 0:6      Branch: Return with expression
 0:6        texture ( temp 4-component vector of float)
 0:6        texture ( temp 4-component vector of float)
 0:6          Construct combined texture-sampler ( temp sampler2D)
 0:6          Construct combined texture-sampler ( temp sampler2D)
-0:?             'tex.tex' ( in texture2D)
-0:?             'tex.smpl' ( in sampler)
+0:6            tex: direct index for structure ( temp texture2D)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:6              Constant:
+0:6                1 (const int)
+0:6            smpl: direct index for structure ( temp sampler)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:6              Constant:
+0:6                0 (const int)
 0:?           Construct vec2 ( temp 2-component vector of float)
 0:?           Construct vec2 ( temp 2-component vector of float)
-0:?             'tex.f' ( in float)
-0:?             'tex.f' ( in float)
+0:6            f: direct index for structure ( temp float)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:6              Constant:
+0:6                2 (const int)
+0:6            f: direct index for structure ( temp float)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:6              Constant:
+0:6                2 (const int)
 0:10  Function Definition: @main( ( temp 4-component vector of float)
 0:10  Function Definition: @main( ( temp 4-component vector of float)
 0:10    Function Parameters: 
 0:10    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
 0:11      Sequence
 0:11      Sequence
-0:11        Sequence
-0:11          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11            'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11            Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11              'g_tInputTexture_sampler' ( uniform sampler)
-0:11              'g_tInputTexture' ( uniform texture2D)
-0:11              Constant:
-0:11                0.500000
-0:11          move second child to first child ( temp sampler)
-0:?             'tex.smpl' ( temp sampler)
-0:11            smpl: direct index for structure ( temp sampler)
-0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11              Constant:
-0:11                0 (const int)
-0:11          move second child to first child ( temp texture2D)
-0:?             'tex.tex' ( temp texture2D)
-0:11            tex: direct index for structure ( temp texture2D)
-0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11              Constant:
-0:11                1 (const int)
-0:11          move second child to first child ( temp float)
-0:?             'tex.f' ( temp float)
-0:11            f: direct index for structure ( temp float)
-0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11              Constant:
-0:11                2 (const int)
+0:11        move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11          'tex' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11          Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11            'g_tInputTexture_sampler' ( uniform sampler)
+0:11            'g_tInputTexture' ( uniform texture2D)
+0:11            Constant:
+0:11              0.500000
 0:12      Branch: Return with expression
 0:12      Branch: Return with expression
 0:12        Function Call: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float)
 0:12        Function Call: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float)
-0:?           'tex.smpl' ( temp sampler)
-0:?           'tex.tex' ( temp texture2D)
-0:?           'tex.f' ( temp float)
+0:12          'tex' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
 0:10  Function Definition: main( ( temp void)
 0:10  Function Definition: main( ( temp void)
 0:10    Function Parameters: 
 0:10    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
@@ -70,53 +59,42 @@ Shader version: 500
 0:? Sequence
 0:? Sequence
 0:5  Function Definition: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float)
 0:5  Function Definition: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float)
 0:5    Function Parameters: 
 0:5    Function Parameters: 
-0:?       'tex.smpl' ( in sampler)
-0:?       'tex.tex' ( in texture2D)
-0:?       'tex.f' ( in float)
+0:5      'tex' ( in structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
 0:?     Sequence
 0:?     Sequence
 0:6      Branch: Return with expression
 0:6      Branch: Return with expression
 0:6        texture ( temp 4-component vector of float)
 0:6        texture ( temp 4-component vector of float)
 0:6          Construct combined texture-sampler ( temp sampler2D)
 0:6          Construct combined texture-sampler ( temp sampler2D)
-0:?             'tex.tex' ( in texture2D)
-0:?             'tex.smpl' ( in sampler)
+0:6            tex: direct index for structure ( temp texture2D)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:6              Constant:
+0:6                1 (const int)
+0:6            smpl: direct index for structure ( temp sampler)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:6              Constant:
+0:6                0 (const int)
 0:?           Construct vec2 ( temp 2-component vector of float)
 0:?           Construct vec2 ( temp 2-component vector of float)
-0:?             'tex.f' ( in float)
-0:?             'tex.f' ( in float)
+0:6            f: direct index for structure ( temp float)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:6              Constant:
+0:6                2 (const int)
+0:6            f: direct index for structure ( temp float)
+0:6              'tex' ( in structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:6              Constant:
+0:6                2 (const int)
 0:10  Function Definition: @main( ( temp 4-component vector of float)
 0:10  Function Definition: @main( ( temp 4-component vector of float)
 0:10    Function Parameters: 
 0:10    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
 0:11      Sequence
 0:11      Sequence
-0:11        Sequence
-0:11          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11            'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11            Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11              'g_tInputTexture_sampler' ( uniform sampler)
-0:11              'g_tInputTexture' ( uniform texture2D)
-0:11              Constant:
-0:11                0.500000
-0:11          move second child to first child ( temp sampler)
-0:?             'tex.smpl' ( temp sampler)
-0:11            smpl: direct index for structure ( temp sampler)
-0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11              Constant:
-0:11                0 (const int)
-0:11          move second child to first child ( temp texture2D)
-0:?             'tex.tex' ( temp texture2D)
-0:11            tex: direct index for structure ( temp texture2D)
-0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11              Constant:
-0:11                1 (const int)
-0:11          move second child to first child ( temp float)
-0:?             'tex.f' ( temp float)
-0:11            f: direct index for structure ( temp float)
-0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
-0:11              Constant:
-0:11                2 (const int)
+0:11        move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11          'tex' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11          Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11            'g_tInputTexture_sampler' ( uniform sampler)
+0:11            'g_tInputTexture' ( uniform texture2D)
+0:11            Constant:
+0:11              0.500000
 0:12      Branch: Return with expression
 0:12      Branch: Return with expression
 0:12        Function Call: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float)
 0:12        Function Call: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float)
-0:?           'tex.smpl' ( temp sampler)
-0:?           'tex.tex' ( temp texture2D)
-0:?           'tex.f' ( temp float)
+0:12          'tex' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
 0:10  Function Definition: main( ( temp void)
 0:10  Function Definition: main( ( temp void)
 0:10    Function Parameters: 
 0:10    Function Parameters: 
 0:?     Sequence
 0:?     Sequence
@@ -130,111 +108,88 @@ Shader version: 500
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 70
+// Id's are bound by 59
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 68
+                              EntryPoint Vertex 4  "main" 57
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
-                              Name 17  "lookUp(struct-FxaaTex-p1-t21-f11;"
-                              Name 14  "tex.smpl"
-                              Name 15  "tex.tex"
-                              Name 16  "tex.f"
-                              Name 20  "@main("
-                              Name 34  "FxaaTex"
-                              MemberName 34(FxaaTex) 0  "smpl"
-                              MemberName 34(FxaaTex) 1  "tex"
-                              MemberName 34(FxaaTex) 2  "f"
-                              Name 36  "flattenTemp"
-                              Name 38  "g_tInputTexture_sampler"
-                              Name 41  "g_tInputTexture"
-                              Name 45  "tex.smpl"
-                              Name 50  "tex.tex"
-                              Name 54  "tex.f"
-                              Name 58  "param"
-                              Name 60  "param"
-                              Name 62  "param"
-                              Name 68  "@entryPointOutput"
-                              Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
-                              Decorate 41(g_tInputTexture) DescriptorSet 0
-                              Decorate 68(@entryPointOutput) Location 0
+                              Name 9  "FxaaTex"
+                              MemberName 9(FxaaTex) 0  "smpl"
+                              MemberName 9(FxaaTex) 1  "tex"
+                              MemberName 9(FxaaTex) 2  "f"
+                              Name 14  "lookUp(struct-FxaaTex-p1-t21-f11;"
+                              Name 13  "tex"
+                              Name 17  "@main("
+                              Name 42  "tex"
+                              Name 44  "g_tInputTexture_sampler"
+                              Name 47  "g_tInputTexture"
+                              Name 51  "param"
+                              Name 57  "@entryPointOutput"
+                              Decorate 44(g_tInputTexture_sampler) DescriptorSet 0
+                              Decorate 47(g_tInputTexture) DescriptorSet 0
+                              Decorate 57(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeSampler
                6:             TypeSampler
-               7:             TypePointer Function 6
-               8:             TypeFloat 32
-               9:             TypeImage 8(float) 2D sampled format:Unknown
-              10:             TypePointer Function 9
-              11:             TypePointer Function 8(float)
-              12:             TypeVector 8(float) 4
-              13:             TypeFunction 12(fvec4) 7(ptr) 10(ptr) 11(ptr)
-              19:             TypeFunction 12(fvec4)
-              24:             TypeSampledImage 9
-              28:             TypeVector 8(float) 2
-              30:    8(float) Constant 0
-     34(FxaaTex):             TypeStruct 6 9 8(float)
-              35:             TypePointer Function 34(FxaaTex)
-              37:             TypePointer UniformConstant 6
-38(g_tInputTexture_sampler):     37(ptr) Variable UniformConstant
-              40:             TypePointer UniformConstant 9
-41(g_tInputTexture):     40(ptr) Variable UniformConstant
-              43:    8(float) Constant 1056964608
-              46:             TypeInt 32 1
-              47:     46(int) Constant 0
-              51:     46(int) Constant 1
-              55:     46(int) Constant 2
-              67:             TypePointer Output 12(fvec4)
-68(@entryPointOutput):     67(ptr) Variable Output
+               7:             TypeFloat 32
+               8:             TypeImage 7(float) 2D sampled format:Unknown
+      9(FxaaTex):             TypeStruct 6 8 7(float)
+              10:             TypePointer Function 9(FxaaTex)
+              11:             TypeVector 7(float) 4
+              12:             TypeFunction 11(fvec4) 10(ptr)
+              16:             TypeFunction 11(fvec4)
+              19:             TypeInt 32 1
+              20:     19(int) Constant 1
+              21:             TypePointer Function 8
+              24:     19(int) Constant 0
+              25:             TypePointer Function 6
+              28:             TypeSampledImage 8
+              30:     19(int) Constant 2
+              31:             TypePointer Function 7(float)
+              36:             TypeVector 7(float) 2
+              38:    7(float) Constant 0
+              43:             TypePointer UniformConstant 6
+44(g_tInputTexture_sampler):     43(ptr) Variable UniformConstant
+              46:             TypePointer UniformConstant 8
+47(g_tInputTexture):     46(ptr) Variable UniformConstant
+              49:    7(float) Constant 1056964608
+              56:             TypePointer Output 11(fvec4)
+57(@entryPointOutput):     56(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-              69:   12(fvec4) FunctionCall 20(@main()
-                              Store 68(@entryPointOutput) 69
+              58:   11(fvec4) FunctionCall 17(@main()
+                              Store 57(@entryPointOutput) 58
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
-17(lookUp(struct-FxaaTex-p1-t21-f11;):   12(fvec4) Function None 13
-    14(tex.smpl):      7(ptr) FunctionParameter
-     15(tex.tex):     10(ptr) FunctionParameter
-       16(tex.f):     11(ptr) FunctionParameter
-              18:             Label
-              22:           9 Load 15(tex.tex)
-              23:           6 Load 14(tex.smpl)
-              25:          24 SampledImage 22 23
-              26:    8(float) Load 16(tex.f)
-              27:    8(float) Load 16(tex.f)
-              29:   28(fvec2) CompositeConstruct 26 27
-              31:   12(fvec4) ImageSampleExplicitLod 25 29 Lod 30
-                              ReturnValue 31
+14(lookUp(struct-FxaaTex-p1-t21-f11;):   11(fvec4) Function None 12
+         13(tex):     10(ptr) FunctionParameter
+              15:             Label
+              22:     21(ptr) AccessChain 13(tex) 20
+              23:           8 Load 22
+              26:     25(ptr) AccessChain 13(tex) 24
+              27:           6 Load 26
+              29:          28 SampledImage 23 27
+              32:     31(ptr) AccessChain 13(tex) 30
+              33:    7(float) Load 32
+              34:     31(ptr) AccessChain 13(tex) 30
+              35:    7(float) Load 34
+              37:   36(fvec2) CompositeConstruct 33 35
+              39:   11(fvec4) ImageSampleExplicitLod 29 37 Lod 38
+                              ReturnValue 39
                               FunctionEnd
                               FunctionEnd
-      20(@main():   12(fvec4) Function None 19
-              21:             Label
- 36(flattenTemp):     35(ptr) Variable Function
-    45(tex.smpl):      7(ptr) Variable Function
-     50(tex.tex):     10(ptr) Variable Function
-       54(tex.f):     11(ptr) Variable Function
-       58(param):      7(ptr) Variable Function
-       60(param):     10(ptr) Variable Function
-       62(param):     11(ptr) Variable Function
-              39:           6 Load 38(g_tInputTexture_sampler)
-              42:           9 Load 41(g_tInputTexture)
-              44: 34(FxaaTex) CompositeConstruct 39 42 43
-                              Store 36(flattenTemp) 44
-              48:      7(ptr) AccessChain 36(flattenTemp) 47
-              49:           6 Load 48
-                              Store 45(tex.smpl) 49
-              52:     10(ptr) AccessChain 36(flattenTemp) 51
-              53:           9 Load 52
-                              Store 50(tex.tex) 53
-              56:     11(ptr) AccessChain 36(flattenTemp) 55
-              57:    8(float) Load 56
-                              Store 54(tex.f) 57
-              59:           6 Load 45(tex.smpl)
-                              Store 58(param) 59
-              61:           9 Load 50(tex.tex)
-                              Store 60(param) 61
-              63:    8(float) Load 54(tex.f)
-                              Store 62(param) 63
-              64:   12(fvec4) FunctionCall 17(lookUp(struct-FxaaTex-p1-t21-f11;) 58(param) 60(param) 62(param)
-                              ReturnValue 64
+      17(@main():   11(fvec4) Function None 16
+              18:             Label
+         42(tex):     10(ptr) Variable Function
+       51(param):     10(ptr) Variable Function
+              45:           6 Load 44(g_tInputTexture_sampler)
+              48:           8 Load 47(g_tInputTexture)
+              50:  9(FxaaTex) CompositeConstruct 45 48 49
+                              Store 42(tex) 50
+              52:  9(FxaaTex) Load 42(tex)
+                              Store 51(param) 52
+              53:   11(fvec4) FunctionCall 14(lookUp(struct-FxaaTex-p1-t21-f11;) 51(param)
+                              ReturnValue 53
                               FunctionEnd
                               FunctionEnd

+ 120 - 122
3rdparty/glslang/Test/baseResults/hlsl.flattenSubset.frag.out

@@ -8,32 +8,34 @@ gl_FragCoord origin is upper left
 0:30      'vpos' ( in 4-component vector of float)
 0:30      'vpos' ( in 4-component vector of float)
 0:?     Sequence
 0:?     Sequence
 0:33      move second child to first child ( temp sampler)
 0:33      move second child to first child ( temp sampler)
-0:?         's1.s0.ss' ( temp sampler)
+0:33        ss: direct index for structure ( temp sampler)
+0:33          s0: direct index for structure ( temp structure{ temp int x,  temp int y,  temp sampler ss})
+0:33            's1' ( temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a})
+0:33            Constant:
+0:33              2 (const int)
+0:33          Constant:
+0:33            2 (const int)
 0:33        'samp' ( uniform 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:34      move second child to first child ( temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a})
+0:34        resources: direct index for structure ( temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a})
+0:34          's2' ( temp structure{ temp int a1,  temp int a2,  temp int a3,  temp int a4,  temp int a5,  temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a} resources})
+0:34          Constant:
+0:34            5 (const int)
+0:34        's1' ( temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a})
 0:35      Branch: Return with expression
 0:35      Branch: Return with expression
 0:35        texture ( temp 4-component vector of float)
 0:35        texture ( temp 4-component vector of float)
 0:35          Construct combined texture-sampler ( temp sampler2D)
 0:35          Construct combined texture-sampler ( temp sampler2D)
 0:35            'tex' ( uniform texture2D)
 0:35            'tex' ( uniform texture2D)
-0:?             's2.resources.s0.ss' ( temp sampler)
+0:35            ss: direct index for structure ( temp sampler)
+0:35              s0: direct index for structure ( temp structure{ temp int x,  temp int y,  temp sampler ss})
+0:35                resources: direct index for structure ( temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a})
+0:35                  's2' ( temp structure{ temp int a1,  temp int a2,  temp int a3,  temp int a4,  temp int a5,  temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a} resources})
+0:35                  Constant:
+0:35                    5 (const int)
+0:35                Constant:
+0:35                  2 (const int)
+0:35              Constant:
+0:35                2 (const int)
 0:35          Constant:
 0:35          Constant:
 0:35            0.500000
 0:35            0.500000
 0:35            0.500000
 0:35            0.500000
@@ -65,32 +67,34 @@ gl_FragCoord origin is upper left
 0:30      'vpos' ( in 4-component vector of float)
 0:30      'vpos' ( in 4-component vector of float)
 0:?     Sequence
 0:?     Sequence
 0:33      move second child to first child ( temp sampler)
 0:33      move second child to first child ( temp sampler)
-0:?         's1.s0.ss' ( temp sampler)
+0:33        ss: direct index for structure ( temp sampler)
+0:33          s0: direct index for structure ( temp structure{ temp int x,  temp int y,  temp sampler ss})
+0:33            's1' ( temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a})
+0:33            Constant:
+0:33              2 (const int)
+0:33          Constant:
+0:33            2 (const int)
 0:33        'samp' ( uniform 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:34      move second child to first child ( temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a})
+0:34        resources: direct index for structure ( temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a})
+0:34          's2' ( temp structure{ temp int a1,  temp int a2,  temp int a3,  temp int a4,  temp int a5,  temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a} resources})
+0:34          Constant:
+0:34            5 (const int)
+0:34        's1' ( temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a})
 0:35      Branch: Return with expression
 0:35      Branch: Return with expression
 0:35        texture ( temp 4-component vector of float)
 0:35        texture ( temp 4-component vector of float)
 0:35          Construct combined texture-sampler ( temp sampler2D)
 0:35          Construct combined texture-sampler ( temp sampler2D)
 0:35            'tex' ( uniform texture2D)
 0:35            'tex' ( uniform texture2D)
-0:?             's2.resources.s0.ss' ( temp sampler)
+0:35            ss: direct index for structure ( temp sampler)
+0:35              s0: direct index for structure ( temp structure{ temp int x,  temp int y,  temp sampler ss})
+0:35                resources: direct index for structure ( temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a})
+0:35                  's2' ( temp structure{ temp int a1,  temp int a2,  temp int a3,  temp int a4,  temp int a5,  temp structure{ temp float b,  temp sampler samplerState,  temp structure{ temp int x,  temp int y,  temp sampler ss} s0,  temp int a} resources})
+0:35                  Constant:
+0:35                    5 (const int)
+0:35                Constant:
+0:35                  2 (const int)
+0:35              Constant:
+0:35                2 (const int)
 0:35          Constant:
 0:35          Constant:
 0:35            0.500000
 0:35            0.500000
 0:35            0.500000
 0:35            0.500000
@@ -112,39 +116,45 @@ gl_FragCoord origin is upper left
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 61
+// Id's are bound by 54
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 54 57
+                              EntryPoint Fragment 4  "main" 47 50
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
                               Name 11  "@main(vf4;"
                               Name 11  "@main(vf4;"
                               Name 10  "vpos"
                               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
+                              Name 15  "S0"
+                              MemberName 15(S0) 0  "x"
+                              MemberName 15(S0) 1  "y"
+                              MemberName 15(S0) 2  "ss"
+                              Name 16  "S1"
+                              MemberName 16(S1) 0  "b"
+                              MemberName 16(S1) 1  "samplerState"
+                              MemberName 16(S1) 2  "s0"
+                              MemberName 16(S1) 3  "a"
+                              Name 18  "s1"
+                              Name 21  "samp"
+                              Name 25  "S2"
+                              MemberName 25(S2) 0  "a1"
+                              MemberName 25(S2) 1  "a2"
+                              MemberName 25(S2) 2  "a3"
+                              MemberName 25(S2) 3  "a4"
+                              MemberName 25(S2) 4  "a5"
+                              MemberName 25(S2) 5  "resources"
+                              Name 27  "s2"
+                              Name 33  "tex"
+                              Name 45  "vpos"
+                              Name 47  "vpos"
+                              Name 50  "@entryPointOutput"
+                              Name 51  "param"
+                              Decorate 21(samp) DescriptorSet 0
+                              Decorate 33(tex) DescriptorSet 0
+                              Decorate 47(vpos) Location 0
+                              Decorate 50(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -152,67 +162,55 @@ gl_FragCoord origin is upper left
                8:             TypePointer Function 7(fvec4)
                8:             TypePointer Function 7(fvec4)
                9:             TypeFunction 7(fvec4) 8(ptr)
                9:             TypeFunction 7(fvec4) 8(ptr)
               13:             TypeSampler
               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
+              14:             TypeInt 32 1
+          15(S0):             TypeStruct 14(int) 14(int) 13
+          16(S1):             TypeStruct 6(float) 13 15(S0) 14(int)
+              17:             TypePointer Function 16(S1)
+              19:     14(int) Constant 2
+              20:             TypePointer UniformConstant 13
+        21(samp):     20(ptr) Variable UniformConstant
+              23:             TypePointer Function 13
+          25(S2):             TypeStruct 14(int) 14(int) 14(int) 14(int) 14(int) 16(S1)
+              26:             TypePointer Function 25(S2)
+              28:     14(int) Constant 5
+              31:             TypeImage 6(float) 2D sampled format:Unknown
+              32:             TypePointer UniformConstant 31
+         33(tex):     32(ptr) Variable UniformConstant
+              37:             TypeSampledImage 31
+              39:             TypeVector 6(float) 2
+              40:    6(float) Constant 1056964608
+              41:   39(fvec2) ConstantComposite 40 40
+              46:             TypePointer Input 7(fvec4)
+        47(vpos):     46(ptr) Variable Input
+              49:             TypePointer Output 7(fvec4)
+50(@entryPointOutput):     49(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                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
+        45(vpos):      8(ptr) Variable Function
+       51(param):      8(ptr) Variable Function
+              48:    7(fvec4) Load 47(vpos)
+                              Store 45(vpos) 48
+              52:    7(fvec4) Load 45(vpos)
+                              Store 51(param) 52
+              53:    7(fvec4) FunctionCall 11(@main(vf4;) 51(param)
+                              Store 50(@entryPointOutput) 53
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
   11(@main(vf4;):    7(fvec4) Function None 9
   11(@main(vf4;):    7(fvec4) Function None 9
         10(vpos):      8(ptr) FunctionParameter
         10(vpos):      8(ptr) FunctionParameter
               12:             Label
               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
+          18(s1):     17(ptr) Variable Function
+          27(s2):     26(ptr) Variable Function
+              22:          13 Load 21(samp)
+              24:     23(ptr) AccessChain 18(s1) 19 19
+                              Store 24 22
+              29:      16(S1) Load 18(s1)
+              30:     17(ptr) AccessChain 27(s2) 28
+                              Store 30 29
+              34:          31 Load 33(tex)
+              35:     23(ptr) AccessChain 27(s2) 28 19 19
+              36:          13 Load 35
+              38:          37 SampledImage 34 36
+              42:    7(fvec4) ImageSampleImplicitLod 38 41
+                              ReturnValue 42
                               FunctionEnd
                               FunctionEnd

+ 149 - 108
3rdparty/glslang/Test/baseResults/hlsl.flattenSubset2.frag.out

@@ -7,33 +7,48 @@ gl_FragCoord origin is upper left
 0:8    Function Parameters: 
 0:8    Function Parameters: 
 0:8      'vpos' ( in 4-component vector of float)
 0:8      'vpos' ( in 4-component vector of float)
 0:?     Sequence
 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:13      move second child to first child ( temp structure{ temp float y,  temp texture2D texNested})
+0:13        n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:13          'a1' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp float x})
+0:13          Constant:
+0:13            0 (const int)
+0:13        n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:13          'a2' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp float x})
+0:13          Constant:
+0:13            0 (const int)
+0:14      move second child to first child ( temp structure{ temp float y,  temp texture2D texNested})
+0:14        n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:14          'b' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp texture2D tex})
+0:14          Constant:
+0:14            0 (const int)
+0:14        n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:14          'a1' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp float x})
+0:14          Constant:
+0:14            0 (const int)
 0:17      Sequence
 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:17        move second child to first child ( temp structure{ temp float y,  temp texture2D texNested})
+0:17          'n' ( temp structure{ temp float y,  temp texture2D texNested})
+0:17          n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:17            'b' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp texture2D tex})
+0:17            Constant:
+0:17              0 (const int)
 0:20      move second child to first child ( temp texture2D)
 0:20      move second child to first child ( temp texture2D)
-0:?         'a2.n.texNested' ( temp texture2D)
+0:20        texNested: direct index for structure ( temp texture2D)
+0:20          n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:20            'a2' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp float x})
+0:20            Constant:
+0:20              0 (const int)
+0:20          Constant:
+0:20            1 (const int)
 0:20        'someTex' ( uniform texture2D)
 0:20        'someTex' ( uniform texture2D)
 0:21      move second child to first child ( temp float)
 0:21      move second child to first child ( temp float)
-0:?         'a1.n.y' ( temp float)
+0:21        y: direct index for structure ( temp float)
+0:21          n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:21            'a1' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp float x})
+0:21            Constant:
+0:21              0 (const int)
+0:21          Constant:
+0:21            0 (const int)
 0:21        Constant:
 0:21        Constant:
 0:21          1.000000
 0:21          1.000000
 0:23      Branch: Return with expression
 0:23      Branch: Return with expression
@@ -68,33 +83,48 @@ gl_FragCoord origin is upper left
 0:8    Function Parameters: 
 0:8    Function Parameters: 
 0:8      'vpos' ( in 4-component vector of float)
 0:8      'vpos' ( in 4-component vector of float)
 0:?     Sequence
 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:13      move second child to first child ( temp structure{ temp float y,  temp texture2D texNested})
+0:13        n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:13          'a1' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp float x})
+0:13          Constant:
+0:13            0 (const int)
+0:13        n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:13          'a2' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp float x})
+0:13          Constant:
+0:13            0 (const int)
+0:14      move second child to first child ( temp structure{ temp float y,  temp texture2D texNested})
+0:14        n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:14          'b' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp texture2D tex})
+0:14          Constant:
+0:14            0 (const int)
+0:14        n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:14          'a1' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp float x})
+0:14          Constant:
+0:14            0 (const int)
 0:17      Sequence
 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:17        move second child to first child ( temp structure{ temp float y,  temp texture2D texNested})
+0:17          'n' ( temp structure{ temp float y,  temp texture2D texNested})
+0:17          n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:17            'b' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp texture2D tex})
+0:17            Constant:
+0:17              0 (const int)
 0:20      move second child to first child ( temp texture2D)
 0:20      move second child to first child ( temp texture2D)
-0:?         'a2.n.texNested' ( temp texture2D)
+0:20        texNested: direct index for structure ( temp texture2D)
+0:20          n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:20            'a2' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp float x})
+0:20            Constant:
+0:20              0 (const int)
+0:20          Constant:
+0:20            1 (const int)
 0:20        'someTex' ( uniform texture2D)
 0:20        'someTex' ( uniform texture2D)
 0:21      move second child to first child ( temp float)
 0:21      move second child to first child ( temp float)
-0:?         'a1.n.y' ( temp float)
+0:21        y: direct index for structure ( temp float)
+0:21          n: direct index for structure ( temp structure{ temp float y,  temp texture2D texNested})
+0:21            'a1' ( temp structure{ temp structure{ temp float y,  temp texture2D texNested} n,  temp float x})
+0:21            Constant:
+0:21              0 (const int)
+0:21          Constant:
+0:21            0 (const int)
 0:21        Constant:
 0:21        Constant:
 0:21          1.000000
 0:21          1.000000
 0:23      Branch: Return with expression
 0:23      Branch: Return with expression
@@ -120,88 +150,99 @@ gl_FragCoord origin is upper left
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 47
+// Id's are bound by 56
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 40 43
+                              EntryPoint Fragment 4  "main" 49 52
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
                               Name 11  "@main(vf4;"
                               Name 11  "@main(vf4;"
                               Name 10  "vpos"
                               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
+                              Name 14  "Nested"
+                              MemberName 14(Nested) 0  "y"
+                              MemberName 14(Nested) 1  "texNested"
+                              Name 15  "A"
+                              MemberName 15(A) 0  "n"
+                              MemberName 15(A) 1  "x"
+                              Name 17  "a1"
+                              Name 20  "a2"
+                              Name 25  "B"
+                              MemberName 25(B) 0  "n"
+                              MemberName 25(B) 1  "tex"
+                              Name 27  "b"
+                              Name 31  "n"
+                              Name 36  "someTex"
+                              Name 47  "vpos"
+                              Name 49  "vpos"
+                              Name 52  "@entryPointOutput"
+                              Name 53  "param"
+                              Decorate 36(someTex) DescriptorSet 0
+                              Decorate 49(vpos) Location 0
+                              Decorate 52(@entryPointOutput) Location 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
                7:             TypeVector 6(float) 4
                7:             TypeVector 6(float) 4
                8:             TypePointer Function 7(fvec4)
                8:             TypePointer Function 7(fvec4)
                9:             TypeFunction 7(fvec4) 8(ptr)
                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
+              13:             TypeImage 6(float) 2D sampled format:Unknown
+      14(Nested):             TypeStruct 6(float) 13
+           15(A):             TypeStruct 14(Nested) 6(float)
+              16:             TypePointer Function 15(A)
+              18:             TypeInt 32 1
+              19:     18(int) Constant 0
+              21:             TypePointer Function 14(Nested)
+           25(B):             TypeStruct 14(Nested) 13
+              26:             TypePointer Function 25(B)
+              34:     18(int) Constant 1
+              35:             TypePointer UniformConstant 13
+     36(someTex):     35(ptr) Variable UniformConstant
+              38:             TypePointer Function 13
+              40:    6(float) Constant 1065353216
+              41:             TypePointer Function 6(float)
+              43:    6(float) Constant 0
+              44:    7(fvec4) ConstantComposite 43 43 43 43
+              48:             TypePointer Input 7(fvec4)
+        49(vpos):     48(ptr) Variable Input
+              51:             TypePointer Output 7(fvec4)
+52(@entryPointOutput):     51(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                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
+        47(vpos):      8(ptr) Variable Function
+       53(param):      8(ptr) Variable Function
+              50:    7(fvec4) Load 49(vpos)
+                              Store 47(vpos) 50
+              54:    7(fvec4) Load 47(vpos)
+                              Store 53(param) 54
+              55:    7(fvec4) FunctionCall 11(@main(vf4;) 53(param)
+                              Store 52(@entryPointOutput) 55
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
   11(@main(vf4;):    7(fvec4) Function None 9
   11(@main(vf4;):    7(fvec4) Function None 9
         10(vpos):      8(ptr) FunctionParameter
         10(vpos):      8(ptr) FunctionParameter
               12:             Label
               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
+          17(a1):     16(ptr) Variable Function
+          20(a2):     16(ptr) Variable Function
+           27(b):     26(ptr) Variable Function
+           31(n):     21(ptr) Variable Function
+              22:     21(ptr) AccessChain 20(a2) 19
+              23:  14(Nested) Load 22
+              24:     21(ptr) AccessChain 17(a1) 19
+                              Store 24 23
+              28:     21(ptr) AccessChain 17(a1) 19
+              29:  14(Nested) Load 28
+              30:     21(ptr) AccessChain 27(b) 19
+                              Store 30 29
+              32:     21(ptr) AccessChain 27(b) 19
+              33:  14(Nested) Load 32
+                              Store 31(n) 33
+              37:          13 Load 36(someTex)
+              39:     38(ptr) AccessChain 20(a2) 19 34
+                              Store 39 37
+              42:     41(ptr) AccessChain 17(a1) 19 19
+                              Store 42 40
+                              ReturnValue 44
                               FunctionEnd
                               FunctionEnd

+ 104 - 0
3rdparty/glslang/Test/baseResults/hlsl.layoutOverride.vert.out

@@ -0,0 +1,104 @@
+hlsl.layoutOverride.vert
+Shader version: 500
+0:? Sequence
+0:5  Function Definition: @main( ( temp 4-component vector of float)
+0:5    Function Parameters: 
+0:?     Sequence
+0:6      Branch: Return with expression
+0:6        texture ( temp 4-component vector of float)
+0:6          Construct combined texture-sampler ( temp sampler2D)
+0:6            'tex' (layout( set=2 binding=0) uniform texture2D)
+0:6            'samp' ( uniform sampler)
+0:?           Constant:
+0:?             0.200000
+0:?             0.300000
+0:5  Function Definition: main( ( temp void)
+0:5    Function Parameters: 
+0:?     Sequence
+0:5      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' ( out 4-component vector of float Position)
+0:5        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'tex' (layout( set=2 binding=0) uniform texture2D)
+0:?     'samp' ( uniform sampler)
+0:?     '@entryPointOutput' ( out 4-component vector of float Position)
+
+
+Linked vertex stage:
+
+
+Shader version: 500
+0:? Sequence
+0:5  Function Definition: @main( ( temp 4-component vector of float)
+0:5    Function Parameters: 
+0:?     Sequence
+0:6      Branch: Return with expression
+0:6        texture ( temp 4-component vector of float)
+0:6          Construct combined texture-sampler ( temp sampler2D)
+0:6            'tex' (layout( set=2 binding=0) uniform texture2D)
+0:6            'samp' ( uniform sampler)
+0:?           Constant:
+0:?             0.200000
+0:?             0.300000
+0:5  Function Definition: main( ( temp void)
+0:5    Function Parameters: 
+0:?     Sequence
+0:5      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' ( out 4-component vector of float Position)
+0:5        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'tex' (layout( set=2 binding=0) uniform texture2D)
+0:?     'samp' ( uniform sampler)
+0:?     '@entryPointOutput' ( out 4-component vector of float Position)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 32
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 30
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 9  "@main("
+                              Name 13  "tex"
+                              Name 17  "samp"
+                              Name 30  "@entryPointOutput"
+                              Decorate 13(tex) DescriptorSet 2
+                              Decorate 13(tex) Binding 0
+                              Decorate 17(samp) DescriptorSet 0
+                              Decorate 30(@entryPointOutput) BuiltIn Position
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+              11:             TypeImage 6(float) 2D sampled format:Unknown
+              12:             TypePointer UniformConstant 11
+         13(tex):     12(ptr) Variable UniformConstant
+              15:             TypeSampler
+              16:             TypePointer UniformConstant 15
+        17(samp):     16(ptr) Variable UniformConstant
+              19:             TypeSampledImage 11
+              21:             TypeVector 6(float) 2
+              22:    6(float) Constant 1045220557
+              23:    6(float) Constant 1050253722
+              24:   21(fvec2) ConstantComposite 22 23
+              25:    6(float) Constant 0
+              29:             TypePointer Output 7(fvec4)
+30(@entryPointOutput):     29(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              31:    7(fvec4) FunctionCall 9(@main()
+                              Store 30(@entryPointOutput) 31
+                              Return
+                              FunctionEnd
+       9(@main():    7(fvec4) Function None 8
+              10:             Label
+              14:          11 Load 13(tex)
+              18:          15 Load 17(samp)
+              20:          19 SampledImage 14 18
+              26:    7(fvec4) ImageSampleExplicitLod 20 24 Lod 25
+                              ReturnValue 26
+                              FunctionEnd

+ 7 - 37
3rdparty/glslang/Test/baseResults/hlsl.localStructuredBuffer.comp.out

@@ -1,7 +1,11 @@
 hlsl.localStructuredBuffer.comp
 hlsl.localStructuredBuffer.comp
+ERROR: 0:3: 'block initializer' : buffer aliasing not yet supported 
+ERROR: 1 compilation errors.  No code generated.
+
+
 Shader version: 500
 Shader version: 500
 local_size = (1, 1, 1)
 local_size = (1, 1, 1)
-0:? Sequence
+ERROR: node is still EOpNull!
 0:2  Function Definition: @main( ( temp void)
 0:2  Function Definition: @main( ( temp void)
 0:2    Function Parameters: 
 0:2    Function Parameters: 
 0:2  Function Definition: main( ( temp void)
 0:2  Function Definition: main( ( temp void)
@@ -17,7 +21,7 @@ Linked compute stage:
 
 
 Shader version: 500
 Shader version: 500
 local_size = (1, 1, 1)
 local_size = (1, 1, 1)
-0:? Sequence
+ERROR: node is still EOpNull!
 0:2  Function Definition: @main( ( temp void)
 0:2  Function Definition: @main( ( temp void)
 0:2    Function Parameters: 
 0:2    Function Parameters: 
 0:2  Function Definition: main( ( temp void)
 0:2  Function Definition: main( ( temp void)
@@ -27,38 +31,4 @@ local_size = (1, 1, 1)
 0:?   Linker Objects
 0:?   Linker Objects
 0:?     'srt0' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
 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): 80002
-// 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
+SPIR-V is not generated for failed compile or link

+ 180 - 171
3rdparty/glslang/Test/baseResults/hlsl.partialFlattenLocal.vert.out

@@ -7,11 +7,17 @@ Shader version: 500
 0:12      'pos' ( in 4-component vector of float)
 0:12      'pos' ( in 4-component vector of float)
 0:?     Sequence
 0:?     Sequence
 0:14      move second child to first child ( temp texture2D)
 0:14      move second child to first child ( temp texture2D)
-0:?         'packed.tex' ( temp texture2D)
+0:14        tex: direct index for structure ( temp texture2D)
+0:14          'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:14          Constant:
+0:14            0 (const int)
 0:14        'tex' ( uniform texture2D)
 0:14        'tex' ( uniform texture2D)
 0:15      move second child to first child ( temp 3-component vector of float)
 0:15      move second child to first child ( temp 3-component vector of float)
 0:15        direct index ( temp 3-component vector of float)
 0:15        direct index ( temp 3-component vector of float)
-0:?           'packed.pos' ( temp 3-element array of 3-component vector of float)
+0:15          pos: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:15            'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:15            Constant:
+0:15              1 (const int)
 0:15          Constant:
 0:15          Constant:
 0:15            0 (const int)
 0:15            0 (const int)
 0:?         Constant:
 0:?         Constant:
@@ -20,18 +26,27 @@ Shader version: 500
 0:?           0.000000
 0:?           0.000000
 0:16      move second child to first child ( temp 2-component vector of float)
 0:16      move second child to first child ( temp 2-component vector of float)
 0:16        direct index ( temp 2-component vector of float)
 0:16        direct index ( temp 2-component vector of float)
-0:?           'packed.uv' ( temp 2-element array of 2-component vector of float)
+0:16          uv: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:16            'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:16            Constant:
+0:16              2 (const int)
 0:16          Constant:
 0:16          Constant:
 0:16            0 (const int)
 0:16            0 (const int)
 0:?         Constant:
 0:?         Constant:
 0:?           0.000000
 0:?           0.000000
 0:?           1.000000
 0:?           1.000000
 0:17      move second child to first child ( temp float)
 0:17      move second child to first child ( temp float)
-0:?         'packed.x' ( temp float)
+0:17        x: direct index for structure ( temp float)
+0:17          'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:17          Constant:
+0:17            3 (const int)
 0:17        Constant:
 0:17        Constant:
 0:17          1.000000
 0:17          1.000000
 0:18      move second child to first child ( temp int)
 0:18      move second child to first child ( temp int)
-0:?         'packed.n' ( temp int)
+0:18        n: direct index for structure ( temp int)
+0:18          'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:18          Constant:
+0:18            4 (const int)
 0:18        Constant:
 0:18        Constant:
 0:18          3 (const int)
 0:18          3 (const int)
 0:20      Sequence
 0:20      Sequence
@@ -50,7 +65,10 @@ Shader version: 500
 0:21            add second child into first child ( temp 2-component vector of float)
 0:21            add second child into first child ( temp 2-component vector of float)
 0:21              vector swizzle ( temp 2-component vector of float)
 0:21              vector swizzle ( temp 2-component vector of float)
 0:21                indirect index ( temp 3-component vector of float)
 0:21                indirect index ( temp 3-component vector of float)
-0:?                   'packed.pos' ( temp 3-element array of 3-component vector of float)
+0:21                  pos: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:21                    'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:21                    Constant:
+0:21                      1 (const int)
 0:21                  'i' ( temp int)
 0:21                  'i' ( temp int)
 0:21                Sequence
 0:21                Sequence
 0:21                  Constant:
 0:21                  Constant:
@@ -58,34 +76,27 @@ Shader version: 500
 0:21                  Constant:
 0:21                  Constant:
 0:21                    1 (const int)
 0:21                    1 (const int)
 0:21              indirect index ( temp 2-component vector of float)
 0:21              indirect index ( temp 2-component vector of float)
-0:?                 'packed.uv' ( temp 2-element array of 2-component vector of float)
+0:21                uv: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:21                  'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:21                  Constant:
+0:21                    2 (const int)
 0:21                'i' ( temp int)
 0:21                'i' ( temp int)
 0:20          Loop Terminal Expression
 0:20          Loop Terminal Expression
 0:20          Pre-Increment ( temp int)
 0:20          Pre-Increment ( temp int)
 0:20            'i' ( temp int)
 0:20            'i' ( temp int)
 0:24      Sequence
 0:24      Sequence
-0:24        Sequence
-0:24          move second child to first child ( temp texture2D)
-0:?             'packed2.tex' ( temp texture2D)
-0:?             'packed.tex' ( temp texture2D)
-0:24          move second child to first child ( temp 3-element array of 3-component vector of float)
-0:?             'packed2.pos' ( temp 3-element array of 3-component vector of float)
-0:?             'packed.pos' ( temp 3-element array of 3-component vector of float)
-0:24          move second child to first child ( temp 2-element array of 2-component vector of float)
-0:?             'packed2.uv' ( temp 2-element array of 2-component vector of float)
-0:?             'packed.uv' ( temp 2-element array of 2-component vector of float)
-0:24          move second child to first child ( temp float)
-0:?             'packed2.x' ( temp float)
-0:?             'packed.x' ( temp float)
-0:24          move second child to first child ( temp int)
-0:?             'packed2.n' ( temp int)
-0:?             'packed.n' ( temp int)
+0:24        move second child to first child ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:24          'packed2' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:24          'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
 0:26      Branch: Return with expression
 0:26      Branch: Return with expression
 0:26        add ( temp 4-component vector of float)
 0:26        add ( temp 4-component vector of float)
 0:26          'pos' ( in 4-component vector of float)
 0:26          'pos' ( in 4-component vector of float)
 0:?           Construct vec4 ( temp 4-component vector of float)
 0:?           Construct vec4 ( temp 4-component vector of float)
 0:26            direct index ( temp 3-component vector of float)
 0:26            direct index ( temp 3-component vector of float)
-0:?               'packed2.pos' ( temp 3-element array of 3-component vector of float)
+0:26              pos: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:26                'packed2' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:26                Constant:
+0:26                  1 (const int)
 0:26              Constant:
 0:26              Constant:
 0:26                0 (const int)
 0:26                0 (const int)
 0:26            Constant:
 0:26            Constant:
@@ -116,11 +127,17 @@ Shader version: 500
 0:12      'pos' ( in 4-component vector of float)
 0:12      'pos' ( in 4-component vector of float)
 0:?     Sequence
 0:?     Sequence
 0:14      move second child to first child ( temp texture2D)
 0:14      move second child to first child ( temp texture2D)
-0:?         'packed.tex' ( temp texture2D)
+0:14        tex: direct index for structure ( temp texture2D)
+0:14          'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:14          Constant:
+0:14            0 (const int)
 0:14        'tex' ( uniform texture2D)
 0:14        'tex' ( uniform texture2D)
 0:15      move second child to first child ( temp 3-component vector of float)
 0:15      move second child to first child ( temp 3-component vector of float)
 0:15        direct index ( temp 3-component vector of float)
 0:15        direct index ( temp 3-component vector of float)
-0:?           'packed.pos' ( temp 3-element array of 3-component vector of float)
+0:15          pos: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:15            'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:15            Constant:
+0:15              1 (const int)
 0:15          Constant:
 0:15          Constant:
 0:15            0 (const int)
 0:15            0 (const int)
 0:?         Constant:
 0:?         Constant:
@@ -129,18 +146,27 @@ Shader version: 500
 0:?           0.000000
 0:?           0.000000
 0:16      move second child to first child ( temp 2-component vector of float)
 0:16      move second child to first child ( temp 2-component vector of float)
 0:16        direct index ( temp 2-component vector of float)
 0:16        direct index ( temp 2-component vector of float)
-0:?           'packed.uv' ( temp 2-element array of 2-component vector of float)
+0:16          uv: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:16            'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:16            Constant:
+0:16              2 (const int)
 0:16          Constant:
 0:16          Constant:
 0:16            0 (const int)
 0:16            0 (const int)
 0:?         Constant:
 0:?         Constant:
 0:?           0.000000
 0:?           0.000000
 0:?           1.000000
 0:?           1.000000
 0:17      move second child to first child ( temp float)
 0:17      move second child to first child ( temp float)
-0:?         'packed.x' ( temp float)
+0:17        x: direct index for structure ( temp float)
+0:17          'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:17          Constant:
+0:17            3 (const int)
 0:17        Constant:
 0:17        Constant:
 0:17          1.000000
 0:17          1.000000
 0:18      move second child to first child ( temp int)
 0:18      move second child to first child ( temp int)
-0:?         'packed.n' ( temp int)
+0:18        n: direct index for structure ( temp int)
+0:18          'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:18          Constant:
+0:18            4 (const int)
 0:18        Constant:
 0:18        Constant:
 0:18          3 (const int)
 0:18          3 (const int)
 0:20      Sequence
 0:20      Sequence
@@ -159,7 +185,10 @@ Shader version: 500
 0:21            add second child into first child ( temp 2-component vector of float)
 0:21            add second child into first child ( temp 2-component vector of float)
 0:21              vector swizzle ( temp 2-component vector of float)
 0:21              vector swizzle ( temp 2-component vector of float)
 0:21                indirect index ( temp 3-component vector of float)
 0:21                indirect index ( temp 3-component vector of float)
-0:?                   'packed.pos' ( temp 3-element array of 3-component vector of float)
+0:21                  pos: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:21                    'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:21                    Constant:
+0:21                      1 (const int)
 0:21                  'i' ( temp int)
 0:21                  'i' ( temp int)
 0:21                Sequence
 0:21                Sequence
 0:21                  Constant:
 0:21                  Constant:
@@ -167,34 +196,27 @@ Shader version: 500
 0:21                  Constant:
 0:21                  Constant:
 0:21                    1 (const int)
 0:21                    1 (const int)
 0:21              indirect index ( temp 2-component vector of float)
 0:21              indirect index ( temp 2-component vector of float)
-0:?                 'packed.uv' ( temp 2-element array of 2-component vector of float)
+0:21                uv: direct index for structure ( temp 2-element array of 2-component vector of float)
+0:21                  'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:21                  Constant:
+0:21                    2 (const int)
 0:21                'i' ( temp int)
 0:21                'i' ( temp int)
 0:20          Loop Terminal Expression
 0:20          Loop Terminal Expression
 0:20          Pre-Increment ( temp int)
 0:20          Pre-Increment ( temp int)
 0:20            'i' ( temp int)
 0:20            'i' ( temp int)
 0:24      Sequence
 0:24      Sequence
-0:24        Sequence
-0:24          move second child to first child ( temp texture2D)
-0:?             'packed2.tex' ( temp texture2D)
-0:?             'packed.tex' ( temp texture2D)
-0:24          move second child to first child ( temp 3-element array of 3-component vector of float)
-0:?             'packed2.pos' ( temp 3-element array of 3-component vector of float)
-0:?             'packed.pos' ( temp 3-element array of 3-component vector of float)
-0:24          move second child to first child ( temp 2-element array of 2-component vector of float)
-0:?             'packed2.uv' ( temp 2-element array of 2-component vector of float)
-0:?             'packed.uv' ( temp 2-element array of 2-component vector of float)
-0:24          move second child to first child ( temp float)
-0:?             'packed2.x' ( temp float)
-0:?             'packed.x' ( temp float)
-0:24          move second child to first child ( temp int)
-0:?             'packed2.n' ( temp int)
-0:?             'packed.n' ( temp int)
+0:24        move second child to first child ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:24          'packed2' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:24          'packed' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
 0:26      Branch: Return with expression
 0:26      Branch: Return with expression
 0:26        add ( temp 4-component vector of float)
 0:26        add ( temp 4-component vector of float)
 0:26          'pos' ( in 4-component vector of float)
 0:26          'pos' ( in 4-component vector of float)
 0:?           Construct vec4 ( temp 4-component vector of float)
 0:?           Construct vec4 ( temp 4-component vector of float)
 0:26            direct index ( temp 3-component vector of float)
 0:26            direct index ( temp 3-component vector of float)
-0:?               'packed2.pos' ( temp 3-element array of 3-component vector of float)
+0:26              pos: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:26                'packed2' ( temp structure{ temp texture2D tex,  temp 3-element array of 3-component vector of float pos,  temp 2-element array of 2-component vector of float uv,  temp float x,  temp int n})
+0:26                Constant:
+0:26                  1 (const int)
 0:26              Constant:
 0:26              Constant:
 0:26                0 (const int)
 0:26                0 (const int)
 0:26            Constant:
 0:26            Constant:
@@ -216,35 +238,33 @@ Shader version: 500
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 97
+// Id's are bound by 90
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 90 93
+                              EntryPoint Vertex 4  "main" 83 86
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
                               Name 11  "@main(vf4;"
                               Name 11  "@main(vf4;"
                               Name 10  "pos"
                               Name 10  "pos"
-                              Name 15  "packed.tex"
-                              Name 17  "tex"
-                              Name 24  "packed.pos"
-                              Name 35  "packed.uv"
-                              Name 41  "packed.x"
-                              Name 43  "packed.n"
-                              Name 45  "i"
-                              Name 68  "packed2.tex"
-                              Name 70  "packed2.pos"
-                              Name 72  "packed2.uv"
-                              Name 74  "packed2.x"
-                              Name 76  "packed2.n"
-                              Name 88  "pos"
-                              Name 90  "pos"
-                              Name 93  "@entryPointOutput"
-                              Name 94  "param"
-                              Decorate 17(tex) DescriptorSet 0
-                              Decorate 90(pos) Location 0
-                              Decorate 93(@entryPointOutput) BuiltIn Position
+                              Name 22  "Packed"
+                              MemberName 22(Packed) 0  "tex"
+                              MemberName 22(Packed) 1  "pos"
+                              MemberName 22(Packed) 2  "uv"
+                              MemberName 22(Packed) 3  "x"
+                              MemberName 22(Packed) 4  "n"
+                              Name 24  "packed"
+                              Name 27  "tex"
+                              Name 47  "i"
+                              Name 69  "packed2"
+                              Name 81  "pos"
+                              Name 83  "pos"
+                              Name 86  "@entryPointOutput"
+                              Name 87  "param"
+                              Decorate 27(tex) DescriptorSet 0
+                              Decorate 83(pos) Location 0
+                              Decorate 86(@entryPointOutput) BuiltIn Position
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
@@ -252,115 +272,104 @@ Shader version: 500
                8:             TypePointer Function 7(fvec4)
                8:             TypePointer Function 7(fvec4)
                9:             TypeFunction 7(fvec4) 8(ptr)
                9:             TypeFunction 7(fvec4) 8(ptr)
               13:             TypeImage 6(float) 2D sampled format:Unknown
               13:             TypeImage 6(float) 2D sampled format:Unknown
-              14:             TypePointer Function 13
-              16:             TypePointer UniformConstant 13
-         17(tex):     16(ptr) Variable UniformConstant
-              19:             TypeVector 6(float) 3
-              20:             TypeInt 32 0
-              21:     20(int) Constant 3
-              22:             TypeArray 19(fvec3) 21
-              23:             TypePointer Function 22
-              25:             TypeInt 32 1
-              26:     25(int) Constant 0
-              27:    6(float) Constant 0
-              28:   19(fvec3) ConstantComposite 27 27 27
-              29:             TypePointer Function 19(fvec3)
-              31:             TypeVector 6(float) 2
-              32:     20(int) Constant 2
-              33:             TypeArray 31(fvec2) 32
-              34:             TypePointer Function 33
-              36:    6(float) Constant 1065353216
-              37:   31(fvec2) ConstantComposite 27 36
-              38:             TypePointer Function 31(fvec2)
-              40:             TypePointer Function 6(float)
-              42:             TypePointer Function 25(int)
-              44:     25(int) Constant 3
-              52:     25(int) Constant 1
-              53:             TypeBool
-              89:             TypePointer Input 7(fvec4)
-         90(pos):     89(ptr) Variable Input
-              92:             TypePointer Output 7(fvec4)
-93(@entryPointOutput):     92(ptr) Variable Output
+              14:             TypeVector 6(float) 3
+              15:             TypeInt 32 0
+              16:     15(int) Constant 3
+              17:             TypeArray 14(fvec3) 16
+              18:             TypeVector 6(float) 2
+              19:     15(int) Constant 2
+              20:             TypeArray 18(fvec2) 19
+              21:             TypeInt 32 1
+      22(Packed):             TypeStruct 13 17 20 6(float) 21(int)
+              23:             TypePointer Function 22(Packed)
+              25:     21(int) Constant 0
+              26:             TypePointer UniformConstant 13
+         27(tex):     26(ptr) Variable UniformConstant
+              29:             TypePointer Function 13
+              31:     21(int) Constant 1
+              32:    6(float) Constant 0
+              33:   14(fvec3) ConstantComposite 32 32 32
+              34:             TypePointer Function 14(fvec3)
+              36:     21(int) Constant 2
+              37:    6(float) Constant 1065353216
+              38:   18(fvec2) ConstantComposite 32 37
+              39:             TypePointer Function 18(fvec2)
+              41:     21(int) Constant 3
+              42:             TypePointer Function 6(float)
+              44:     21(int) Constant 4
+              45:             TypePointer Function 21(int)
+              54:             TypeBool
+              82:             TypePointer Input 7(fvec4)
+         83(pos):     82(ptr) Variable Input
+              85:             TypePointer Output 7(fvec4)
+86(@entryPointOutput):     85(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-         88(pos):      8(ptr) Variable Function
-       94(param):      8(ptr) Variable Function
-              91:    7(fvec4) Load 90(pos)
-                              Store 88(pos) 91
-              95:    7(fvec4) Load 88(pos)
-                              Store 94(param) 95
-              96:    7(fvec4) FunctionCall 11(@main(vf4;) 94(param)
-                              Store 93(@entryPointOutput) 96
+         81(pos):      8(ptr) Variable Function
+       87(param):      8(ptr) Variable Function
+              84:    7(fvec4) Load 83(pos)
+                              Store 81(pos) 84
+              88:    7(fvec4) Load 81(pos)
+                              Store 87(param) 88
+              89:    7(fvec4) FunctionCall 11(@main(vf4;) 87(param)
+                              Store 86(@entryPointOutput) 89
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
   11(@main(vf4;):    7(fvec4) Function None 9
   11(@main(vf4;):    7(fvec4) Function None 9
          10(pos):      8(ptr) FunctionParameter
          10(pos):      8(ptr) FunctionParameter
               12:             Label
               12:             Label
-  15(packed.tex):     14(ptr) Variable Function
-  24(packed.pos):     23(ptr) Variable Function
-   35(packed.uv):     34(ptr) Variable Function
-    41(packed.x):     40(ptr) Variable Function
-    43(packed.n):     42(ptr) Variable Function
-           45(i):     42(ptr) Variable Function
- 68(packed2.tex):     14(ptr) Variable Function
- 70(packed2.pos):     23(ptr) Variable Function
-  72(packed2.uv):     34(ptr) Variable Function
-   74(packed2.x):     40(ptr) Variable Function
-   76(packed2.n):     42(ptr) Variable Function
-              18:          13 Load 17(tex)
-                              Store 15(packed.tex) 18
-              30:     29(ptr) AccessChain 24(packed.pos) 26
+      24(packed):     23(ptr) Variable Function
+           47(i):     45(ptr) Variable Function
+     69(packed2):     23(ptr) Variable Function
+              28:          13 Load 27(tex)
+              30:     29(ptr) AccessChain 24(packed) 25
                               Store 30 28
                               Store 30 28
-              39:     38(ptr) AccessChain 35(packed.uv) 26
-                              Store 39 37
-                              Store 41(packed.x) 36
-                              Store 43(packed.n) 44
-                              Store 45(i) 26
-                              Branch 46
-              46:             Label
-                              LoopMerge 48 49 None
-                              Branch 50
-              50:             Label
-              51:     25(int) Load 45(i)
-              54:    53(bool) SLessThan 51 52
-                              BranchConditional 54 47 48
-              47:               Label
-              55:     25(int)   Load 45(i)
-              56:     25(int)   Load 45(i)
-              57:     38(ptr)   AccessChain 35(packed.uv) 56
-              58:   31(fvec2)   Load 57
-              59:     29(ptr)   AccessChain 24(packed.pos) 55
-              60:   19(fvec3)   Load 59
-              61:   31(fvec2)   VectorShuffle 60 60 0 1
-              62:   31(fvec2)   FAdd 61 58
-              63:     29(ptr)   AccessChain 24(packed.pos) 55
-              64:   19(fvec3)   Load 63
-              65:   19(fvec3)   VectorShuffle 64 62 3 4 2
-                                Store 63 65
-                                Branch 49
-              49:               Label
-              66:     25(int)   Load 45(i)
-              67:     25(int)   IAdd 66 52
-                                Store 45(i) 67
-                                Branch 46
+              35:     34(ptr) AccessChain 24(packed) 31 25
+                              Store 35 33
+              40:     39(ptr) AccessChain 24(packed) 36 25
+                              Store 40 38
+              43:     42(ptr) AccessChain 24(packed) 41
+                              Store 43 37
+              46:     45(ptr) AccessChain 24(packed) 44
+                              Store 46 41
+                              Store 47(i) 25
+                              Branch 48
               48:             Label
               48:             Label
-              69:          13 Load 15(packed.tex)
-                              Store 68(packed2.tex) 69
-              71:          22 Load 24(packed.pos)
-                              Store 70(packed2.pos) 71
-              73:          33 Load 35(packed.uv)
-                              Store 72(packed2.uv) 73
-              75:    6(float) Load 41(packed.x)
-                              Store 74(packed2.x) 75
-              77:     25(int) Load 43(packed.n)
-                              Store 76(packed2.n) 77
-              78:    7(fvec4) Load 10(pos)
-              79:     29(ptr) AccessChain 70(packed2.pos) 26
-              80:   19(fvec3) Load 79
-              81:    6(float) CompositeExtract 80 0
-              82:    6(float) CompositeExtract 80 1
-              83:    6(float) CompositeExtract 80 2
-              84:    7(fvec4) CompositeConstruct 81 82 83 27
-              85:    7(fvec4) FAdd 78 84
-                              ReturnValue 85
+                              LoopMerge 50 51 None
+                              Branch 52
+              52:             Label
+              53:     21(int) Load 47(i)
+              55:    54(bool) SLessThan 53 31
+                              BranchConditional 55 49 50
+              49:               Label
+              56:     21(int)   Load 47(i)
+              57:     21(int)   Load 47(i)
+              58:     39(ptr)   AccessChain 24(packed) 36 57
+              59:   18(fvec2)   Load 58
+              60:     34(ptr)   AccessChain 24(packed) 31 56
+              61:   14(fvec3)   Load 60
+              62:   18(fvec2)   VectorShuffle 61 61 0 1
+              63:   18(fvec2)   FAdd 62 59
+              64:     34(ptr)   AccessChain 24(packed) 31 56
+              65:   14(fvec3)   Load 64
+              66:   14(fvec3)   VectorShuffle 65 63 3 4 2
+                                Store 64 66
+                                Branch 51
+              51:               Label
+              67:     21(int)   Load 47(i)
+              68:     21(int)   IAdd 67 31
+                                Store 47(i) 68
+                                Branch 48
+              50:             Label
+              70:  22(Packed) Load 24(packed)
+                              Store 69(packed2) 70
+              71:    7(fvec4) Load 10(pos)
+              72:     34(ptr) AccessChain 69(packed2) 31 25
+              73:   14(fvec3) Load 72
+              74:    6(float) CompositeExtract 73 0
+              75:    6(float) CompositeExtract 73 1
+              76:    6(float) CompositeExtract 73 2
+              77:    7(fvec4) CompositeConstruct 74 75 76 32
+              78:    7(fvec4) FAdd 71 77
+                              ReturnValue 78
                               FunctionEnd
                               FunctionEnd

+ 67 - 50
3rdparty/glslang/Test/baseResults/hlsl.partialFlattenMixed.vert.out

@@ -9,13 +9,19 @@ Shader version: 500
 0:13      Sequence
 0:13      Sequence
 0:13        move second child to first child ( temp texture2D)
 0:13        move second child to first child ( temp texture2D)
 0:13          direct index ( temp texture2D)
 0:13          direct index ( temp texture2D)
-0:?             'packed.membTex' ( temp 2-element array of texture2D)
+0:13            membTex: direct index for structure ( temp 2-element array of texture2D)
+0:13              'packed' ( temp structure{ temp int a,  temp 2-element array of texture2D membTex,  temp int b})
+0:13              Constant:
+0:13                1 (const int)
 0:13            Constant:
 0:13            Constant:
 0:13              0 (const int)
 0:13              0 (const int)
 0:?           'tex[0]' ( uniform texture2D)
 0:?           'tex[0]' ( uniform texture2D)
 0:13        move second child to first child ( temp texture2D)
 0:13        move second child to first child ( temp texture2D)
 0:13          direct index ( temp texture2D)
 0:13          direct index ( temp texture2D)
-0:?             'packed.membTex' ( temp 2-element array of texture2D)
+0:13            membTex: direct index for structure ( temp 2-element array of texture2D)
+0:13              'packed' ( temp structure{ temp int a,  temp 2-element array of texture2D membTex,  temp int b})
+0:13              Constant:
+0:13                1 (const int)
 0:13            Constant:
 0:13            Constant:
 0:13              1 (const int)
 0:13              1 (const int)
 0:?           'tex[1]' ( uniform texture2D)
 0:?           'tex[1]' ( uniform texture2D)
@@ -50,13 +56,19 @@ Shader version: 500
 0:13      Sequence
 0:13      Sequence
 0:13        move second child to first child ( temp texture2D)
 0:13        move second child to first child ( temp texture2D)
 0:13          direct index ( temp texture2D)
 0:13          direct index ( temp texture2D)
-0:?             'packed.membTex' ( temp 2-element array of texture2D)
+0:13            membTex: direct index for structure ( temp 2-element array of texture2D)
+0:13              'packed' ( temp structure{ temp int a,  temp 2-element array of texture2D membTex,  temp int b})
+0:13              Constant:
+0:13                1 (const int)
 0:13            Constant:
 0:13            Constant:
 0:13              0 (const int)
 0:13              0 (const int)
 0:?           'tex[0]' ( uniform texture2D)
 0:?           'tex[0]' ( uniform texture2D)
 0:13        move second child to first child ( temp texture2D)
 0:13        move second child to first child ( temp texture2D)
 0:13          direct index ( temp texture2D)
 0:13          direct index ( temp texture2D)
-0:?             'packed.membTex' ( temp 2-element array of texture2D)
+0:13            membTex: direct index for structure ( temp 2-element array of texture2D)
+0:13              'packed' ( temp structure{ temp int a,  temp 2-element array of texture2D membTex,  temp int b})
+0:13              Constant:
+0:13                1 (const int)
 0:13            Constant:
 0:13            Constant:
 0:13              1 (const int)
 0:13              1 (const int)
 0:?           'tex[1]' ( uniform texture2D)
 0:?           'tex[1]' ( uniform texture2D)
@@ -80,71 +92,76 @@ Shader version: 500
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 42
+// Id's are bound by 43
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 35 38
+                              EntryPoint Vertex 4  "main" 36 39
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
                               Name 11  "@main(vf4;"
                               Name 11  "@main(vf4;"
                               Name 10  "pos"
                               Name 10  "pos"
-                              Name 18  "packed.membTex"
-                              Name 22  "tex[0]"
-                              Name 27  "tex[1]"
-                              Name 33  "pos"
-                              Name 35  "pos"
-                              Name 38  "@entryPointOutput"
-                              Name 39  "param"
-                              Decorate 22(tex[0]) DescriptorSet 0
-                              Decorate 27(tex[1]) DescriptorSet 0
-                              Decorate 35(pos) Location 0
-                              Decorate 38(@entryPointOutput) BuiltIn Position
+                              Name 18  "Packed"
+                              MemberName 18(Packed) 0  "a"
+                              MemberName 18(Packed) 1  "membTex"
+                              MemberName 18(Packed) 2  "b"
+                              Name 20  "packed"
+                              Name 24  "tex[0]"
+                              Name 28  "tex[1]"
+                              Name 34  "pos"
+                              Name 36  "pos"
+                              Name 39  "@entryPointOutput"
+                              Name 40  "param"
+                              Decorate 24(tex[0]) DescriptorSet 0
+                              Decorate 28(tex[1]) DescriptorSet 0
+                              Decorate 36(pos) Location 0
+                              Decorate 39(@entryPointOutput) BuiltIn Position
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
                7:             TypeVector 6(float) 4
                7:             TypeVector 6(float) 4
                8:             TypePointer Function 7(fvec4)
                8:             TypePointer Function 7(fvec4)
                9:             TypeFunction 7(fvec4) 8(ptr)
                9:             TypeFunction 7(fvec4) 8(ptr)
-              13:             TypeImage 6(float) 2D sampled format:Unknown
-              14:             TypeInt 32 0
-              15:     14(int) Constant 2
-              16:             TypeArray 13 15
-              17:             TypePointer Function 16
-              19:             TypeInt 32 1
-              20:     19(int) Constant 0
-              21:             TypePointer UniformConstant 13
-      22(tex[0]):     21(ptr) Variable UniformConstant
-              24:             TypePointer Function 13
-              26:     19(int) Constant 1
-      27(tex[1]):     21(ptr) Variable UniformConstant
-              34:             TypePointer Input 7(fvec4)
-         35(pos):     34(ptr) Variable Input
-              37:             TypePointer Output 7(fvec4)
-38(@entryPointOutput):     37(ptr) Variable Output
+              13:             TypeInt 32 1
+              14:             TypeImage 6(float) 2D sampled format:Unknown
+              15:             TypeInt 32 0
+              16:     15(int) Constant 2
+              17:             TypeArray 14 16
+      18(Packed):             TypeStruct 13(int) 17 13(int)
+              19:             TypePointer Function 18(Packed)
+              21:     13(int) Constant 1
+              22:     13(int) Constant 0
+              23:             TypePointer UniformConstant 14
+      24(tex[0]):     23(ptr) Variable UniformConstant
+              26:             TypePointer Function 14
+      28(tex[1]):     23(ptr) Variable UniformConstant
+              35:             TypePointer Input 7(fvec4)
+         36(pos):     35(ptr) Variable Input
+              38:             TypePointer Output 7(fvec4)
+39(@entryPointOutput):     38(ptr) Variable Output
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-         33(pos):      8(ptr) Variable Function
-       39(param):      8(ptr) Variable Function
-              36:    7(fvec4) Load 35(pos)
-                              Store 33(pos) 36
-              40:    7(fvec4) Load 33(pos)
-                              Store 39(param) 40
-              41:    7(fvec4) FunctionCall 11(@main(vf4;) 39(param)
-                              Store 38(@entryPointOutput) 41
+         34(pos):      8(ptr) Variable Function
+       40(param):      8(ptr) Variable Function
+              37:    7(fvec4) Load 36(pos)
+                              Store 34(pos) 37
+              41:    7(fvec4) Load 34(pos)
+                              Store 40(param) 41
+              42:    7(fvec4) FunctionCall 11(@main(vf4;) 40(param)
+                              Store 39(@entryPointOutput) 42
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
   11(@main(vf4;):    7(fvec4) Function None 9
   11(@main(vf4;):    7(fvec4) Function None 9
          10(pos):      8(ptr) FunctionParameter
          10(pos):      8(ptr) FunctionParameter
               12:             Label
               12:             Label
-18(packed.membTex):     17(ptr) Variable Function
-              23:          13 Load 22(tex[0])
-              25:     24(ptr) AccessChain 18(packed.membTex) 20
-                              Store 25 23
-              28:          13 Load 27(tex[1])
-              29:     24(ptr) AccessChain 18(packed.membTex) 26
-                              Store 29 28
-              30:    7(fvec4) Load 10(pos)
-                              ReturnValue 30
+      20(packed):     19(ptr) Variable Function
+              25:          14 Load 24(tex[0])
+              27:     26(ptr) AccessChain 20(packed) 21 22
+                              Store 27 25
+              29:          14 Load 28(tex[1])
+              30:     26(ptr) AccessChain 20(packed) 21 21
+                              Store 30 29
+              31:    7(fvec4) Load 10(pos)
+                              ReturnValue 31
                               FunctionEnd
                               FunctionEnd

+ 54 - 64
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.append.fn.frag.out

@@ -151,12 +151,12 @@ gl_FragCoord origin is upper left
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 76
+// Id's are bound by 70
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 64 67
+                              EntryPoint Fragment 4  "main" 58 61
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
@@ -171,55 +171,51 @@ gl_FragCoord origin is upper left
                               Name 18  "arg_c@count"
                               Name 18  "arg_c@count"
                               Name 25  "@main(u1;"
                               Name 25  "@main(u1;"
                               Name 24  "pos"
                               Name 24  "pos"
-                              Name 50  "sbuf_a"
-                              Name 52  "sbuf_a@count"
-                              Name 53  "sbuf_c"
-                              Name 54  "sbuf_c@count"
-                              Name 55  "param"
-                              Name 56  "param"
-                              Name 57  "param"
-                              Name 58  "param"
-                              Name 62  "pos"
-                              Name 64  "pos"
-                              Name 67  "@entryPointOutput"
-                              Name 68  "param"
-                              Name 71  "sbuf_a@count"
-                              MemberName 71(sbuf_a@count) 0  "@count"
-                              Name 73  "sbuf_a@count"
-                              Name 74  "sbuf_c@count"
-                              Name 75  "sbuf_unused"
+                              Name 49  "sbuf_a"
+                              Name 50  "sbuf_a@count"
+                              Name 51  "sbuf_c"
+                              Name 52  "sbuf_c@count"
+                              Name 56  "pos"
+                              Name 58  "pos"
+                              Name 61  "@entryPointOutput"
+                              Name 62  "param"
+                              Name 65  "sbuf_a@count"
+                              MemberName 65(sbuf_a@count) 0  "@count"
+                              Name 67  "sbuf_a@count"
+                              Name 68  "sbuf_c@count"
+                              Name 69  "sbuf_unused"
                               Decorate 8 ArrayStride 16
                               Decorate 8 ArrayStride 16
                               MemberDecorate 9 0 Offset 0
                               MemberDecorate 9 0 Offset 0
                               Decorate 9 BufferBlock
                               Decorate 9 BufferBlock
                               Decorate 12 BufferBlock
                               Decorate 12 BufferBlock
-                              Decorate 50(sbuf_a) DescriptorSet 0
-                              Decorate 52(sbuf_a@count) DescriptorSet 0
-                              Decorate 53(sbuf_c) DescriptorSet 0
-                              Decorate 54(sbuf_c@count) DescriptorSet 0
-                              Decorate 64(pos) Flat
-                              Decorate 64(pos) Location 0
-                              Decorate 67(@entryPointOutput) Location 0
-                              MemberDecorate 71(sbuf_a@count) 0 Offset 0
-                              Decorate 71(sbuf_a@count) BufferBlock
-                              Decorate 73(sbuf_a@count) DescriptorSet 0
-                              Decorate 74(sbuf_c@count) DescriptorSet 0
-                              Decorate 75(sbuf_unused) DescriptorSet 0
+                              Decorate 49(sbuf_a) DescriptorSet 0
+                              Decorate 50(sbuf_a@count) DescriptorSet 0
+                              Decorate 51(sbuf_c) DescriptorSet 0
+                              Decorate 52(sbuf_c@count) DescriptorSet 0
+                              Decorate 58(pos) Flat
+                              Decorate 58(pos) Location 0
+                              Decorate 61(@entryPointOutput) Location 0
+                              MemberDecorate 65(sbuf_a@count) 0 Offset 0
+                              Decorate 65(sbuf_a@count) BufferBlock
+                              Decorate 67(sbuf_a@count) DescriptorSet 0
+                              Decorate 68(sbuf_c@count) DescriptorSet 0
+                              Decorate 69(sbuf_unused) DescriptorSet 0
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeFloat 32
                6:             TypeFloat 32
                7:             TypeVector 6(float) 4
                7:             TypeVector 6(float) 4
                8:             TypeRuntimeArray 7(fvec4)
                8:             TypeRuntimeArray 7(fvec4)
                9:             TypeStruct 8
                9:             TypeStruct 8
-              10:             TypePointer Function 9(struct)
+              10:             TypePointer Uniform 9(struct)
               11:             TypeInt 32 1
               11:             TypeInt 32 1
               12:             TypeStruct 11(int)
               12:             TypeStruct 11(int)
-              13:             TypePointer Function 12(struct)
+              13:             TypePointer Uniform 12(struct)
               14:             TypeFunction 7(fvec4) 10(ptr) 13(ptr) 10(ptr) 13(ptr)
               14:             TypeFunction 7(fvec4) 10(ptr) 13(ptr) 10(ptr) 13(ptr)
               21:             TypeInt 32 0
               21:             TypeInt 32 0
               22:             TypePointer Function 21(int)
               22:             TypePointer Function 21(int)
               23:             TypeFunction 7(fvec4) 22(ptr)
               23:             TypeFunction 7(fvec4) 22(ptr)
               27:     11(int) Constant 0
               27:     11(int) Constant 0
-              28:             TypePointer Function 11(int)
+              28:             TypePointer Uniform 11(int)
               30:     11(int) Constant 1
               30:     11(int) Constant 1
               31:     21(int) Constant 1
               31:     21(int) Constant 1
               32:     21(int) Constant 0
               32:     21(int) Constant 0
@@ -228,33 +224,31 @@ gl_FragCoord origin is upper left
               36:    6(float) Constant 1077936128
               36:    6(float) Constant 1077936128
               37:    6(float) Constant 1082130432
               37:    6(float) Constant 1082130432
               38:    7(fvec4) ConstantComposite 34 35 36 37
               38:    7(fvec4) ConstantComposite 34 35 36 37
-              39:             TypePointer Function 7(fvec4)
+              39:             TypePointer Uniform 7(fvec4)
               42:     11(int) Constant 4294967295
               42:     11(int) Constant 4294967295
-              49:             TypePointer Uniform 9(struct)
-      50(sbuf_a):     49(ptr) Variable Uniform
-              51:             TypePointer Uniform 12(struct)
-52(sbuf_a@count):     51(ptr) Variable Uniform
-      53(sbuf_c):     49(ptr) Variable Uniform
-54(sbuf_c@count):     51(ptr) Variable Uniform
-              63:             TypePointer Input 21(int)
-         64(pos):     63(ptr) Variable Input
-              66:             TypePointer Output 7(fvec4)
-67(@entryPointOutput):     66(ptr) Variable Output
-71(sbuf_a@count):             TypeStruct 11(int)
-              72:             TypePointer Uniform 71(sbuf_a@count)
-73(sbuf_a@count):     72(ptr) Variable Uniform
-74(sbuf_c@count):     72(ptr) Variable Uniform
- 75(sbuf_unused):     49(ptr) Variable Uniform
+      49(sbuf_a):     10(ptr) Variable Uniform
+50(sbuf_a@count):     13(ptr) Variable Uniform
+      51(sbuf_c):     10(ptr) Variable Uniform
+52(sbuf_c@count):     13(ptr) Variable Uniform
+              57:             TypePointer Input 21(int)
+         58(pos):     57(ptr) Variable Input
+              60:             TypePointer Output 7(fvec4)
+61(@entryPointOutput):     60(ptr) Variable Output
+65(sbuf_a@count):             TypeStruct 11(int)
+              66:             TypePointer Uniform 65(sbuf_a@count)
+67(sbuf_a@count):     66(ptr) Variable Uniform
+68(sbuf_c@count):     66(ptr) Variable Uniform
+ 69(sbuf_unused):     10(ptr) Variable Uniform
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-         62(pos):     22(ptr) Variable Function
-       68(param):     22(ptr) Variable Function
-              65:     21(int) Load 64(pos)
-                              Store 62(pos) 65
-              69:     21(int) Load 62(pos)
-                              Store 68(param) 69
-              70:    7(fvec4) FunctionCall 25(@main(u1;) 68(param)
-                              Store 67(@entryPointOutput) 70
+         56(pos):     22(ptr) Variable Function
+       62(param):     22(ptr) Variable Function
+              59:     21(int) Load 58(pos)
+                              Store 56(pos) 59
+              63:     21(int) Load 56(pos)
+                              Store 62(param) 63
+              64:    7(fvec4) FunctionCall 25(@main(u1;) 62(param)
+                              Store 61(@entryPointOutput) 64
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
 19(Fn2(block--vf4[0]1;block--vf4[0]1;):    7(fvec4) Function None 14
 19(Fn2(block--vf4[0]1;block--vf4[0]1;):    7(fvec4) Function None 14
@@ -277,10 +271,6 @@ gl_FragCoord origin is upper left
    25(@main(u1;):    7(fvec4) Function None 23
    25(@main(u1;):    7(fvec4) Function None 23
          24(pos):     22(ptr) FunctionParameter
          24(pos):     22(ptr) FunctionParameter
               26:             Label
               26:             Label
-       55(param):     10(ptr) Variable Function
-       56(param):     13(ptr) Variable Function
-       57(param):     10(ptr) Variable Function
-       58(param):     13(ptr) Variable Function
-              59:    7(fvec4) FunctionCall 19(Fn2(block--vf4[0]1;block--vf4[0]1;) 55(param) 56(param) 57(param) 58(param)
-                              ReturnValue 59
+              53:    7(fvec4) FunctionCall 19(Fn2(block--vf4[0]1;block--vf4[0]1;) 49(sbuf_a) 50(sbuf_a@count) 51(sbuf_c) 52(sbuf_c@count)
+                              ReturnValue 53
                               FunctionEnd
                               FunctionEnd

+ 76 - 84
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn.frag.out

@@ -139,12 +139,12 @@ gl_FragCoord origin is upper left
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 83
+// Id's are bound by 78
 
 
                               Capability Shader
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 68 71
+                              EntryPoint Fragment 4  "main" 63 66
                               ExecutionMode 4 OriginUpperLeft
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
@@ -165,24 +165,21 @@ gl_FragCoord origin is upper left
                               Name 35  "@main(u1;"
                               Name 35  "@main(u1;"
                               Name 34  "pos"
                               Name 34  "pos"
                               Name 47  "sbuf2"
                               Name 47  "sbuf2"
-                              Name 49  "sbuf2@count"
-                              Name 52  "sbuf"
+                              Name 48  "sbuf2@count"
+                              Name 50  "sbuf"
+                              Name 52  "param"
                               Name 54  "param"
                               Name 54  "param"
                               Name 55  "param"
                               Name 55  "param"
-                              Name 57  "param"
-                              Name 58  "param"
-                              Name 59  "param"
-                              Name 60  "param"
-                              Name 66  "pos"
-                              Name 68  "pos"
-                              Name 71  "@entryPointOutput"
-                              Name 72  "param"
-                              Name 75  "sbuf2@count"
-                              MemberName 75(sbuf2@count) 0  "@count"
-                              Name 77  "sbuf2@count"
-                              Name 80  "sbuf3"
-                              MemberName 80(sbuf3) 0  "@data"
-                              Name 82  "sbuf3"
+                              Name 61  "pos"
+                              Name 63  "pos"
+                              Name 66  "@entryPointOutput"
+                              Name 67  "param"
+                              Name 70  "sbuf2@count"
+                              MemberName 70(sbuf2@count) 0  "@count"
+                              Name 72  "sbuf2@count"
+                              Name 75  "sbuf3"
+                              MemberName 75(sbuf3) 0  "@data"
+                              Name 77  "sbuf3"
                               Decorate 8 ArrayStride 16
                               Decorate 8 ArrayStride 16
                               MemberDecorate 9 0 NonWritable
                               MemberDecorate 9 0 NonWritable
                               MemberDecorate 9 0 Offset 0
                               MemberDecorate 9 0 Offset 0
@@ -193,74 +190,72 @@ gl_FragCoord origin is upper left
                               Decorate 18 BufferBlock
                               Decorate 18 BufferBlock
                               Decorate 21 BufferBlock
                               Decorate 21 BufferBlock
                               Decorate 47(sbuf2) DescriptorSet 0
                               Decorate 47(sbuf2) DescriptorSet 0
-                              Decorate 49(sbuf2@count) DescriptorSet 0
-                              Decorate 52(sbuf) DescriptorSet 0
-                              Decorate 52(sbuf) Binding 10
-                              Decorate 68(pos) Flat
-                              Decorate 68(pos) Location 0
-                              Decorate 71(@entryPointOutput) Location 0
-                              MemberDecorate 75(sbuf2@count) 0 Offset 0
-                              Decorate 75(sbuf2@count) BufferBlock
-                              Decorate 77(sbuf2@count) DescriptorSet 0
-                              Decorate 79 ArrayStride 16
-                              MemberDecorate 80(sbuf3) 0 NonWritable
-                              MemberDecorate 80(sbuf3) 0 Offset 0
-                              Decorate 80(sbuf3) BufferBlock
-                              Decorate 82(sbuf3) DescriptorSet 0
-                              Decorate 82(sbuf3) Binding 12
+                              Decorate 48(sbuf2@count) DescriptorSet 0
+                              Decorate 50(sbuf) DescriptorSet 0
+                              Decorate 50(sbuf) Binding 10
+                              Decorate 63(pos) Flat
+                              Decorate 63(pos) Location 0
+                              Decorate 66(@entryPointOutput) Location 0
+                              MemberDecorate 70(sbuf2@count) 0 Offset 0
+                              Decorate 70(sbuf2@count) BufferBlock
+                              Decorate 72(sbuf2@count) DescriptorSet 0
+                              Decorate 74 ArrayStride 16
+                              MemberDecorate 75(sbuf3) 0 NonWritable
+                              MemberDecorate 75(sbuf3) 0 Offset 0
+                              Decorate 75(sbuf3) BufferBlock
+                              Decorate 77(sbuf3) DescriptorSet 0
+                              Decorate 77(sbuf3) Binding 12
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeInt 32 0
                6:             TypeInt 32 0
                7:             TypeVector 6(int) 4
                7:             TypeVector 6(int) 4
                8:             TypeRuntimeArray 7(ivec4)
                8:             TypeRuntimeArray 7(ivec4)
                9:             TypeStruct 8
                9:             TypeStruct 8
-              10:             TypePointer Function 9(struct)
+              10:             TypePointer Uniform 9(struct)
               11:             TypePointer Function 6(int)
               11:             TypePointer Function 6(int)
               12:             TypeFunction 7(ivec4) 10(ptr) 11(ptr)
               12:             TypeFunction 7(ivec4) 10(ptr) 11(ptr)
               17:             TypeRuntimeArray 7(ivec4)
               17:             TypeRuntimeArray 7(ivec4)
               18:             TypeStruct 17
               18:             TypeStruct 17
-              19:             TypePointer Function 18(struct)
+              19:             TypePointer Uniform 18(struct)
               20:             TypeInt 32 1
               20:             TypeInt 32 1
               21:             TypeStruct 20(int)
               21:             TypeStruct 20(int)
-              22:             TypePointer Function 21(struct)
+              22:             TypePointer Uniform 21(struct)
               23:             TypePointer Function 7(ivec4)
               23:             TypePointer Function 7(ivec4)
               24:             TypeFunction 2 19(ptr) 22(ptr) 11(ptr) 23(ptr)
               24:             TypeFunction 2 19(ptr) 22(ptr) 11(ptr) 23(ptr)
               31:             TypeFloat 32
               31:             TypeFloat 32
               32:             TypeVector 31(float) 4
               32:             TypeVector 31(float) 4
               33:             TypeFunction 32(fvec4) 11(ptr)
               33:             TypeFunction 32(fvec4) 11(ptr)
               37:     20(int) Constant 0
               37:     20(int) Constant 0
-              46:             TypePointer Uniform 18(struct)
-       47(sbuf2):     46(ptr) Variable Uniform
-              48:             TypePointer Uniform 21(struct)
- 49(sbuf2@count):     48(ptr) Variable Uniform
-              50:      6(int) Constant 2
-              51:             TypePointer Uniform 9(struct)
-        52(sbuf):     51(ptr) Variable Uniform
-              53:      6(int) Constant 3
-              62:   31(float) Constant 0
-              63:   32(fvec4) ConstantComposite 62 62 62 62
-              67:             TypePointer Input 6(int)
-         68(pos):     67(ptr) Variable Input
-              70:             TypePointer Output 32(fvec4)
-71(@entryPointOutput):     70(ptr) Variable Output
- 75(sbuf2@count):             TypeStruct 20(int)
-              76:             TypePointer Uniform 75(sbuf2@count)
- 77(sbuf2@count):     76(ptr) Variable Uniform
-              78:             TypeVector 6(int) 3
-              79:             TypeRuntimeArray 78(ivec3)
-       80(sbuf3):             TypeStruct 79
-              81:             TypePointer Uniform 80(sbuf3)
-       82(sbuf3):     81(ptr) Variable Uniform
+              39:             TypePointer Uniform 7(ivec4)
+       47(sbuf2):     19(ptr) Variable Uniform
+ 48(sbuf2@count):     22(ptr) Variable Uniform
+              49:      6(int) Constant 2
+        50(sbuf):     10(ptr) Variable Uniform
+              51:      6(int) Constant 3
+              57:   31(float) Constant 0
+              58:   32(fvec4) ConstantComposite 57 57 57 57
+              62:             TypePointer Input 6(int)
+         63(pos):     62(ptr) Variable Input
+              65:             TypePointer Output 32(fvec4)
+66(@entryPointOutput):     65(ptr) Variable Output
+ 70(sbuf2@count):             TypeStruct 20(int)
+              71:             TypePointer Uniform 70(sbuf2@count)
+ 72(sbuf2@count):     71(ptr) Variable Uniform
+              73:             TypeVector 6(int) 3
+              74:             TypeRuntimeArray 73(ivec3)
+       75(sbuf3):             TypeStruct 74
+              76:             TypePointer Uniform 75(sbuf3)
+       77(sbuf3):     76(ptr) Variable Uniform
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-         66(pos):     11(ptr) Variable Function
-       72(param):     11(ptr) Variable Function
-              69:      6(int) Load 68(pos)
-                              Store 66(pos) 69
-              73:      6(int) Load 66(pos)
-                              Store 72(param) 73
-              74:   32(fvec4) FunctionCall 35(@main(u1;) 72(param)
-                              Store 71(@entryPointOutput) 74
+         61(pos):     11(ptr) Variable Function
+       67(param):     11(ptr) Variable Function
+              64:      6(int) Load 63(pos)
+                              Store 61(pos) 64
+              68:      6(int) Load 61(pos)
+                              Store 67(param) 68
+              69:   32(fvec4) FunctionCall 35(@main(u1;) 67(param)
+                              Store 66(@entryPointOutput) 69
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
 15(get(block--vu4[0]1;u1;):    7(ivec4) Function None 12
 15(get(block--vu4[0]1;u1;):    7(ivec4) Function None 12
@@ -268,9 +263,9 @@ gl_FragCoord origin is upper left
 14(bufferOffset):     11(ptr) FunctionParameter
 14(bufferOffset):     11(ptr) FunctionParameter
               16:             Label
               16:             Label
               38:      6(int) Load 14(bufferOffset)
               38:      6(int) Load 14(bufferOffset)
-              39:     23(ptr) AccessChain 13(sb) 37 38
-              40:    7(ivec4) Load 39
-                              ReturnValue 40
+              40:     39(ptr) AccessChain 13(sb) 37 38
+              41:    7(ivec4) Load 40
+                              ReturnValue 41
                               FunctionEnd
                               FunctionEnd
 29(set(block--vu4[0]1;u1;vu4;):           2 Function None 24
 29(set(block--vu4[0]1;u1;vu4;):           2 Function None 24
           25(sb):     19(ptr) FunctionParameter
           25(sb):     19(ptr) FunctionParameter
@@ -278,25 +273,22 @@ gl_FragCoord origin is upper left
 27(bufferOffset):     11(ptr) FunctionParameter
 27(bufferOffset):     11(ptr) FunctionParameter
         28(data):     23(ptr) FunctionParameter
         28(data):     23(ptr) FunctionParameter
               30:             Label
               30:             Label
-              43:      6(int) Load 27(bufferOffset)
-              44:    7(ivec4) Load 28(data)
-              45:     23(ptr) AccessChain 25(sb) 37 43
-                              Store 45 44
+              44:      6(int) Load 27(bufferOffset)
+              45:    7(ivec4) Load 28(data)
+              46:     39(ptr) AccessChain 25(sb) 37 44
+                              Store 46 45
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
    35(@main(u1;):   32(fvec4) Function None 33
    35(@main(u1;):   32(fvec4) Function None 33
          34(pos):     11(ptr) FunctionParameter
          34(pos):     11(ptr) FunctionParameter
               36:             Label
               36:             Label
-       54(param):     10(ptr) Variable Function
-       55(param):     11(ptr) Variable Function
-       57(param):     19(ptr) Variable Function
-       58(param):     22(ptr) Variable Function
-       59(param):     11(ptr) Variable Function
-       60(param):     23(ptr) Variable Function
+       52(param):     11(ptr) Variable Function
+       54(param):     11(ptr) Variable Function
+       55(param):     23(ptr) Variable Function
+                              Store 52(param) 51
+              53:    7(ivec4) FunctionCall 15(get(block--vu4[0]1;u1;) 50(sbuf) 52(param)
+                              Store 54(param) 49
                               Store 55(param) 53
                               Store 55(param) 53
-              56:    7(ivec4) FunctionCall 15(get(block--vu4[0]1;u1;) 54(param) 55(param)
-                              Store 59(param) 50
-                              Store 60(param) 56
-              61:           2 FunctionCall 29(set(block--vu4[0]1;u1;vu4;) 57(param) 58(param) 59(param) 60(param)
-                              ReturnValue 63
+              56:           2 FunctionCall 29(set(block--vu4[0]1;u1;vu4;) 47(sbuf2) 48(sbuf2@count) 54(param) 55(param)
+                              ReturnValue 58
                               FunctionEnd
                               FunctionEnd

+ 43 - 45
3rdparty/glslang/Test/baseResults/hlsl.structbuffer.fn2.comp.out

@@ -135,14 +135,14 @@ local_size = (256, 1, 1)
 
 
 // Module Version 10000
 // Module Version 10000
 // Generated by (magic number): 80002
 // Generated by (magic number): 80002
-// Id's are bound by 62
+// Id's are bound by 61
 
 
                               Capability Shader
                               Capability Shader
                               Capability ImageBuffer
                               Capability ImageBuffer
                               Capability StorageImageExtendedFormats
                               Capability StorageImageExtendedFormats
                1:             ExtInstImport  "GLSL.std.450"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               MemoryModel Logical GLSL450
-                              EntryPoint GLCompute 4  "main" 57
+                              EntryPoint GLCompute 4  "main" 56
                               ExecutionMode 4 LocalSize 256 1 1
                               ExecutionMode 4 LocalSize 256 1 1
                               Source HLSL 500
                               Source HLSL 500
                               Name 4  "main"
                               Name 4  "main"
@@ -155,14 +155,13 @@ local_size = (256, 1, 1)
                               Name 18  "dispatchId"
                               Name 18  "dispatchId"
                               Name 22  "result"
                               Name 22  "result"
                               Name 25  "byteAddrTemp"
                               Name 25  "byteAddrTemp"
-                              Name 42  "result"
+                              Name 43  "result"
                               Name 44  "g_input"
                               Name 44  "g_input"
                               Name 45  "param"
                               Name 45  "param"
-                              Name 47  "param"
-                              Name 51  "g_output"
-                              Name 55  "dispatchId"
-                              Name 57  "dispatchId"
-                              Name 59  "param"
+                              Name 50  "g_output"
+                              Name 54  "dispatchId"
+                              Name 56  "dispatchId"
+                              Name 58  "param"
                               Decorate 8 ArrayStride 4
                               Decorate 8 ArrayStride 4
                               MemberDecorate 9 0 NonWritable
                               MemberDecorate 9 0 NonWritable
                               MemberDecorate 9 0 Offset 0
                               MemberDecorate 9 0 Offset 0
@@ -170,16 +169,16 @@ local_size = (256, 1, 1)
                               Decorate 14(buffer) NonWritable
                               Decorate 14(buffer) NonWritable
                               Decorate 44(g_input) DescriptorSet 0
                               Decorate 44(g_input) DescriptorSet 0
                               Decorate 44(g_input) Binding 0
                               Decorate 44(g_input) Binding 0
-                              Decorate 51(g_output) DescriptorSet 0
-                              Decorate 51(g_output) Binding 1
-                              Decorate 57(dispatchId) BuiltIn GlobalInvocationId
+                              Decorate 50(g_output) DescriptorSet 0
+                              Decorate 50(g_output) Binding 1
+                              Decorate 56(dispatchId) BuiltIn GlobalInvocationId
                2:             TypeVoid
                2:             TypeVoid
                3:             TypeFunction 2
                3:             TypeFunction 2
                6:             TypeInt 32 0
                6:             TypeInt 32 0
                7:             TypePointer Function 6(int)
                7:             TypePointer Function 6(int)
                8:             TypeRuntimeArray 6(int)
                8:             TypeRuntimeArray 6(int)
                9:             TypeStruct 8
                9:             TypeStruct 8
-              10:             TypePointer Function 9(struct)
+              10:             TypePointer Uniform 9(struct)
               11:             TypeVector 6(int) 2
               11:             TypeVector 6(int) 2
               12:             TypeFunction 11(ivec2) 7(ptr) 10(ptr)
               12:             TypeFunction 11(ivec2) 7(ptr) 10(ptr)
               17:             TypeFunction 2 7(ptr)
               17:             TypeFunction 2 7(ptr)
@@ -188,23 +187,23 @@ local_size = (256, 1, 1)
               24:             TypePointer Function 23(int)
               24:             TypePointer Function 23(int)
               27:     23(int) Constant 2
               27:     23(int) Constant 2
               29:     23(int) Constant 0
               29:     23(int) Constant 0
-              34:     23(int) Constant 1
-              43:             TypePointer Uniform 9(struct)
-     44(g_input):     43(ptr) Variable Uniform
-              49:             TypeImage 6(int) Buffer nonsampled format:Rg32ui
-              50:             TypePointer UniformConstant 49
-    51(g_output):     50(ptr) Variable UniformConstant
-              56:             TypePointer Input 6(int)
-  57(dispatchId):     56(ptr) Variable Input
+              31:             TypePointer Uniform 6(int)
+              35:     23(int) Constant 1
+     44(g_input):     10(ptr) Variable Uniform
+              48:             TypeImage 6(int) Buffer nonsampled format:Rg32ui
+              49:             TypePointer UniformConstant 48
+    50(g_output):     49(ptr) Variable UniformConstant
+              55:             TypePointer Input 6(int)
+  56(dispatchId):     55(ptr) Variable Input
          4(main):           2 Function None 3
          4(main):           2 Function None 3
                5:             Label
                5:             Label
-  55(dispatchId):      7(ptr) Variable Function
-       59(param):      7(ptr) Variable Function
-              58:      6(int) Load 57(dispatchId)
-                              Store 55(dispatchId) 58
-              60:      6(int) Load 55(dispatchId)
-                              Store 59(param) 60
-              61:           2 FunctionCall 19(@main(u1;) 59(param)
+  54(dispatchId):      7(ptr) Variable Function
+       58(param):      7(ptr) Variable Function
+              57:      6(int) Load 56(dispatchId)
+                              Store 54(dispatchId) 57
+              59:      6(int) Load 54(dispatchId)
+                              Store 58(param) 59
+              60:           2 FunctionCall 19(@main(u1;) 58(param)
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd
 15(testLoad(u1;block--u1[0]1;):   11(ivec2) Function None 12
 15(testLoad(u1;block--u1[0]1;):   11(ivec2) Function None 12
@@ -217,30 +216,29 @@ local_size = (256, 1, 1)
               28:     23(int) ShiftRightLogical 26 27
               28:     23(int) ShiftRightLogical 26 27
                               Store 25(byteAddrTemp) 28
                               Store 25(byteAddrTemp) 28
               30:     23(int) Load 25(byteAddrTemp)
               30:     23(int) Load 25(byteAddrTemp)
-              31:      7(ptr) AccessChain 14(buffer) 29 30
-              32:      6(int) Load 31
-              33:     23(int) Load 25(byteAddrTemp)
-              35:     23(int) IAdd 33 34
-              36:      7(ptr) AccessChain 14(buffer) 29 35
-              37:      6(int) Load 36
-              38:   11(ivec2) CompositeConstruct 32 37
-                              Store 22(result) 38
-              39:   11(ivec2) Load 22(result)
-                              ReturnValue 39
+              32:     31(ptr) AccessChain 14(buffer) 29 30
+              33:      6(int) Load 32
+              34:     23(int) Load 25(byteAddrTemp)
+              36:     23(int) IAdd 34 35
+              37:     31(ptr) AccessChain 14(buffer) 29 36
+              38:      6(int) Load 37
+              39:   11(ivec2) CompositeConstruct 33 38
+                              Store 22(result) 39
+              40:   11(ivec2) Load 22(result)
+                              ReturnValue 40
                               FunctionEnd
                               FunctionEnd
    19(@main(u1;):           2 Function None 17
    19(@main(u1;):           2 Function None 17
   18(dispatchId):      7(ptr) FunctionParameter
   18(dispatchId):      7(ptr) FunctionParameter
               20:             Label
               20:             Label
-      42(result):     21(ptr) Variable Function
+      43(result):     21(ptr) Variable Function
        45(param):      7(ptr) Variable Function
        45(param):      7(ptr) Variable Function
-       47(param):     10(ptr) Variable Function
               46:      6(int) Load 18(dispatchId)
               46:      6(int) Load 18(dispatchId)
                               Store 45(param) 46
                               Store 45(param) 46
-              48:   11(ivec2) FunctionCall 15(testLoad(u1;block--u1[0]1;) 45(param) 47(param)
-                              Store 42(result) 48
-              52:          49 Load 51(g_output)
-              53:      6(int) Load 18(dispatchId)
-              54:   11(ivec2) Load 42(result)
-                              ImageWrite 52 53 54
+              47:   11(ivec2) FunctionCall 15(testLoad(u1;block--u1[0]1;) 45(param) 44(g_input)
+                              Store 43(result) 47
+              51:          48 Load 50(g_output)
+              52:      6(int) Load 18(dispatchId)
+              53:   11(ivec2) Load 43(result)
+                              ImageWrite 51 52 53
                               Return
                               Return
                               FunctionEnd
                               FunctionEnd

+ 11 - 0
3rdparty/glslang/Test/hlsl.PointSize.geom

@@ -0,0 +1,11 @@
+struct S {
+    [[vk::builtin("PointSize")]] float ps;
+};
+
+[maxvertexcount(4)]
+void main([[vk::builtin("PointSize")]] triangle in uint ps[3],
+       inout LineStream<S> OutputStream)
+{
+    S s;
+    OutputStream.Append(s);
+}

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

@@ -0,0 +1,4 @@
+[[vk::builtin("PointSize")]] float main() 
+{
+    return 2.3;
+}

+ 74 - 0
3rdparty/glslang/Test/hlsl.color.hull.tesc

@@ -0,0 +1,74 @@
+/////////////
+// GLOBALS //
+/////////////
+cbuffer TessellationBuffer : register(b0)
+{
+    float tessellationAmount;
+    float3 padding;
+};
+
+
+//////////////
+// TYPEDEFS //
+//////////////
+struct HullInputType
+{
+    float3 position : POSITION;
+    float4 color : COLOR;
+};
+
+struct ConstantOutputType
+{
+    float edges[3] : SV_TessFactor;
+    float inside : SV_InsideTessFactor;
+};
+
+struct HullOutputType
+{
+    float3 position : POSITION;
+    float4 color : COLOR;
+};
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Patch Constant Function
+////////////////////////////////////////////////////////////////////////////////
+ConstantOutputType ColorPatchConstantFunction(InputPatch<HullInputType, 3> inputPatch, uint patchId : SV_PrimitiveID)
+{
+    ConstantOutputType output;
+
+
+	// Set the tessellation factors for the three edges of the triangle.
+    output.edges[0] = tessellationAmount;
+    output.edges[1] = tessellationAmount;
+    output.edges[2] = tessellationAmount;
+
+	// Set the tessellation factor for tessallating inside the triangle.
+    output.inside = tessellationAmount;
+
+    return output;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Hull Shader
+////////////////////////////////////////////////////////////////////////////////
+[domain("tri")]
+[partitioning("integer")]
+[outputtopology("triangle_cw")]
+[outputcontrolpoints(3)]
+[patchconstantfunc("ColorPatchConstantFunction")]
+
+HullOutputType main(InputPatch<HullInputType, 3> patch, uint pointId : SV_OutputControlPointID, uint patchId : SV_PrimitiveID)
+{
+    HullOutputType output;
+
+    // Set the position for this control point as the output position.
+    output.position = patch[pointId].position;
+
+	// Set the input color as the output color.
+    output.color = patch[pointId].color;
+
+    return output;
+}
+

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

@@ -22,5 +22,6 @@ float4 main() : SV_TARGET0
     res += lookUp(tex2);
     res += lookUp(tex2);
     FxaaTex tex3 = tex1;
     FxaaTex tex3 = tex1;
     res += lookUp(tex3);
     res += lookUp(tex3);
+
     return res;
     return res;
 }
 }

+ 7 - 0
3rdparty/glslang/Test/hlsl.layoutOverride.vert

@@ -0,0 +1,7 @@
+layout(set=2,binding=0) Texture2D tex : register(t16);
+SamplerState samp;
+
+float4 main() : SV_Position 
+{
+    return tex.Sample(samp, float2(0.2, 0.3));
+}

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

@@ -133,6 +133,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.clipdistance-8.vert", "main"},
         {"hlsl.clipdistance-8.vert", "main"},
         {"hlsl.clipdistance-9.frag", "main"},
         {"hlsl.clipdistance-9.frag", "main"},
         {"hlsl.clipdistance-9.vert", "main"},
         {"hlsl.clipdistance-9.vert", "main"},
+        {"hlsl.color.hull.tesc", "main"},
         {"hlsl.comparison.vec.frag", "main"},
         {"hlsl.comparison.vec.frag", "main"},
         {"hlsl.conditional.frag", "PixelShaderFunction"},
         {"hlsl.conditional.frag", "PixelShaderFunction"},
         {"hlsl.constantbuffer.frag", "main"},
         {"hlsl.constantbuffer.frag", "main"},
@@ -211,6 +212,7 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.intrinsics.promote.down.frag", "main"},
         {"hlsl.intrinsics.promote.down.frag", "main"},
         {"hlsl.intrinsics.promote.outputs.frag", "main"},
         {"hlsl.intrinsics.promote.outputs.frag", "main"},
         {"hlsl.layout.frag", "main"},
         {"hlsl.layout.frag", "main"},
+        {"hlsl.layoutOverride.vert", "main"},
         {"hlsl.load.2dms.dx10.frag", "main"},
         {"hlsl.load.2dms.dx10.frag", "main"},
         {"hlsl.load.array.dx10.frag", "main"},
         {"hlsl.load.array.dx10.frag", "main"},
         {"hlsl.load.basic.dx10.frag", "main"},
         {"hlsl.load.basic.dx10.frag", "main"},
@@ -252,6 +254,8 @@ INSTANTIATE_TEST_CASE_P(
         {"hlsl.params.default.negative.frag", "main"},
         {"hlsl.params.default.negative.frag", "main"},
         {"hlsl.partialInit.frag", "PixelShaderFunction"},
         {"hlsl.partialInit.frag", "PixelShaderFunction"},
         {"hlsl.partialFlattenLocal.vert", "main"},
         {"hlsl.partialFlattenLocal.vert", "main"},
+        {"hlsl.PointSize.geom", "main"},
+        {"hlsl.PointSize.vert", "main"},
         {"hlsl.pp.vert", "main"},
         {"hlsl.pp.vert", "main"},
         {"hlsl.pp.line.frag", "main"},
         {"hlsl.pp.line.frag", "main"},
         {"hlsl.precise.frag", "main"},
         {"hlsl.precise.frag", "main"},

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

@@ -60,6 +60,8 @@ namespace glslang {
                 return EatBinding;
                 return EatBinding;
             else if (lowername == "global_cbuffer_binding")
             else if (lowername == "global_cbuffer_binding")
                 return EatGlobalBinding;
                 return EatGlobalBinding;
+            else if (lowername == "builtin")
+                return EatBuiltIn;
         } else if (lowernameSpace.size() > 0)
         } else if (lowernameSpace.size() > 0)
             return EatNone;
             return EatNone;
 
 
@@ -177,7 +179,7 @@ namespace glslang {
         const TConstUnion* constVal = &attrAgg->getSequence()[argNum]->getAsConstantUnion()->getConstArray()[0];
         const TConstUnion* constVal = &attrAgg->getSequence()[argNum]->getAsConstantUnion()->getConstArray()[0];
         if (constVal == nullptr || constVal->getType() != basicType)
         if (constVal == nullptr || constVal->getType() != basicType)
             return nullptr;
             return nullptr;
-        
+
         return constVal;
         return constVal;
     }
     }
 
 

+ 4 - 1
3rdparty/glslang/hlsl/hlslAttributes.h

@@ -66,7 +66,8 @@ namespace glslang {
         EatBinding,
         EatBinding,
         EatGlobalBinding,
         EatGlobalBinding,
         EatLocation,
         EatLocation,
-        EatInputAttachment
+        EatInputAttachment,
+        EatBuiltIn
     };
     };
 }
 }
 
 
@@ -84,6 +85,8 @@ namespace glslang {
 
 
     class TAttributeMap {
     class TAttributeMap {
     public:
     public:
+        int size() const { return (int)attributes.size(); }
+
         // Search for and potentially add the attribute into the map.  Return the
         // Search for and potentially add the attribute into the map.  Return the
         // attribute type enum for it, if found, else EatNone.
         // attribute type enum for it, if found, else EatNone.
         TAttributeType setAttribute(const TString& nameSpace, const TString* name, TIntermAggregate* value);
         TAttributeType setAttribute(const TString& nameSpace, const TString* name, TIntermAggregate* value);

+ 11 - 3
3rdparty/glslang/hlsl/hlslGrammar.cpp

@@ -478,6 +478,8 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
                 if (typedefDecl)
                 if (typedefDecl)
                     parseContext.declareTypedef(idToken.loc, *fullName, variableType);
                     parseContext.declareTypedef(idToken.loc, *fullName, variableType);
                 else if (variableType.getBasicType() == EbtBlock) {
                 else if (variableType.getBasicType() == EbtBlock) {
+                    if (expressionNode)
+                        parseContext.error(idToken.loc, "buffer aliasing not yet supported", "block initializer", "");
                     parseContext.declareBlock(idToken.loc, variableType, fullName,
                     parseContext.declareBlock(idToken.loc, variableType, fullName,
                                               variableType.isArray() ? &variableType.getArraySizes() : nullptr);
                                               variableType.isArray() ? &variableType.getArraySizes() : nullptr);
                     parseContext.declareStructBufferCounter(idToken.loc, variableType, *fullName);
                     parseContext.declareStructBufferCounter(idToken.loc, variableType, *fullName);
@@ -2302,8 +2304,8 @@ bool HlslGrammar::acceptStructBufferType(TType& type)
 //      : struct_declaration SEMI_COLON struct_declaration SEMI_COLON ...
 //      : struct_declaration SEMI_COLON struct_declaration SEMI_COLON ...
 //
 //
 // struct_declaration
 // struct_declaration
-//      : fully_specified_type struct_declarator COMMA struct_declarator ...
-//      | fully_specified_type IDENTIFIER function_parameters post_decls compound_statement // member-function definition
+//      : attributes fully_specified_type struct_declarator COMMA struct_declarator ...
+//      | attributes fully_specified_type IDENTIFIER function_parameters post_decls compound_statement // member-function definition
 //
 //
 // struct_declarator
 // struct_declarator
 //      : IDENTIFIER post_decls
 //      : IDENTIFIER post_decls
@@ -2322,7 +2324,11 @@ bool HlslGrammar::acceptStructDeclarationList(TTypeList*& typeList, TIntermNode*
             break;
             break;
 
 
         // struct_declaration
         // struct_declaration
-    
+
+        // attributes
+        TAttributeMap attributes;
+        acceptAttributes(attributes);
+
         bool declarator_list = false;
         bool declarator_list = false;
 
 
         // fully_specified_type
         // fully_specified_type
@@ -2332,6 +2338,8 @@ bool HlslGrammar::acceptStructDeclarationList(TTypeList*& typeList, TIntermNode*
             return false;
             return false;
         }
         }
 
 
+        parseContext.transferTypeAttributes(attributes, memberType);
+
         // struct_declarator COMMA struct_declarator ...
         // struct_declarator COMMA struct_declarator ...
         bool functionDefinitionAccepted = false;
         bool functionDefinitionAccepted = false;
         do {
         do {

+ 20 - 5
3rdparty/glslang/hlsl/hlslParseHelper.cpp

@@ -1160,7 +1160,7 @@ bool HlslParseContext::shouldFlatten(const TType& type, TStorageQualifier qualif
         return (type.isArray() && intermediate.getFlattenUniformArrays() && topLevel) ||
         return (type.isArray() && intermediate.getFlattenUniformArrays() && topLevel) ||
                (type.isStruct() && type.containsOpaque());
                (type.isStruct() && type.containsOpaque());
     default:
     default:
-        return type.isStruct() && type.containsOpaque();
+        return false;
     };
     };
 }
 }
 
 
@@ -1854,6 +1854,9 @@ void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const T
 // attributes.
 // attributes.
 void HlslParseContext::transferTypeAttributes(const TAttributeMap& attributes, TType& type)
 void HlslParseContext::transferTypeAttributes(const TAttributeMap& attributes, TType& type)
 {
 {
+    if (attributes.size() == 0)
+        return;
+
     // location
     // location
     int value;
     int value;
     if (attributes.getInt(EatLocation, value))
     if (attributes.getInt(EatLocation, value))
@@ -1880,6 +1883,13 @@ void HlslParseContext::transferTypeAttributes(const TAttributeMap& attributes, T
     // input attachment
     // input attachment
     if (attributes.getInt(EatInputAttachment, value))
     if (attributes.getInt(EatInputAttachment, value))
         type.getQualifier().layoutAttachment = value;
         type.getQualifier().layoutAttachment = value;
+
+    // PointSize built-in
+    TString builtInString;
+    if (attributes.getString(EatBuiltIn, builtInString, 0, false)) {
+        if (builtInString == "PointSize")
+            type.getQualifier().builtIn = EbvPointSize;
+    }
 }
 }
 
 
 //
 //
@@ -5846,7 +5856,10 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
     case 'c':
     case 'c':
     case 's':
     case 's':
     case 'u':
     case 'u':
-        qualifier.layoutBinding = regNumber + subComponent;
+        // if nothing else has set the binding, do so now
+        // (other mechanisms override this one)
+        if (!qualifier.hasBinding())
+            qualifier.layoutBinding = regNumber + subComponent;
 
 
         // This handles per-register layout sets numbers.  For the global mode which sets
         // This handles per-register layout sets numbers.  For the global mode which sets
         // every symbol to the same value, see setLinkageLayoutSets().
         // every symbol to the same value, see setLinkageLayoutSets().
@@ -5880,7 +5893,9 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
         return true;
         return true;
     };
     };
 
 
-    if (spaceDesc) {
+    // if nothing else has set the set, do so now
+    // (other mechanisms override this one)
+    if (spaceDesc && !qualifier.hasSet()) {
         if (! crackSpace()) {
         if (! crackSpace()) {
             error(loc, "expected spaceN", "register", "");
             error(loc, "expected spaceN", "register", "");
             return;
             return;
@@ -8985,7 +9000,7 @@ bool HlslParseContext::isInputBuiltIn(const TQualifier& qualifier) const
     case EbvVertexIndex:
     case EbvVertexIndex:
         return language == EShLangVertex;
         return language == EShLangVertex;
     case EbvPrimitiveId:
     case EbvPrimitiveId:
-        return language == EShLangGeometry || language == EShLangFragment;
+        return language == EShLangGeometry || language == EShLangFragment || language == EShLangTessControl;
     case EbvTessLevelInner:
     case EbvTessLevelInner:
     case EbvTessLevelOuter:
     case EbvTessLevelOuter:
         return language == EShLangTessEvaluation;
         return language == EShLangTessEvaluation;
@@ -9033,7 +9048,7 @@ bool HlslParseContext::isOutputBuiltIn(const TQualifier& qualifier) const
     case EbvViewportIndex:
     case EbvViewportIndex:
         return language == EShLangGeometry;
         return language == EShLangGeometry;
     case EbvPrimitiveId:
     case EbvPrimitiveId:
-        return language == EShLangGeometry || language == EShLangTessControl || language == EShLangTessEvaluation;
+        return language == EShLangGeometry;
     case EbvTessLevelInner:
     case EbvTessLevelInner:
     case EbvTessLevelOuter:
     case EbvTessLevelOuter:
         return language == EShLangTessControl;
         return language == EShLangTessControl;