Merge remote-tracking branch 'GitHub/master'
diff --git a/.appveyor.yml b/.appveyor.yml
index 33a6837..07e269b 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -17,6 +17,13 @@
   only:
     - master
 
+# Travis advances the master-tot tag to current top of the tree after
+# each push into the master branch, because it relies on that tag to
+# upload build artifacts to the master-tot release. This will cause
+# double testing for each push on Appveyor: one for the push, one for
+# the tag advance. Disable testing tags.
+skip_tags: true
+
 clone_depth: 5
 
 matrix:
diff --git a/.travis.yml b/.travis.yml
index 0237d25..4fe4b5e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,8 +11,11 @@
 dist: trusty
 
 env:
-  - GLSLANG_BUILD_TYPE=Release
-  - GLSLANG_BUILD_TYPE=Debug
+  global:
+    - secure: aGFrgzyKp+84hKrGkxVWg8cHV61uqrKEHT38gfSQK6+WS4GfLOyH83p7WnsEBb7AMhzU7LMNFdvOFr6+NaMpVnqRvc40CEG1Q+lNg9Pq9mhIZLowvDrfqTL9kQ+8Nbw5Q6/dg6CTvY7fvRfpfCEmKIUZBRkoKUuHeuM1uy3IupFcdNuL5bSYn3Beo+apSJginh9DI4BLDXFUgBzTRSLLyCX5g3cpaeGGOCr8quJlYx75W6HRck5g9SZuLtUoH9GFEV3l+ZEWB8noErW+J56L03bwNwFuuAh321evw++oQk5KFa8rlDvar3SJ3b1RHB8u/eq5DBYMyaK/fS8+Q7QbGr8diF/wDe68bKO7U9IhpNfExXmczCpExjHomW5TQv4rYdGhygPMfW97aIsPRYyNKcl4fkmb7NDrM8w0Jscdq2g5c2Kz0ItyZoBri/NXLwFQQjaVCs7Pf97TjuMA7mK0GJmDTRzi6SrDYlWMt5BQL3y0CCojyfLIRcTh0CQjQI29s97bLfQrYAxt9GNNFR+HTXRLLrkaAlJkPGEPwUywlSfEThnvHLesNxYqemolAYpQT4ithoL4GehGIHmaxsW295aKVhuRf8K9eBODNqrfblvM42UHhjntT+92ZnQ/Gkq80GqaMxnxi4PO5FyPIxt0r981b54YBkWi8YA4P7w5pNI=
+  matrix:
+    - GLSLANG_BUILD_TYPE=Release
+    - GLSLANG_BUILD_TYPE=Debug
 
 compiler:
   - clang
@@ -75,3 +78,46 @@
       ctest --output-on-failure &&
       cd ../Test && ./runtests;
     fi
+
+after_success:
+  # For debug build, the generated dll has a postfix "d" in its name.
+  - if [[ "${GLSLANG_BUILD_TYPE}" == "Debug" ]]; then
+      export SUFFIX="d";
+    else
+      export SUFFIX="";
+    fi
+  # Create tarball for deployment
+  - if [[ ${CC} == clang* && "${BUILD_NDK}" != "ON" ]]; then
+      cd ../build/install;
+      export TARBALL=glslang-master-${TRAVIS_OS_NAME}-${GLSLANG_BUILD_TYPE}.zip;
+      zip ${TARBALL}
+        bin/glslangValidator
+        include/glslang/*
+        include/SPIRV/*
+        lib/libglslang${SUFFIX}.a
+        lib/libHLSL${SUFFIX}.a
+        lib/libOGLCompiler${SUFFIX}.a
+        lib/libOSDependent${SUFFIX}.a
+        lib/libSPIRV${SUFFIX}.a
+        lib/libSPVRemapper${SUFFIX}.a
+        lib/libSPIRV-Tools${SUFFIX}.a
+        lib/libSPIRV-Tools-opt${SUFFIX}.a;
+    fi
+
+before_deploy:
+  # Tag the current top of the tree as "master-tot".
+  # Travis CI replies on the tag name to properly push to GitHub Releases.
+  - git config --global user.name "Travis CI"
+  - git config --global user.email "builds@travis-ci.org"
+  - git tag -f master-tot
+  - git push -q -f https://${glslangtoken}@github.com/KhronosGroup/glslang --tags
+
+deploy:
+  provider: releases
+  api_key: ${glslangtoken}
+  on:
+    branch: master
+    condition: ${CC} == clang* && ${BUILD_NDK} != ON
+  file: ${TARBALL}
+  skip_cleanup: true
+  overwrite: true
diff --git a/OGLCompilersDLL/InitializeDll.cpp b/OGLCompilersDLL/InitializeDll.cpp
index 2eb912c..abea910 100644
--- a/OGLCompilersDLL/InitializeDll.cpp
+++ b/OGLCompilersDLL/InitializeDll.cpp
@@ -38,13 +38,17 @@
 
 #include "InitializeDll.h"
 #include "../glslang/Include/InitializeGlobals.h"
-
 #include "../glslang/Public/ShaderLang.h"
+#include "../glslang/Include/PoolAlloc.h"
 
 namespace glslang {
 
 OS_TLSIndex ThreadInitializeIndex = OS_INVALID_TLS_INDEX;
 
+// Per-process initialization.
+// Needs to be called at least once before parsing, etc. is done.
+// Will also do thread initialization for the calling thread; other
+// threads will need to do that explicitly.
 bool InitProcess()
 {
     glslang::GetGlobalLock();
@@ -85,7 +89,9 @@
     return true;
 }
 
-
+// Per-thread scoped initialization.
+// Must be called at least once by each new thread sharing the
+// symbol tables, etc., needed to parse.
 bool InitThread()
 {
     //
@@ -99,17 +105,21 @@
     if (OS_GetTLSValue(ThreadInitializeIndex) != 0)
         return true;
 
-    InitializeMemoryPools();
-
     if (! OS_SetTLSValue(ThreadInitializeIndex, (void *)1)) {
         assert(0 && "InitThread(): Unable to set init flag.");
         return false;
     }
 
+    glslang::SetThreadPoolAllocator(nullptr);
+
     return true;
 }
 
-
+// Not necessary to call this: InitThread() is reentrant, and the need
+// to do per thread tear down has been removed.
+//
+// This is kept, with memory management removed, to satisfy any exiting
+// calls to it that rely on it.
 bool DetachThread()
 {
     bool success = true;
@@ -125,14 +135,18 @@
             assert(0 && "DetachThread(): Unable to clear init flag.");
             success = false;
         }
-
-        FreeGlobalPools();
-
     }
 
     return success;
 }
 
+// Not necessary to call this: InitProcess() is reentrant.
+//
+// This is kept, with memory management removed, to satisfy any exiting
+// calls to it that rely on it.
+//
+// Users of glslang should call shFinalize() or glslang::FinalizeProcess() for
+// process-scoped memory tear down.
 bool DetachProcess()
 {
     bool success = true;
@@ -140,12 +154,8 @@
     if (ThreadInitializeIndex == OS_INVALID_TLS_INDEX)
         return true;
 
-    ShFinalize();
-
     success = DetachThread();
 
-    FreePoolIndex();
-
     OS_FreeTLSIndex(ThreadInitializeIndex);
     ThreadInitializeIndex = OS_INVALID_TLS_INDEX;
 
diff --git a/OGLCompilersDLL/InitializeDll.h b/OGLCompilersDLL/InitializeDll.h
index 60b2b15..661cee4 100644
--- a/OGLCompilersDLL/InitializeDll.h
+++ b/OGLCompilersDLL/InitializeDll.h
@@ -40,8 +40,8 @@
 
 bool InitProcess();
 bool InitThread();
-bool DetachThread();
-bool DetachProcess();
+bool DetachThread();  // not called from standalone, perhaps other tools rely on parts of it
+bool DetachProcess(); // not called from standalone, perhaps other tools rely on parts of it
 
 } // end namespace glslang
 
diff --git a/README.md b/README.md
index 504447e..e82fea9 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,12 @@
 Building
 --------
 
+Instead of building manually, you can also download the binaries for your
+platform directly from the [master-tot release][master-tot-release] on GitHub.
+Those binaries are automatically uploaded by the buildbots after successful
+testing and they always reflect the current top of the tree of the master
+branch.
+
 ### Dependencies
 
 * [CMake][cmake]: for generating compilation targets.
@@ -275,3 +281,4 @@
 [bison]: https://www.gnu.org/software/bison/
 [googletest]: https://github.com/google/googletest
 [bison-gnu-win32]: http://gnuwin32.sourceforge.net/packages/bison.htm
+[master-tot-release]: https://github.com/KhronosGroup/glslang/releases/tag/master-tot
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index d20de0e..5f522aa 100644
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -482,7 +482,6 @@
         return spv::BuiltInSamplePosition;
 
     case glslang::EbvSampleMask:
-        builder.addCapability(spv::CapabilitySampleRateShading);
         return spv::BuiltInSampleMask;
 
     case glslang::EbvLayer:
diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp
index 003c03b..81df60f 100644
--- a/StandAlone/StandAlone.cpp
+++ b/StandAlone/StandAlone.cpp
@@ -127,6 +127,9 @@
 bool CompileFailed = false;
 bool LinkFailed = false;
 
+// array of unique places to leave the shader names and infologs for the asynchronous compiles
+std::vector<std::unique_ptr<glslang::TWorkItem>> WorkItems;
+
 TBuiltInResource Resources;
 std::string ConfigFile;
 
@@ -1026,14 +1029,10 @@
         FreeFileData(const_cast<char*>(it->text[0]));
 }
 
-int C_DECL main(int argc, char* argv[])
+int singleMain()
 {
-    // array of unique places to leave the shader names and infologs for the asynchronous compiles
-    std::vector<std::unique_ptr<glslang::TWorkItem>> workItems;
-    ProcessArguments(workItems, argc, argv);
-
     glslang::TWorklist workList;
-    std::for_each(workItems.begin(), workItems.end(), [&workList](std::unique_ptr<glslang::TWorkItem>& item) {
+    std::for_each(WorkItems.begin(), WorkItems.end(), [&workList](std::unique_ptr<glslang::TWorkItem>& item) {
         assert(item);
         workList.add(item.get());
     });
@@ -1065,8 +1064,8 @@
     }
 
     if (Options & EOptionStdin) {
-        workItems.push_back(std::unique_ptr<glslang::TWorkItem>{new glslang::TWorkItem("stdin")});
-        workList.add(workItems.back().get());
+        WorkItems.push_back(std::unique_ptr<glslang::TWorkItem>{new glslang::TWorkItem("stdin")});
+        workList.add(WorkItems.back().get());
     }
 
     ProcessConfigFile();
@@ -1079,21 +1078,24 @@
     if (Options & EOptionLinkProgram ||
         Options & EOptionOutputPreprocessed) {
         glslang::InitializeProcess();
+        glslang::InitializeProcess();  // also test reference counting of users
+        glslang::InitializeProcess();  // also test reference counting of users
+        glslang::FinalizeProcess();    // also test reference counting of users
+        glslang::FinalizeProcess();    // also test reference counting of users
         CompileAndLinkShaderFiles(workList);
         glslang::FinalizeProcess();
     } else {
         ShInitialize();
+        ShInitialize();  // also test reference counting of users
+        ShFinalize();    // also test reference counting of users
 
         bool printShaderNames = workList.size() > 1;
 
-        if (Options & EOptionMultiThreaded)
-        {
+        if (Options & EOptionMultiThreaded) {
             std::array<std::thread, 16> threads;
-            for (unsigned int t = 0; t < threads.size(); ++t)
-            {
+            for (unsigned int t = 0; t < threads.size(); ++t) {
                 threads[t] = std::thread(CompileShaders, std::ref(workList));
-                if (threads[t].get_id() == std::thread::id())
-                {
+                if (threads[t].get_id() == std::thread::id()) {
                     fprintf(stderr, "Failed to create thread\n");
                     return EFailThreadCreate;
                 }
@@ -1104,11 +1106,11 @@
             CompileShaders(workList);
 
         // Print out all the resulting infologs
-        for (size_t w = 0; w < workItems.size(); ++w) {
-            if (workItems[w]) {
-                if (printShaderNames || workItems[w]->results.size() > 0)
-                    PutsIfNonEmpty(workItems[w]->name.c_str());
-                PutsIfNonEmpty(workItems[w]->results.c_str());
+        for (size_t w = 0; w < WorkItems.size(); ++w) {
+            if (WorkItems[w]) {
+                if (printShaderNames || WorkItems[w]->results.size() > 0)
+                    PutsIfNonEmpty(WorkItems[w]->name.c_str());
+                PutsIfNonEmpty(WorkItems[w]->results.c_str());
             }
         }
 
@@ -1123,6 +1125,25 @@
     return 0;
 }
 
+int C_DECL main(int argc, char* argv[])
+{
+    ProcessArguments(WorkItems, argc, argv);
+
+    int ret = 0;
+
+    // Loop over the entire init/finalize cycle to watch memory changes
+    const int iterations = 1;
+    if (iterations > 1)
+        glslang::OS_DumpMemoryCounters();
+    for (int i = 0; i < iterations; ++i) {
+        ret = singleMain();
+        if (iterations > 1)
+            glslang::OS_DumpMemoryCounters();
+    }
+
+    return ret;
+}
+
 //
 //   Deduce the language from the filename.  Files must end in one of the
 //   following extensions:
@@ -1277,7 +1298,7 @@
            "  -o <file>   save binary to <file>, requires a binary option (e.g., -V)\n"
            "  -q          dump reflection query database\n"
            "  -r          synonym for --relaxed-errors\n"
-           "  -s          silent mode\n"
+           "  -s          silence syntax and semantic error reporting\n"
            "  -t          multi-threaded mode\n"
            "  -v          print version strings\n"
            "  -w          synonym for --suppress-warnings\n"
diff --git a/Test/baseLegalResults/hlsl.flattenSubset2.frag.out b/Test/baseLegalResults/hlsl.flattenSubset2.frag.out
new file mode 100755
index 0000000..724ae7b
--- /dev/null
+++ b/Test/baseLegalResults/hlsl.flattenSubset2.frag.out
@@ -0,0 +1,37 @@
+hlsl.flattenSubset2.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 44
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 40 43
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 31  "someTex"
+                              Name 40  "vpos"
+                              Name 43  "@entryPointOutput"
+                              Decorate 31(someTex) DescriptorSet 0
+                              Decorate 40(vpos) Location 0
+                              Decorate 43(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+              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
+         4(main):           2 Function None 3
+               5:             Label
+                              Store 43(@entryPointOutput) 35
+                              Return
+                              FunctionEnd
diff --git a/Test/baseLegalResults/hlsl.partialFlattenLocal.vert.out b/Test/baseLegalResults/hlsl.partialFlattenLocal.vert.out
new file mode 100755
index 0000000..ed3102e
--- /dev/null
+++ b/Test/baseLegalResults/hlsl.partialFlattenLocal.vert.out
@@ -0,0 +1,91 @@
+hlsl.partialFlattenLocal.vert
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 148
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 90 93
+                              Source HLSL 500
+                              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
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+              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
+         4(main):           2 Function None 3
+               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
+                              Return
+                              FunctionEnd
diff --git a/Test/baseLegalResults/hlsl.partialFlattenMixed.vert.out b/Test/baseLegalResults/hlsl.partialFlattenMixed.vert.out
new file mode 100755
index 0000000..d57566b
--- /dev/null
+++ b/Test/baseLegalResults/hlsl.partialFlattenMixed.vert.out
@@ -0,0 +1,38 @@
+hlsl.partialFlattenMixed.vert
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 31
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 27 30
+                              Source HLSL 500
+                              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
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               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
+         4(main):           2 Function None 3
+               5:             Label
+              28:    7(fvec4) Load 27(pos)
+                              Store 30(@entryPointOutput) 28
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.gs-hs-mix.tesc.out b/Test/baseResults/hlsl.gs-hs-mix.tesc.out
new file mode 100644
index 0000000..92153c5
--- /dev/null
+++ b/Test/baseResults/hlsl.gs-hs-mix.tesc.out
@@ -0,0 +1,1158 @@
+hlsl.gs-hs-mix.tesc
+Shader version: 500
+vertices = 3
+input primitive = triangles
+vertex spacing = fractional_odd_spacing
+triangle order = ccw
+0:? Sequence
+0:31  Function Definition: HSPatchConstant(struct-HSInput-vf3-vf31[3]; ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:31    Function Parameters: 
+0:31      'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?     Sequence
+0:32      Sequence
+0:32        move second child to first child ( temp 3-component vector of float)
+0:32          'roundedEdgeTessFactor' ( temp 3-component vector of float)
+0:32          tess_factor: direct index for structure (layout( row_major std140) uniform 3-component vector of float)
+0:32            'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float model_view_matrix, layout( row_major std140) uniform 4X4 matrix of float proj_matrix, layout( row_major std140) uniform 4X4 matrix of float model_view_proj_matrix, layout( row_major std140) uniform 3X3 matrix of float normal_matrix, layout( row_major std140) uniform 3-component vector of float color, layout( row_major std140) uniform 3-component vector of float view_dir, layout( row_major std140) uniform 3-component vector of float tess_factor})
+0:32            Constant:
+0:32              6 (const uint)
+0:33      Sequence
+0:33        move second child to first child ( temp float)
+0:33          'roundedInsideTessFactor' ( temp float)
+0:33          Constant:
+0:33            3.000000
+0:34      Sequence
+0:34        move second child to first child ( temp float)
+0:34          'insideTessFactor' ( temp float)
+0:34          Constant:
+0:34            1.000000
+0:39      move second child to first child ( temp float)
+0:39        direct index ( temp float)
+0:39          EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:39            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:39            Constant:
+0:39              0 (const int)
+0:39          Constant:
+0:39            0 (const int)
+0:39        direct index ( temp float)
+0:39          'roundedEdgeTessFactor' ( temp 3-component vector of float)
+0:39          Constant:
+0:39            0 (const int)
+0:40      move second child to first child ( temp float)
+0:40        direct index ( temp float)
+0:40          EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:40            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:40            Constant:
+0:40              0 (const int)
+0:40          Constant:
+0:40            1 (const int)
+0:40        direct index ( temp float)
+0:40          'roundedEdgeTessFactor' ( temp 3-component vector of float)
+0:40          Constant:
+0:40            1 (const int)
+0:41      move second child to first child ( temp float)
+0:41        direct index ( temp float)
+0:41          EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:41            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:41            Constant:
+0:41              0 (const int)
+0:41          Constant:
+0:41            2 (const int)
+0:41        direct index ( temp float)
+0:41          'roundedEdgeTessFactor' ( temp 3-component vector of float)
+0:41          Constant:
+0:41            2 (const int)
+0:42      move second child to first child ( temp float)
+0:42        InsideTessFactor: direct index for structure ( temp float)
+0:42          'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:42          Constant:
+0:42            1 (const int)
+0:42        'roundedInsideTessFactor' ( temp float)
+0:45      move second child to first child ( temp 3-component vector of float)
+0:45        direct index ( temp 3-component vector of float)
+0:45          NormalWS: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:45            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:45            Constant:
+0:45              2 (const int)
+0:45          Constant:
+0:45            0 (const int)
+0:45        NormalWS: direct index for structure ( temp 3-component vector of float)
+0:45          direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:45            'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:45            Constant:
+0:45              0 (const int)
+0:45          Constant:
+0:45            1 (const int)
+0:46      move second child to first child ( temp 3-component vector of float)
+0:46        direct index ( temp 3-component vector of float)
+0:46          NormalWS: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:46            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:46            Constant:
+0:46              2 (const int)
+0:46          Constant:
+0:46            1 (const int)
+0:46        NormalWS: direct index for structure ( temp 3-component vector of float)
+0:46          direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:46            'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:46            Constant:
+0:46              1 (const int)
+0:46          Constant:
+0:46            1 (const int)
+0:47      move second child to first child ( temp 3-component vector of float)
+0:47        direct index ( temp 3-component vector of float)
+0:47          NormalWS: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:47            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:47            Constant:
+0:47              2 (const int)
+0:47          Constant:
+0:47            2 (const int)
+0:47        NormalWS: direct index for structure ( temp 3-component vector of float)
+0:47          direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:47            'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:47            Constant:
+0:47              2 (const int)
+0:47          Constant:
+0:47            1 (const int)
+0:49      Branch: Return with expression
+0:49        'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:61  Function Definition: @HSMain(struct-HSInput-vf3-vf31[3];u1; ( temp structure{ temp 3-component vector of float PositionWS})
+0:61    Function Parameters: 
+0:61      'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:61      'id' ( in uint)
+0:?     Sequence
+0:63      move second child to first child ( temp 3-component vector of float)
+0:63        PositionWS: direct index for structure ( temp 3-component vector of float)
+0:63          'output' ( temp structure{ temp 3-component vector of float PositionWS})
+0:63          Constant:
+0:63            0 (const int)
+0:63        PositionWS: direct index for structure ( temp 3-component vector of float)
+0:63          indirect index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:63            'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:63            'id' ( in uint)
+0:63          Constant:
+0:63            0 (const int)
+0:64      Branch: Return with expression
+0:64        'output' ( temp structure{ temp 3-component vector of float PositionWS})
+0:61  Function Definition: HSMain( ( temp void)
+0:61    Function Parameters: 
+0:?     Sequence
+0:61      move second child to first child ( temp 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?         'patch' ( temp 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?         'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:61      move second child to first child ( temp uint)
+0:?         'id' ( temp uint)
+0:?         'id' ( in uint InvocationID)
+0:61      move second child to first child ( temp structure{ temp 3-component vector of float PositionWS})
+0:61        indirect index (layout( location=0) out structure{ temp 3-component vector of float PositionWS})
+0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float PositionWS})
+0:?           'id' ( in uint InvocationID)
+0:61        Function Call: @HSMain(struct-HSInput-vf3-vf31[3];u1; ( temp structure{ temp 3-component vector of float PositionWS})
+0:?           'patch' ( temp 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?           'id' ( temp uint)
+0:?       Barrier ( temp void)
+0:?       Test condition and select ( temp void)
+0:?         Condition
+0:?         Compare Equal ( temp bool)
+0:?           'id' ( 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 EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:?             '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:?             Function Call: HSPatchConstant(struct-HSInput-vf3-vf31[3]; ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:?               'patch' ( temp 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?           Sequence
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput.EdgeTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               direct index ( temp float)
+0:?                 EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+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.EdgeTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?               direct index ( temp float)
+0:?                 EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+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.EdgeTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?               direct index ( temp float)
+0:?                 EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+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.InsideTessFactor' ( patch out 2-element array of float TessLevelInner)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               InsideTessFactor: direct index for structure ( temp float)
+0:?                 '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:?                 Constant:
+0:?                   1 (const int)
+0:?             move second child to first child ( temp 3-element array of 3-component vector of float)
+0:?               NormalWS: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:?                 '@patchConstantOutput' (layout( location=1) patch out structure{ temp 3-element array of 3-component vector of float NormalWS})
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               NormalWS: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:?                 '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:?                 Constant:
+0:?                   2 (const int)
+0:84  Function Definition: GSMain(struct-GSVertexInput-vf3-vf31[3];struct-GSVertexOutput-vf41; ( temp void)
+0:84    Function Parameters: 
+0:84      'input' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:84      'output' ( out structure{ temp 4-component vector of float PositionCS})
+0:?     Sequence
+0:86      Sequence
+0:86        move second child to first child ( temp 3-component vector of float)
+0:86          'P0' ( temp 3-component vector of float)
+0:86          vector swizzle ( temp 3-component vector of float)
+0:86            PositionWS: direct index for structure ( temp 3-component vector of float)
+0:86              direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:86                'input' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:86                Constant:
+0:86                  0 (const int)
+0:86              Constant:
+0:86                0 (const int)
+0:86            Sequence
+0:86              Constant:
+0:86                0 (const int)
+0:86              Constant:
+0:86                1 (const int)
+0:86              Constant:
+0:86                2 (const int)
+0:87      Sequence
+0:87        move second child to first child ( temp 3-component vector of float)
+0:87          'P1' ( temp 3-component vector of float)
+0:87          vector swizzle ( temp 3-component vector of float)
+0:87            PositionWS: direct index for structure ( temp 3-component vector of float)
+0:87              direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:87                'input' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:87                Constant:
+0:87                  1 (const int)
+0:87              Constant:
+0:87                0 (const int)
+0:87            Sequence
+0:87              Constant:
+0:87                0 (const int)
+0:87              Constant:
+0:87                1 (const int)
+0:87              Constant:
+0:87                2 (const int)
+0:88      Sequence
+0:88        move second child to first child ( temp 3-component vector of float)
+0:88          'P2' ( temp 3-component vector of float)
+0:88          vector swizzle ( temp 3-component vector of float)
+0:88            PositionWS: direct index for structure ( temp 3-component vector of float)
+0:88              direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:88                'input' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:88                Constant:
+0:88                  2 (const int)
+0:88              Constant:
+0:88                0 (const int)
+0:88            Sequence
+0:88              Constant:
+0:88                0 (const int)
+0:88              Constant:
+0:88                1 (const int)
+0:88              Constant:
+0:88                2 (const int)
+0:92      add second child into first child ( temp float)
+0:92        direct index ( temp float)
+0:92          'P0' ( temp 3-component vector of float)
+0:92          Constant:
+0:92            2 (const int)
+0:92        Constant:
+0:92          0.001000
+0:93      add second child into first child ( temp float)
+0:93        direct index ( temp float)
+0:93          'P1' ( temp 3-component vector of float)
+0:93          Constant:
+0:93            2 (const int)
+0:93        Constant:
+0:93          0.001000
+0:94      add second child into first child ( temp float)
+0:94        direct index ( temp float)
+0:94          'P2' ( temp 3-component vector of float)
+0:94          Constant:
+0:94            2 (const int)
+0:94        Constant:
+0:94          0.001000
+0:95      Sequence
+0:95        move second child to first child ( temp 4-component vector of float)
+0:95          'Q0' ( temp 4-component vector of float)
+0:95          vector-times-matrix ( temp 4-component vector of float)
+0:?             Construct vec4 ( temp 4-component vector of float)
+0:95              'P0' ( temp 3-component vector of float)
+0:95              Constant:
+0:95                1.000000
+0:95            proj_matrix: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
+0:95              'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float model_view_matrix, layout( row_major std140) uniform 4X4 matrix of float proj_matrix, layout( row_major std140) uniform 4X4 matrix of float model_view_proj_matrix, layout( row_major std140) uniform 3X3 matrix of float normal_matrix, layout( row_major std140) uniform 3-component vector of float color, layout( row_major std140) uniform 3-component vector of float view_dir, layout( row_major std140) uniform 3-component vector of float tess_factor})
+0:95              Constant:
+0:95                1 (const uint)
+0:96      Sequence
+0:96        move second child to first child ( temp 4-component vector of float)
+0:96          'Q1' ( temp 4-component vector of float)
+0:96          vector-times-matrix ( temp 4-component vector of float)
+0:?             Construct vec4 ( temp 4-component vector of float)
+0:96              'P1' ( temp 3-component vector of float)
+0:96              Constant:
+0:96                1.000000
+0:96            proj_matrix: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
+0:96              'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float model_view_matrix, layout( row_major std140) uniform 4X4 matrix of float proj_matrix, layout( row_major std140) uniform 4X4 matrix of float model_view_proj_matrix, layout( row_major std140) uniform 3X3 matrix of float normal_matrix, layout( row_major std140) uniform 3-component vector of float color, layout( row_major std140) uniform 3-component vector of float view_dir, layout( row_major std140) uniform 3-component vector of float tess_factor})
+0:96              Constant:
+0:96                1 (const uint)
+0:97      Sequence
+0:97        move second child to first child ( temp 4-component vector of float)
+0:97          'Q2' ( temp 4-component vector of float)
+0:97          vector-times-matrix ( temp 4-component vector of float)
+0:?             Construct vec4 ( temp 4-component vector of float)
+0:97              'P2' ( temp 3-component vector of float)
+0:97              Constant:
+0:97                1.000000
+0:97            proj_matrix: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
+0:97              'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float model_view_matrix, layout( row_major std140) uniform 4X4 matrix of float proj_matrix, layout( row_major std140) uniform 4X4 matrix of float model_view_proj_matrix, layout( row_major std140) uniform 3X3 matrix of float normal_matrix, layout( row_major std140) uniform 3-component vector of float color, layout( row_major std140) uniform 3-component vector of float view_dir, layout( row_major std140) uniform 3-component vector of float tess_factor})
+0:97              Constant:
+0:97                1 (const uint)
+0:100      move second child to first child ( temp 4-component vector of float)
+0:100        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:100          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:100          Constant:
+0:100            0 (const int)
+0:100        'Q0' ( temp 4-component vector of float)
+0:101      Constant:
+0:101        0.000000
+0:102      move second child to first child ( temp 4-component vector of float)
+0:102        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:102          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:102          Constant:
+0:102            0 (const int)
+0:102        'Q1' ( temp 4-component vector of float)
+0:103      Constant:
+0:103        0.000000
+0:104      Constant:
+0:104        0.000000
+0:107      move second child to first child ( temp 4-component vector of float)
+0:107        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:107          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:107          Constant:
+0:107            0 (const int)
+0:107        'Q1' ( temp 4-component vector of float)
+0:108      Constant:
+0:108        0.000000
+0:109      move second child to first child ( temp 4-component vector of float)
+0:109        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:109          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:109          Constant:
+0:109            0 (const int)
+0:109        'Q2' ( temp 4-component vector of float)
+0:110      Constant:
+0:110        0.000000
+0:111      Constant:
+0:111        0.000000
+0:114      move second child to first child ( temp 4-component vector of float)
+0:114        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:114          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:114          Constant:
+0:114            0 (const int)
+0:114        'Q2' ( temp 4-component vector of float)
+0:115      Constant:
+0:115        0.000000
+0:116      move second child to first child ( temp 4-component vector of float)
+0:116        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:116          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:116          Constant:
+0:116            0 (const int)
+0:116        'Q0' ( temp 4-component vector of float)
+0:117      Constant:
+0:117        0.000000
+0:118      Constant:
+0:118        0.000000
+0:?   Linker Objects
+0:?     'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float model_view_matrix, layout( row_major std140) uniform 4X4 matrix of float proj_matrix, layout( row_major std140) uniform 4X4 matrix of float model_view_proj_matrix, layout( row_major std140) uniform 3X3 matrix of float normal_matrix, layout( row_major std140) uniform 3-component vector of float color, layout( row_major std140) uniform 3-component vector of float view_dir, layout( row_major std140) uniform 3-component vector of float tess_factor})
+0:?     '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float PositionWS})
+0:?     'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?     'id' ( in uint InvocationID)
+0:?     '@patchConstantOutput.EdgeTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput.InsideTessFactor' ( patch out 2-element array of float TessLevelInner)
+0:?     '@patchConstantOutput' (layout( location=1) patch out structure{ temp 3-element array of 3-component vector of float NormalWS})
+
+
+Linked tessellation control stage:
+
+
+Shader version: 500
+vertices = 3
+input primitive = triangles
+vertex spacing = fractional_odd_spacing
+triangle order = ccw
+0:? Sequence
+0:31  Function Definition: HSPatchConstant(struct-HSInput-vf3-vf31[3]; ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:31    Function Parameters: 
+0:31      'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?     Sequence
+0:32      Sequence
+0:32        move second child to first child ( temp 3-component vector of float)
+0:32          'roundedEdgeTessFactor' ( temp 3-component vector of float)
+0:32          tess_factor: direct index for structure (layout( row_major std140) uniform 3-component vector of float)
+0:32            'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float model_view_matrix, layout( row_major std140) uniform 4X4 matrix of float proj_matrix, layout( row_major std140) uniform 4X4 matrix of float model_view_proj_matrix, layout( row_major std140) uniform 3X3 matrix of float normal_matrix, layout( row_major std140) uniform 3-component vector of float color, layout( row_major std140) uniform 3-component vector of float view_dir, layout( row_major std140) uniform 3-component vector of float tess_factor})
+0:32            Constant:
+0:32              6 (const uint)
+0:33      Sequence
+0:33        move second child to first child ( temp float)
+0:33          'roundedInsideTessFactor' ( temp float)
+0:33          Constant:
+0:33            3.000000
+0:34      Sequence
+0:34        move second child to first child ( temp float)
+0:34          'insideTessFactor' ( temp float)
+0:34          Constant:
+0:34            1.000000
+0:39      move second child to first child ( temp float)
+0:39        direct index ( temp float)
+0:39          EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:39            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:39            Constant:
+0:39              0 (const int)
+0:39          Constant:
+0:39            0 (const int)
+0:39        direct index ( temp float)
+0:39          'roundedEdgeTessFactor' ( temp 3-component vector of float)
+0:39          Constant:
+0:39            0 (const int)
+0:40      move second child to first child ( temp float)
+0:40        direct index ( temp float)
+0:40          EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:40            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:40            Constant:
+0:40              0 (const int)
+0:40          Constant:
+0:40            1 (const int)
+0:40        direct index ( temp float)
+0:40          'roundedEdgeTessFactor' ( temp 3-component vector of float)
+0:40          Constant:
+0:40            1 (const int)
+0:41      move second child to first child ( temp float)
+0:41        direct index ( temp float)
+0:41          EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:41            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:41            Constant:
+0:41              0 (const int)
+0:41          Constant:
+0:41            2 (const int)
+0:41        direct index ( temp float)
+0:41          'roundedEdgeTessFactor' ( temp 3-component vector of float)
+0:41          Constant:
+0:41            2 (const int)
+0:42      move second child to first child ( temp float)
+0:42        InsideTessFactor: direct index for structure ( temp float)
+0:42          'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:42          Constant:
+0:42            1 (const int)
+0:42        'roundedInsideTessFactor' ( temp float)
+0:45      move second child to first child ( temp 3-component vector of float)
+0:45        direct index ( temp 3-component vector of float)
+0:45          NormalWS: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:45            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:45            Constant:
+0:45              2 (const int)
+0:45          Constant:
+0:45            0 (const int)
+0:45        NormalWS: direct index for structure ( temp 3-component vector of float)
+0:45          direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:45            'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:45            Constant:
+0:45              0 (const int)
+0:45          Constant:
+0:45            1 (const int)
+0:46      move second child to first child ( temp 3-component vector of float)
+0:46        direct index ( temp 3-component vector of float)
+0:46          NormalWS: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:46            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:46            Constant:
+0:46              2 (const int)
+0:46          Constant:
+0:46            1 (const int)
+0:46        NormalWS: direct index for structure ( temp 3-component vector of float)
+0:46          direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:46            'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:46            Constant:
+0:46              1 (const int)
+0:46          Constant:
+0:46            1 (const int)
+0:47      move second child to first child ( temp 3-component vector of float)
+0:47        direct index ( temp 3-component vector of float)
+0:47          NormalWS: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:47            'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:47            Constant:
+0:47              2 (const int)
+0:47          Constant:
+0:47            2 (const int)
+0:47        NormalWS: direct index for structure ( temp 3-component vector of float)
+0:47          direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:47            'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:47            Constant:
+0:47              2 (const int)
+0:47          Constant:
+0:47            1 (const int)
+0:49      Branch: Return with expression
+0:49        'result' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:61  Function Definition: @HSMain(struct-HSInput-vf3-vf31[3];u1; ( temp structure{ temp 3-component vector of float PositionWS})
+0:61    Function Parameters: 
+0:61      'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:61      'id' ( in uint)
+0:?     Sequence
+0:63      move second child to first child ( temp 3-component vector of float)
+0:63        PositionWS: direct index for structure ( temp 3-component vector of float)
+0:63          'output' ( temp structure{ temp 3-component vector of float PositionWS})
+0:63          Constant:
+0:63            0 (const int)
+0:63        PositionWS: direct index for structure ( temp 3-component vector of float)
+0:63          indirect index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:63            'patch' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:63            'id' ( in uint)
+0:63          Constant:
+0:63            0 (const int)
+0:64      Branch: Return with expression
+0:64        'output' ( temp structure{ temp 3-component vector of float PositionWS})
+0:61  Function Definition: HSMain( ( temp void)
+0:61    Function Parameters: 
+0:?     Sequence
+0:61      move second child to first child ( temp 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?         'patch' ( temp 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?         'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:61      move second child to first child ( temp uint)
+0:?         'id' ( temp uint)
+0:?         'id' ( in uint InvocationID)
+0:61      move second child to first child ( temp structure{ temp 3-component vector of float PositionWS})
+0:61        indirect index (layout( location=0) out structure{ temp 3-component vector of float PositionWS})
+0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float PositionWS})
+0:?           'id' ( in uint InvocationID)
+0:61        Function Call: @HSMain(struct-HSInput-vf3-vf31[3];u1; ( temp structure{ temp 3-component vector of float PositionWS})
+0:?           'patch' ( temp 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?           'id' ( temp uint)
+0:?       Barrier ( temp void)
+0:?       Test condition and select ( temp void)
+0:?         Condition
+0:?         Compare Equal ( temp bool)
+0:?           'id' ( 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 EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:?             '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:?             Function Call: HSPatchConstant(struct-HSInput-vf3-vf31[3]; ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:?               'patch' ( temp 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?           Sequence
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput.EdgeTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               direct index ( temp float)
+0:?                 EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+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.EdgeTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?               direct index ( temp float)
+0:?                 EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+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.EdgeTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?               direct index ( temp float)
+0:?                 EdgeTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+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.InsideTessFactor' ( patch out 2-element array of float TessLevelInner)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               InsideTessFactor: direct index for structure ( temp float)
+0:?                 '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:?                 Constant:
+0:?                   1 (const int)
+0:?             move second child to first child ( temp 3-element array of 3-component vector of float)
+0:?               NormalWS: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:?                 '@patchConstantOutput' (layout( location=1) patch out structure{ temp 3-element array of 3-component vector of float NormalWS})
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               NormalWS: direct index for structure ( temp 3-element array of 3-component vector of float)
+0:?                 '@patchConstantResult' ( temp structure{ temp 3-element array of float EdgeTessFactor,  temp float InsideTessFactor,  temp 3-element array of 3-component vector of float NormalWS})
+0:?                 Constant:
+0:?                   2 (const int)
+0:84  Function Definition: GSMain(struct-GSVertexInput-vf3-vf31[3];struct-GSVertexOutput-vf41; ( temp void)
+0:84    Function Parameters: 
+0:84      'input' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:84      'output' ( out structure{ temp 4-component vector of float PositionCS})
+0:?     Sequence
+0:86      Sequence
+0:86        move second child to first child ( temp 3-component vector of float)
+0:86          'P0' ( temp 3-component vector of float)
+0:86          vector swizzle ( temp 3-component vector of float)
+0:86            PositionWS: direct index for structure ( temp 3-component vector of float)
+0:86              direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:86                'input' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:86                Constant:
+0:86                  0 (const int)
+0:86              Constant:
+0:86                0 (const int)
+0:86            Sequence
+0:86              Constant:
+0:86                0 (const int)
+0:86              Constant:
+0:86                1 (const int)
+0:86              Constant:
+0:86                2 (const int)
+0:87      Sequence
+0:87        move second child to first child ( temp 3-component vector of float)
+0:87          'P1' ( temp 3-component vector of float)
+0:87          vector swizzle ( temp 3-component vector of float)
+0:87            PositionWS: direct index for structure ( temp 3-component vector of float)
+0:87              direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:87                'input' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:87                Constant:
+0:87                  1 (const int)
+0:87              Constant:
+0:87                0 (const int)
+0:87            Sequence
+0:87              Constant:
+0:87                0 (const int)
+0:87              Constant:
+0:87                1 (const int)
+0:87              Constant:
+0:87                2 (const int)
+0:88      Sequence
+0:88        move second child to first child ( temp 3-component vector of float)
+0:88          'P2' ( temp 3-component vector of float)
+0:88          vector swizzle ( temp 3-component vector of float)
+0:88            PositionWS: direct index for structure ( temp 3-component vector of float)
+0:88              direct index ( temp structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:88                'input' ( in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:88                Constant:
+0:88                  2 (const int)
+0:88              Constant:
+0:88                0 (const int)
+0:88            Sequence
+0:88              Constant:
+0:88                0 (const int)
+0:88              Constant:
+0:88                1 (const int)
+0:88              Constant:
+0:88                2 (const int)
+0:92      add second child into first child ( temp float)
+0:92        direct index ( temp float)
+0:92          'P0' ( temp 3-component vector of float)
+0:92          Constant:
+0:92            2 (const int)
+0:92        Constant:
+0:92          0.001000
+0:93      add second child into first child ( temp float)
+0:93        direct index ( temp float)
+0:93          'P1' ( temp 3-component vector of float)
+0:93          Constant:
+0:93            2 (const int)
+0:93        Constant:
+0:93          0.001000
+0:94      add second child into first child ( temp float)
+0:94        direct index ( temp float)
+0:94          'P2' ( temp 3-component vector of float)
+0:94          Constant:
+0:94            2 (const int)
+0:94        Constant:
+0:94          0.001000
+0:95      Sequence
+0:95        move second child to first child ( temp 4-component vector of float)
+0:95          'Q0' ( temp 4-component vector of float)
+0:95          vector-times-matrix ( temp 4-component vector of float)
+0:?             Construct vec4 ( temp 4-component vector of float)
+0:95              'P0' ( temp 3-component vector of float)
+0:95              Constant:
+0:95                1.000000
+0:95            proj_matrix: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
+0:95              'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float model_view_matrix, layout( row_major std140) uniform 4X4 matrix of float proj_matrix, layout( row_major std140) uniform 4X4 matrix of float model_view_proj_matrix, layout( row_major std140) uniform 3X3 matrix of float normal_matrix, layout( row_major std140) uniform 3-component vector of float color, layout( row_major std140) uniform 3-component vector of float view_dir, layout( row_major std140) uniform 3-component vector of float tess_factor})
+0:95              Constant:
+0:95                1 (const uint)
+0:96      Sequence
+0:96        move second child to first child ( temp 4-component vector of float)
+0:96          'Q1' ( temp 4-component vector of float)
+0:96          vector-times-matrix ( temp 4-component vector of float)
+0:?             Construct vec4 ( temp 4-component vector of float)
+0:96              'P1' ( temp 3-component vector of float)
+0:96              Constant:
+0:96                1.000000
+0:96            proj_matrix: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
+0:96              'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float model_view_matrix, layout( row_major std140) uniform 4X4 matrix of float proj_matrix, layout( row_major std140) uniform 4X4 matrix of float model_view_proj_matrix, layout( row_major std140) uniform 3X3 matrix of float normal_matrix, layout( row_major std140) uniform 3-component vector of float color, layout( row_major std140) uniform 3-component vector of float view_dir, layout( row_major std140) uniform 3-component vector of float tess_factor})
+0:96              Constant:
+0:96                1 (const uint)
+0:97      Sequence
+0:97        move second child to first child ( temp 4-component vector of float)
+0:97          'Q2' ( temp 4-component vector of float)
+0:97          vector-times-matrix ( temp 4-component vector of float)
+0:?             Construct vec4 ( temp 4-component vector of float)
+0:97              'P2' ( temp 3-component vector of float)
+0:97              Constant:
+0:97                1.000000
+0:97            proj_matrix: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
+0:97              'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float model_view_matrix, layout( row_major std140) uniform 4X4 matrix of float proj_matrix, layout( row_major std140) uniform 4X4 matrix of float model_view_proj_matrix, layout( row_major std140) uniform 3X3 matrix of float normal_matrix, layout( row_major std140) uniform 3-component vector of float color, layout( row_major std140) uniform 3-component vector of float view_dir, layout( row_major std140) uniform 3-component vector of float tess_factor})
+0:97              Constant:
+0:97                1 (const uint)
+0:100      move second child to first child ( temp 4-component vector of float)
+0:100        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:100          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:100          Constant:
+0:100            0 (const int)
+0:100        'Q0' ( temp 4-component vector of float)
+0:101      Constant:
+0:101        0.000000
+0:102      move second child to first child ( temp 4-component vector of float)
+0:102        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:102          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:102          Constant:
+0:102            0 (const int)
+0:102        'Q1' ( temp 4-component vector of float)
+0:103      Constant:
+0:103        0.000000
+0:104      Constant:
+0:104        0.000000
+0:107      move second child to first child ( temp 4-component vector of float)
+0:107        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:107          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:107          Constant:
+0:107            0 (const int)
+0:107        'Q1' ( temp 4-component vector of float)
+0:108      Constant:
+0:108        0.000000
+0:109      move second child to first child ( temp 4-component vector of float)
+0:109        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:109          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:109          Constant:
+0:109            0 (const int)
+0:109        'Q2' ( temp 4-component vector of float)
+0:110      Constant:
+0:110        0.000000
+0:111      Constant:
+0:111        0.000000
+0:114      move second child to first child ( temp 4-component vector of float)
+0:114        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:114          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:114          Constant:
+0:114            0 (const int)
+0:114        'Q2' ( temp 4-component vector of float)
+0:115      Constant:
+0:115        0.000000
+0:116      move second child to first child ( temp 4-component vector of float)
+0:116        PositionCS: direct index for structure ( temp 4-component vector of float)
+0:116          'vertex' ( temp structure{ temp 4-component vector of float PositionCS})
+0:116          Constant:
+0:116            0 (const int)
+0:116        'Q0' ( temp 4-component vector of float)
+0:117      Constant:
+0:117        0.000000
+0:118      Constant:
+0:118        0.000000
+0:?   Linker Objects
+0:?     'anon@0' (layout( binding=0 row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float model_view_matrix, layout( row_major std140) uniform 4X4 matrix of float proj_matrix, layout( row_major std140) uniform 4X4 matrix of float model_view_proj_matrix, layout( row_major std140) uniform 3X3 matrix of float normal_matrix, layout( row_major std140) uniform 3-component vector of float color, layout( row_major std140) uniform 3-component vector of float view_dir, layout( row_major std140) uniform 3-component vector of float tess_factor})
+0:?     '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float PositionWS})
+0:?     'patch' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float PositionWS,  temp 3-component vector of float NormalWS})
+0:?     'id' ( in uint InvocationID)
+0:?     '@patchConstantOutput.EdgeTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput.InsideTessFactor' ( patch out 2-element array of float TessLevelInner)
+0:?     '@patchConstantOutput' (layout( location=1) patch out structure{ temp 3-element array of 3-component vector of float NormalWS})
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 216
+
+                              Capability Tessellation
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint TessellationControl 4  "HSMain" 97 101 105 126 139 145
+                              ExecutionMode 4 OutputVertices 3
+                              ExecutionMode 4 Triangles
+                              ExecutionMode 4 SpacingFractionalOdd
+                              ExecutionMode 4 VertexOrderCcw
+                              Source HLSL 500
+                              Name 4  "HSMain"
+                              Name 8  "HSInput"
+                              MemberName 8(HSInput) 0  "PositionWS"
+                              MemberName 8(HSInput) 1  "NormalWS"
+                              Name 15  "HSTrianglePatchConstant"
+                              MemberName 15(HSTrianglePatchConstant) 0  "EdgeTessFactor"
+                              MemberName 15(HSTrianglePatchConstant) 1  "InsideTessFactor"
+                              MemberName 15(HSTrianglePatchConstant) 2  "NormalWS"
+                              Name 18  "HSPatchConstant(struct-HSInput-vf3-vf31[3];"
+                              Name 17  "patch"
+                              Name 21  "HSOutput"
+                              MemberName 21(HSOutput) 0  "PositionWS"
+                              Name 25  "@HSMain(struct-HSInput-vf3-vf31[3];u1;"
+                              Name 23  "patch"
+                              Name 24  "id"
+                              Name 27  "GSVertexInput"
+                              MemberName 27(GSVertexInput) 0  "PositionWS"
+                              MemberName 27(GSVertexInput) 1  "NormalWS"
+                              Name 31  "GSVertexOutput"
+                              MemberName 31(GSVertexOutput) 0  "PositionCS"
+                              Name 36  "GSMain(struct-GSVertexInput-vf3-vf31[3];struct-GSVertexOutput-vf41;"
+                              Name 34  "input"
+                              Name 35  "output"
+                              Name 39  "roundedEdgeTessFactor"
+                              Name 42  "UniformBlock0"
+                              MemberName 42(UniformBlock0) 0  "model_view_matrix"
+                              MemberName 42(UniformBlock0) 1  "proj_matrix"
+                              MemberName 42(UniformBlock0) 2  "model_view_proj_matrix"
+                              MemberName 42(UniformBlock0) 3  "normal_matrix"
+                              MemberName 42(UniformBlock0) 4  "color"
+                              MemberName 42(UniformBlock0) 5  "view_dir"
+                              MemberName 42(UniformBlock0) 6  "tess_factor"
+                              Name 44  ""
+                              Name 51  "roundedInsideTessFactor"
+                              Name 53  "insideTessFactor"
+                              Name 56  "result"
+                              Name 87  "output"
+                              Name 95  "patch"
+                              Name 97  "patch"
+                              Name 99  "id"
+                              Name 101  "id"
+                              Name 105  "@entryPointOutput"
+                              Name 107  "param"
+                              Name 109  "param"
+                              Name 119  "@patchConstantResult"
+                              Name 120  "param"
+                              Name 126  "@patchConstantOutput.EdgeTessFactor"
+                              Name 139  "@patchConstantOutput.InsideTessFactor"
+                              Name 143  "HSTrianglePatchConstant"
+                              MemberName 143(HSTrianglePatchConstant) 0  "NormalWS"
+                              Name 145  "@patchConstantOutput"
+                              Name 151  "P0"
+                              Name 154  "P1"
+                              Name 157  "P2"
+                              Name 174  "Q0"
+                              Name 184  "Q1"
+                              Name 193  "Q2"
+                              Name 202  "vertex"
+                              MemberDecorate 42(UniformBlock0) 0 RowMajor
+                              MemberDecorate 42(UniformBlock0) 0 Offset 0
+                              MemberDecorate 42(UniformBlock0) 0 MatrixStride 16
+                              MemberDecorate 42(UniformBlock0) 1 RowMajor
+                              MemberDecorate 42(UniformBlock0) 1 Offset 64
+                              MemberDecorate 42(UniformBlock0) 1 MatrixStride 16
+                              MemberDecorate 42(UniformBlock0) 2 RowMajor
+                              MemberDecorate 42(UniformBlock0) 2 Offset 128
+                              MemberDecorate 42(UniformBlock0) 2 MatrixStride 16
+                              MemberDecorate 42(UniformBlock0) 3 RowMajor
+                              MemberDecorate 42(UniformBlock0) 3 Offset 192
+                              MemberDecorate 42(UniformBlock0) 3 MatrixStride 16
+                              MemberDecorate 42(UniformBlock0) 4 Offset 240
+                              MemberDecorate 42(UniformBlock0) 5 Offset 256
+                              MemberDecorate 42(UniformBlock0) 6 Offset 272
+                              Decorate 42(UniformBlock0) Block
+                              Decorate 44 DescriptorSet 0
+                              Decorate 44 Binding 0
+                              Decorate 97(patch) Location 0
+                              Decorate 101(id) BuiltIn InvocationId
+                              Decorate 105(@entryPointOutput) Location 0
+                              Decorate 126(@patchConstantOutput.EdgeTessFactor) Patch
+                              Decorate 126(@patchConstantOutput.EdgeTessFactor) BuiltIn TessLevelOuter
+                              Decorate 139(@patchConstantOutput.InsideTessFactor) Patch
+                              Decorate 139(@patchConstantOutput.InsideTessFactor) BuiltIn TessLevelInner
+                              MemberDecorate 143(HSTrianglePatchConstant) 0 Patch
+                              Decorate 145(@patchConstantOutput) Patch
+                              Decorate 145(@patchConstantOutput) Location 1
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 3
+      8(HSInput):             TypeStruct 7(fvec3) 7(fvec3)
+               9:             TypeInt 32 0
+              10:      9(int) Constant 3
+              11:             TypeArray 8(HSInput) 10
+              12:             TypePointer Function 11
+              13:             TypeArray 6(float) 10
+              14:             TypeArray 7(fvec3) 10
+15(HSTrianglePatchConstant):             TypeStruct 13 6(float) 14
+              16:             TypeFunction 15(HSTrianglePatchConstant) 12(ptr)
+              20:             TypePointer Function 9(int)
+    21(HSOutput):             TypeStruct 7(fvec3)
+              22:             TypeFunction 21(HSOutput) 12(ptr) 20(ptr)
+27(GSVertexInput):             TypeStruct 7(fvec3) 7(fvec3)
+              28:             TypeArray 27(GSVertexInput) 10
+              29:             TypePointer Function 28
+              30:             TypeVector 6(float) 4
+31(GSVertexOutput):             TypeStruct 30(fvec4)
+              32:             TypePointer Function 31(GSVertexOutput)
+              33:             TypeFunction 2 29(ptr) 32(ptr)
+              38:             TypePointer Function 7(fvec3)
+              40:             TypeMatrix 30(fvec4) 4
+              41:             TypeMatrix 7(fvec3) 3
+42(UniformBlock0):             TypeStruct 40 40 40 41 7(fvec3) 7(fvec3) 7(fvec3)
+              43:             TypePointer Uniform 42(UniformBlock0)
+              44:     43(ptr) Variable Uniform
+              45:             TypeInt 32 1
+              46:     45(int) Constant 6
+              47:             TypePointer Uniform 7(fvec3)
+              50:             TypePointer Function 6(float)
+              52:    6(float) Constant 1077936128
+              54:    6(float) Constant 1065353216
+              55:             TypePointer Function 15(HSTrianglePatchConstant)
+              57:     45(int) Constant 0
+              58:      9(int) Constant 0
+              62:     45(int) Constant 1
+              63:      9(int) Constant 1
+              67:     45(int) Constant 2
+              68:      9(int) Constant 2
+              86:             TypePointer Function 21(HSOutput)
+              96:             TypePointer Input 11
+       97(patch):     96(ptr) Variable Input
+             100:             TypePointer Input 9(int)
+         101(id):    100(ptr) Variable Input
+             103:             TypeArray 21(HSOutput) 10
+             104:             TypePointer Output 103
+105(@entryPointOutput):    104(ptr) Variable Output
+             112:             TypePointer Output 21(HSOutput)
+             115:             TypeBool
+             123:      9(int) Constant 4
+             124:             TypeArray 6(float) 123
+             125:             TypePointer Output 124
+126(@patchConstantOutput.EdgeTessFactor):    125(ptr) Variable Output
+             129:             TypePointer Output 6(float)
+             137:             TypeArray 6(float) 68
+             138:             TypePointer Output 137
+139(@patchConstantOutput.InsideTessFactor):    138(ptr) Variable Output
+143(HSTrianglePatchConstant):             TypeStruct 14
+             144:             TypePointer Output 143(HSTrianglePatchConstant)
+145(@patchConstantOutput):    144(ptr) Variable Output
+             146:             TypePointer Function 14
+             149:             TypePointer Output 14
+             160:    6(float) Constant 981668463
+             173:             TypePointer Function 30(fvec4)
+             180:             TypePointer Uniform 40
+             205:    6(float) Constant 0
+       4(HSMain):           2 Function None 3
+               5:             Label
+       95(patch):     12(ptr) Variable Function
+          99(id):     20(ptr) Variable Function
+      107(param):     12(ptr) Variable Function
+      109(param):     20(ptr) Variable Function
+119(@patchConstantResult):     55(ptr) Variable Function
+      120(param):     12(ptr) Variable Function
+              98:          11 Load 97(patch)
+                              Store 95(patch) 98
+             102:      9(int) Load 101(id)
+                              Store 99(id) 102
+             106:      9(int) Load 101(id)
+             108:          11 Load 95(patch)
+                              Store 107(param) 108
+             110:      9(int) Load 99(id)
+                              Store 109(param) 110
+             111:21(HSOutput) FunctionCall 25(@HSMain(struct-HSInput-vf3-vf31[3];u1;) 107(param) 109(param)
+             113:    112(ptr) AccessChain 105(@entryPointOutput) 106
+                              Store 113 111
+                              ControlBarrier 68 63 58
+             114:      9(int) Load 101(id)
+             116:   115(bool) IEqual 114 57
+                              SelectionMerge 118 None
+                              BranchConditional 116 117 118
+             117:               Label
+             121:          11   Load 95(patch)
+                                Store 120(param) 121
+             122:15(HSTrianglePatchConstant)   FunctionCall 18(HSPatchConstant(struct-HSInput-vf3-vf31[3];) 120(param)
+                                Store 119(@patchConstantResult) 122
+             127:     50(ptr)   AccessChain 119(@patchConstantResult) 57 57
+             128:    6(float)   Load 127
+             130:    129(ptr)   AccessChain 126(@patchConstantOutput.EdgeTessFactor) 57
+                                Store 130 128
+             131:     50(ptr)   AccessChain 119(@patchConstantResult) 57 62
+             132:    6(float)   Load 131
+             133:    129(ptr)   AccessChain 126(@patchConstantOutput.EdgeTessFactor) 62
+                                Store 133 132
+             134:     50(ptr)   AccessChain 119(@patchConstantResult) 57 67
+             135:    6(float)   Load 134
+             136:    129(ptr)   AccessChain 126(@patchConstantOutput.EdgeTessFactor) 67
+                                Store 136 135
+             140:     50(ptr)   AccessChain 119(@patchConstantResult) 62
+             141:    6(float)   Load 140
+             142:    129(ptr)   AccessChain 139(@patchConstantOutput.InsideTessFactor) 57
+                                Store 142 141
+             147:    146(ptr)   AccessChain 119(@patchConstantResult) 67
+             148:          14   Load 147
+             150:    149(ptr)   AccessChain 145(@patchConstantOutput) 57
+                                Store 150 148
+                                Branch 118
+             118:             Label
+                              Return
+                              FunctionEnd
+18(HSPatchConstant(struct-HSInput-vf3-vf31[3];):15(HSTrianglePatchConstant) Function None 16
+       17(patch):     12(ptr) FunctionParameter
+              19:             Label
+39(roundedEdgeTessFactor):     38(ptr) Variable Function
+51(roundedInsideTessFactor):     50(ptr) Variable Function
+53(insideTessFactor):     50(ptr) Variable Function
+      56(result):     55(ptr) Variable Function
+              48:     47(ptr) AccessChain 44 46
+              49:    7(fvec3) Load 48
+                              Store 39(roundedEdgeTessFactor) 49
+                              Store 51(roundedInsideTessFactor) 52
+                              Store 53(insideTessFactor) 54
+              59:     50(ptr) AccessChain 39(roundedEdgeTessFactor) 58
+              60:    6(float) Load 59
+              61:     50(ptr) AccessChain 56(result) 57 57
+                              Store 61 60
+              64:     50(ptr) AccessChain 39(roundedEdgeTessFactor) 63
+              65:    6(float) Load 64
+              66:     50(ptr) AccessChain 56(result) 57 62
+                              Store 66 65
+              69:     50(ptr) AccessChain 39(roundedEdgeTessFactor) 68
+              70:    6(float) Load 69
+              71:     50(ptr) AccessChain 56(result) 57 67
+                              Store 71 70
+              72:    6(float) Load 51(roundedInsideTessFactor)
+              73:     50(ptr) AccessChain 56(result) 62
+                              Store 73 72
+              74:     38(ptr) AccessChain 17(patch) 57 62
+              75:    7(fvec3) Load 74
+              76:     38(ptr) AccessChain 56(result) 67 57
+                              Store 76 75
+              77:     38(ptr) AccessChain 17(patch) 62 62
+              78:    7(fvec3) Load 77
+              79:     38(ptr) AccessChain 56(result) 67 62
+                              Store 79 78
+              80:     38(ptr) AccessChain 17(patch) 67 62
+              81:    7(fvec3) Load 80
+              82:     38(ptr) AccessChain 56(result) 67 67
+                              Store 82 81
+              83:15(HSTrianglePatchConstant) Load 56(result)
+                              ReturnValue 83
+                              FunctionEnd
+25(@HSMain(struct-HSInput-vf3-vf31[3];u1;):21(HSOutput) Function None 22
+       23(patch):     12(ptr) FunctionParameter
+          24(id):     20(ptr) FunctionParameter
+              26:             Label
+      87(output):     86(ptr) Variable Function
+              88:      9(int) Load 24(id)
+              89:     38(ptr) AccessChain 23(patch) 88 57
+              90:    7(fvec3) Load 89
+              91:     38(ptr) AccessChain 87(output) 57
+                              Store 91 90
+              92:21(HSOutput) Load 87(output)
+                              ReturnValue 92
+                              FunctionEnd
+36(GSMain(struct-GSVertexInput-vf3-vf31[3];struct-GSVertexOutput-vf41;):           2 Function None 33
+       34(input):     29(ptr) FunctionParameter
+      35(output):     32(ptr) FunctionParameter
+              37:             Label
+         151(P0):     38(ptr) Variable Function
+         154(P1):     38(ptr) Variable Function
+         157(P2):     38(ptr) Variable Function
+         174(Q0):    173(ptr) Variable Function
+         184(Q1):    173(ptr) Variable Function
+         193(Q2):    173(ptr) Variable Function
+     202(vertex):     32(ptr) Variable Function
+             152:     38(ptr) AccessChain 34(input) 57 57
+             153:    7(fvec3) Load 152
+                              Store 151(P0) 153
+             155:     38(ptr) AccessChain 34(input) 62 57
+             156:    7(fvec3) Load 155
+                              Store 154(P1) 156
+             158:     38(ptr) AccessChain 34(input) 67 57
+             159:    7(fvec3) Load 158
+                              Store 157(P2) 159
+             161:     50(ptr) AccessChain 151(P0) 68
+             162:    6(float) Load 161
+             163:    6(float) FAdd 162 160
+             164:     50(ptr) AccessChain 151(P0) 68
+                              Store 164 163
+             165:     50(ptr) AccessChain 154(P1) 68
+             166:    6(float) Load 165
+             167:    6(float) FAdd 166 160
+             168:     50(ptr) AccessChain 154(P1) 68
+                              Store 168 167
+             169:     50(ptr) AccessChain 157(P2) 68
+             170:    6(float) Load 169
+             171:    6(float) FAdd 170 160
+             172:     50(ptr) AccessChain 157(P2) 68
+                              Store 172 171
+             175:    7(fvec3) Load 151(P0)
+             176:    6(float) CompositeExtract 175 0
+             177:    6(float) CompositeExtract 175 1
+             178:    6(float) CompositeExtract 175 2
+             179:   30(fvec4) CompositeConstruct 176 177 178 54
+             181:    180(ptr) AccessChain 44 62
+             182:          40 Load 181
+             183:   30(fvec4) VectorTimesMatrix 179 182
+                              Store 174(Q0) 183
+             185:    7(fvec3) Load 154(P1)
+             186:    6(float) CompositeExtract 185 0
+             187:    6(float) CompositeExtract 185 1
+             188:    6(float) CompositeExtract 185 2
+             189:   30(fvec4) CompositeConstruct 186 187 188 54
+             190:    180(ptr) AccessChain 44 62
+             191:          40 Load 190
+             192:   30(fvec4) VectorTimesMatrix 189 191
+                              Store 184(Q1) 192
+             194:    7(fvec3) Load 157(P2)
+             195:    6(float) CompositeExtract 194 0
+             196:    6(float) CompositeExtract 194 1
+             197:    6(float) CompositeExtract 194 2
+             198:   30(fvec4) CompositeConstruct 195 196 197 54
+             199:    180(ptr) AccessChain 44 62
+             200:          40 Load 199
+             201:   30(fvec4) VectorTimesMatrix 198 200
+                              Store 193(Q2) 201
+             203:   30(fvec4) Load 174(Q0)
+             204:    173(ptr) AccessChain 202(vertex) 57
+                              Store 204 203
+             206:   30(fvec4) Load 184(Q1)
+             207:    173(ptr) AccessChain 202(vertex) 57
+                              Store 207 206
+             208:   30(fvec4) Load 184(Q1)
+             209:    173(ptr) AccessChain 202(vertex) 57
+                              Store 209 208
+             210:   30(fvec4) Load 193(Q2)
+             211:    173(ptr) AccessChain 202(vertex) 57
+                              Store 211 210
+             212:   30(fvec4) Load 193(Q2)
+             213:    173(ptr) AccessChain 202(vertex) 57
+                              Store 213 212
+             214:   30(fvec4) Load 174(Q0)
+             215:    173(ptr) AccessChain 202(vertex) 57
+                              Store 215 214
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.inoutquals.frag.out b/Test/baseResults/hlsl.inoutquals.frag.out
index c589f5b..f02ba6d 100644
--- a/Test/baseResults/hlsl.inoutquals.frag.out
+++ b/Test/baseResults/hlsl.inoutquals.frag.out
@@ -210,7 +210,6 @@
 // Id's are bound by 88
 
                               Capability Shader
-                              Capability SampleRateShading
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
                               EntryPoint Fragment 4  "main" 68 78 82 86
diff --git a/Test/baseResults/hlsl.mul-truncate.frag.out b/Test/baseResults/hlsl.mul-truncate.frag.out
new file mode 100644
index 0000000..a1c3c03
--- /dev/null
+++ b/Test/baseResults/hlsl.mul-truncate.frag.out
@@ -0,0 +1,413 @@
+hlsl.mul-truncate.frag
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:17  Function Definition: @main( ( temp 4-component vector of float)
+0:17    Function Parameters: 
+0:?     Sequence
+0:19      Sequence
+0:19        move second child to first child ( temp float)
+0:19          'r00' ( temp float)
+0:19          dot-product ( temp float)
+0:19            v2: direct index for structure (layout( row_major std140) uniform 2-component vector of float)
+0:19              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:19              Constant:
+0:19                7 (const uint)
+0:19            Construct vec2 ( in 2-component vector of float)
+0:19              v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float)
+0:19                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:19                Constant:
+0:19                  6 (const uint)
+0:20      Sequence
+0:20        move second child to first child ( temp float)
+0:20          'r01' ( temp float)
+0:20          dot-product ( temp float)
+0:20            Construct vec2 ( in 2-component vector of float)
+0:20              v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
+0:20                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:20                Constant:
+0:20                  5 (const uint)
+0:20            v2: direct index for structure (layout( row_major std140) uniform 2-component vector of float)
+0:20              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:20              Constant:
+0:20                7 (const uint)
+0:23      Sequence
+0:23        move second child to first child ( temp 4-component vector of float)
+0:23          'r10' ( temp 4-component vector of float)
+0:23          matrix-times-vector ( temp 4-component vector of float)
+0:23            Construct mat3x4 ( uniform 3X4 matrix of float)
+0:23              m44: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
+0:23                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:23                Constant:
+0:23                  0 (const uint)
+0:23            v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float)
+0:23              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:23              Constant:
+0:23                6 (const uint)
+0:24      Sequence
+0:24        move second child to first child ( temp 4-component vector of float)
+0:24          'r11' ( temp 4-component vector of float)
+0:24          matrix-times-vector ( temp 4-component vector of float)
+0:24            m34: direct index for structure (layout( row_major std140) uniform 3X4 matrix of float)
+0:24              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:24              Constant:
+0:24                2 (const uint)
+0:24            Construct vec3 ( uniform 3-component vector of float)
+0:24              v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
+0:24                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:24                Constant:
+0:24                  5 (const uint)
+0:27      Sequence
+0:27        move second child to first child ( temp 4-component vector of float)
+0:27          'r20' ( temp 4-component vector of float)
+0:27          vector-times-matrix ( temp 4-component vector of float)
+0:27            v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float)
+0:27              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:27              Constant:
+0:27                6 (const uint)
+0:27            Construct mat4x3 ( uniform 4X3 matrix of float)
+0:27              m44: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
+0:27                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:27                Constant:
+0:27                  0 (const uint)
+0:28      Sequence
+0:28        move second child to first child ( temp 4-component vector of float)
+0:28          'r21' ( temp 4-component vector of float)
+0:28          vector-times-matrix ( temp 4-component vector of float)
+0:28            Construct vec3 ( uniform 3-component vector of float)
+0:28              v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
+0:28                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:28                Constant:
+0:28                  5 (const uint)
+0:28            m43: direct index for structure (layout( row_major std140) uniform 4X3 matrix of float)
+0:28              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:28              Constant:
+0:28                1 (const uint)
+0:36      Branch: Return with expression
+0:36        add ( temp 4-component vector of float)
+0:36          add ( temp 4-component vector of float)
+0:36            add ( temp 4-component vector of float)
+0:36              add ( temp 4-component vector of float)
+0:36                add ( temp 4-component vector of float)
+0:36                  'r10' ( temp 4-component vector of float)
+0:36                  'r11' ( temp 4-component vector of float)
+0:36                'r20' ( temp 4-component vector of float)
+0:36              'r21' ( temp 4-component vector of float)
+0:36            'r00' ( temp float)
+0:36          'r01' ( temp float)
+0:17  Function Definition: main( ( temp void)
+0:17    Function Parameters: 
+0:?     Sequence
+0:17      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:17        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:17  Function Definition: @main( ( temp 4-component vector of float)
+0:17    Function Parameters: 
+0:?     Sequence
+0:19      Sequence
+0:19        move second child to first child ( temp float)
+0:19          'r00' ( temp float)
+0:19          dot-product ( temp float)
+0:19            v2: direct index for structure (layout( row_major std140) uniform 2-component vector of float)
+0:19              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:19              Constant:
+0:19                7 (const uint)
+0:19            Construct vec2 ( in 2-component vector of float)
+0:19              v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float)
+0:19                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:19                Constant:
+0:19                  6 (const uint)
+0:20      Sequence
+0:20        move second child to first child ( temp float)
+0:20          'r01' ( temp float)
+0:20          dot-product ( temp float)
+0:20            Construct vec2 ( in 2-component vector of float)
+0:20              v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
+0:20                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:20                Constant:
+0:20                  5 (const uint)
+0:20            v2: direct index for structure (layout( row_major std140) uniform 2-component vector of float)
+0:20              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:20              Constant:
+0:20                7 (const uint)
+0:23      Sequence
+0:23        move second child to first child ( temp 4-component vector of float)
+0:23          'r10' ( temp 4-component vector of float)
+0:23          matrix-times-vector ( temp 4-component vector of float)
+0:23            Construct mat3x4 ( uniform 3X4 matrix of float)
+0:23              m44: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
+0:23                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:23                Constant:
+0:23                  0 (const uint)
+0:23            v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float)
+0:23              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:23              Constant:
+0:23                6 (const uint)
+0:24      Sequence
+0:24        move second child to first child ( temp 4-component vector of float)
+0:24          'r11' ( temp 4-component vector of float)
+0:24          matrix-times-vector ( temp 4-component vector of float)
+0:24            m34: direct index for structure (layout( row_major std140) uniform 3X4 matrix of float)
+0:24              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:24              Constant:
+0:24                2 (const uint)
+0:24            Construct vec3 ( uniform 3-component vector of float)
+0:24              v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
+0:24                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:24                Constant:
+0:24                  5 (const uint)
+0:27      Sequence
+0:27        move second child to first child ( temp 4-component vector of float)
+0:27          'r20' ( temp 4-component vector of float)
+0:27          vector-times-matrix ( temp 4-component vector of float)
+0:27            v3: direct index for structure (layout( row_major std140) uniform 3-component vector of float)
+0:27              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:27              Constant:
+0:27                6 (const uint)
+0:27            Construct mat4x3 ( uniform 4X3 matrix of float)
+0:27              m44: direct index for structure (layout( row_major std140) uniform 4X4 matrix of float)
+0:27                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:27                Constant:
+0:27                  0 (const uint)
+0:28      Sequence
+0:28        move second child to first child ( temp 4-component vector of float)
+0:28          'r21' ( temp 4-component vector of float)
+0:28          vector-times-matrix ( temp 4-component vector of float)
+0:28            Construct vec3 ( uniform 3-component vector of float)
+0:28              v4: direct index for structure (layout( row_major std140) uniform 4-component vector of float)
+0:28                'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:28                Constant:
+0:28                  5 (const uint)
+0:28            m43: direct index for structure (layout( row_major std140) uniform 4X3 matrix of float)
+0:28              'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:28              Constant:
+0:28                1 (const uint)
+0:36      Branch: Return with expression
+0:36        add ( temp 4-component vector of float)
+0:36          add ( temp 4-component vector of float)
+0:36            add ( temp 4-component vector of float)
+0:36              add ( temp 4-component vector of float)
+0:36                add ( temp 4-component vector of float)
+0:36                  'r10' ( temp 4-component vector of float)
+0:36                  'r11' ( temp 4-component vector of float)
+0:36                'r20' ( temp 4-component vector of float)
+0:36              'r21' ( temp 4-component vector of float)
+0:36            'r00' ( temp float)
+0:36          'r01' ( temp float)
+0:17  Function Definition: main( ( temp void)
+0:17    Function Parameters: 
+0:?     Sequence
+0:17      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:17        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'anon@0' (layout( row_major std140) uniform block{layout( row_major std140) uniform 4X4 matrix of float m44, layout( row_major std140) uniform 4X3 matrix of float m43, layout( row_major std140) uniform 3X4 matrix of float m34, layout( row_major std140) uniform 2X4 matrix of float m24, layout( row_major std140) uniform 4X2 matrix of float m42, layout( row_major std140) uniform 4-component vector of float v4, layout( row_major std140) uniform 3-component vector of float v3, layout( row_major std140) uniform 2-component vector of float v2})
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 139
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 137
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 9  "@main("
+                              Name 12  "r00"
+                              Name 20  "Matrix"
+                              MemberName 20(Matrix) 0  "m44"
+                              MemberName 20(Matrix) 1  "m43"
+                              MemberName 20(Matrix) 2  "m34"
+                              MemberName 20(Matrix) 3  "m24"
+                              MemberName 20(Matrix) 4  "m42"
+                              MemberName 20(Matrix) 5  "v4"
+                              MemberName 20(Matrix) 6  "v3"
+                              MemberName 20(Matrix) 7  "v2"
+                              Name 22  ""
+                              Name 36  "r01"
+                              Name 48  "r10"
+                              Name 74  "r11"
+                              Name 86  "r20"
+                              Name 109  "r21"
+                              Name 137  "@entryPointOutput"
+                              MemberDecorate 20(Matrix) 0 RowMajor
+                              MemberDecorate 20(Matrix) 0 Offset 0
+                              MemberDecorate 20(Matrix) 0 MatrixStride 16
+                              MemberDecorate 20(Matrix) 1 RowMajor
+                              MemberDecorate 20(Matrix) 1 Offset 64
+                              MemberDecorate 20(Matrix) 1 MatrixStride 16
+                              MemberDecorate 20(Matrix) 2 RowMajor
+                              MemberDecorate 20(Matrix) 2 Offset 112
+                              MemberDecorate 20(Matrix) 2 MatrixStride 16
+                              MemberDecorate 20(Matrix) 3 RowMajor
+                              MemberDecorate 20(Matrix) 3 Offset 176
+                              MemberDecorate 20(Matrix) 3 MatrixStride 16
+                              MemberDecorate 20(Matrix) 4 RowMajor
+                              MemberDecorate 20(Matrix) 4 Offset 240
+                              MemberDecorate 20(Matrix) 4 MatrixStride 16
+                              MemberDecorate 20(Matrix) 5 Offset 272
+                              MemberDecorate 20(Matrix) 6 Offset 288
+                              MemberDecorate 20(Matrix) 7 Offset 304
+                              Decorate 20(Matrix) Block
+                              Decorate 22 DescriptorSet 0
+                              Decorate 137(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+              11:             TypePointer Function 6(float)
+              13:             TypeMatrix 7(fvec4) 4
+              14:             TypeVector 6(float) 3
+              15:             TypeMatrix 14(fvec3) 4
+              16:             TypeMatrix 7(fvec4) 3
+              17:             TypeMatrix 7(fvec4) 2
+              18:             TypeVector 6(float) 2
+              19:             TypeMatrix 18(fvec2) 4
+      20(Matrix):             TypeStruct 13 15 16 17 19 7(fvec4) 14(fvec3) 18(fvec2)
+              21:             TypePointer Uniform 20(Matrix)
+              22:     21(ptr) Variable Uniform
+              23:             TypeInt 32 1
+              24:     23(int) Constant 7
+              25:             TypePointer Uniform 18(fvec2)
+              28:     23(int) Constant 6
+              29:             TypePointer Uniform 14(fvec3)
+              37:     23(int) Constant 5
+              38:             TypePointer Uniform 7(fvec4)
+              47:             TypePointer Function 7(fvec4)
+              49:     23(int) Constant 0
+              50:             TypePointer Uniform 13
+              53:    6(float) Constant 1065353216
+              54:    6(float) Constant 0
+              75:     23(int) Constant 2
+              76:             TypePointer Uniform 16
+             116:     23(int) Constant 1
+             117:             TypePointer Uniform 15
+             136:             TypePointer Output 7(fvec4)
+137(@entryPointOutput):    136(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+             138:    7(fvec4) FunctionCall 9(@main()
+                              Store 137(@entryPointOutput) 138
+                              Return
+                              FunctionEnd
+       9(@main():    7(fvec4) Function None 8
+              10:             Label
+         12(r00):     11(ptr) Variable Function
+         36(r01):     11(ptr) Variable Function
+         48(r10):     47(ptr) Variable Function
+         74(r11):     47(ptr) Variable Function
+         86(r20):     47(ptr) Variable Function
+        109(r21):     47(ptr) Variable Function
+              26:     25(ptr) AccessChain 22 24
+              27:   18(fvec2) Load 26
+              30:     29(ptr) AccessChain 22 28
+              31:   14(fvec3) Load 30
+              32:    6(float) CompositeExtract 31 0
+              33:    6(float) CompositeExtract 31 1
+              34:   18(fvec2) CompositeConstruct 32 33
+              35:    6(float) Dot 27 34
+                              Store 12(r00) 35
+              39:     38(ptr) AccessChain 22 37
+              40:    7(fvec4) Load 39
+              41:    6(float) CompositeExtract 40 0
+              42:    6(float) CompositeExtract 40 1
+              43:   18(fvec2) CompositeConstruct 41 42
+              44:     25(ptr) AccessChain 22 24
+              45:   18(fvec2) Load 44
+              46:    6(float) Dot 43 45
+                              Store 36(r01) 46
+              51:     50(ptr) AccessChain 22 49
+              52:          13 Load 51
+              55:    6(float) CompositeExtract 52 0 0
+              56:    6(float) CompositeExtract 52 0 1
+              57:    6(float) CompositeExtract 52 0 2
+              58:    6(float) CompositeExtract 52 0 3
+              59:    6(float) CompositeExtract 52 1 0
+              60:    6(float) CompositeExtract 52 1 1
+              61:    6(float) CompositeExtract 52 1 2
+              62:    6(float) CompositeExtract 52 1 3
+              63:    6(float) CompositeExtract 52 2 0
+              64:    6(float) CompositeExtract 52 2 1
+              65:    6(float) CompositeExtract 52 2 2
+              66:    6(float) CompositeExtract 52 2 3
+              67:    7(fvec4) CompositeConstruct 55 56 57 58
+              68:    7(fvec4) CompositeConstruct 59 60 61 62
+              69:    7(fvec4) CompositeConstruct 63 64 65 66
+              70:          16 CompositeConstruct 67 68 69
+              71:     29(ptr) AccessChain 22 28
+              72:   14(fvec3) Load 71
+              73:    7(fvec4) MatrixTimesVector 70 72
+                              Store 48(r10) 73
+              77:     76(ptr) AccessChain 22 75
+              78:          16 Load 77
+              79:     38(ptr) AccessChain 22 37
+              80:    7(fvec4) Load 79
+              81:    6(float) CompositeExtract 80 0
+              82:    6(float) CompositeExtract 80 1
+              83:    6(float) CompositeExtract 80 2
+              84:   14(fvec3) CompositeConstruct 81 82 83
+              85:    7(fvec4) MatrixTimesVector 78 84
+                              Store 74(r11) 85
+              87:     29(ptr) AccessChain 22 28
+              88:   14(fvec3) Load 87
+              89:     50(ptr) AccessChain 22 49
+              90:          13 Load 89
+              91:    6(float) CompositeExtract 90 0 0
+              92:    6(float) CompositeExtract 90 0 1
+              93:    6(float) CompositeExtract 90 0 2
+              94:    6(float) CompositeExtract 90 1 0
+              95:    6(float) CompositeExtract 90 1 1
+              96:    6(float) CompositeExtract 90 1 2
+              97:    6(float) CompositeExtract 90 2 0
+              98:    6(float) CompositeExtract 90 2 1
+              99:    6(float) CompositeExtract 90 2 2
+             100:    6(float) CompositeExtract 90 3 0
+             101:    6(float) CompositeExtract 90 3 1
+             102:    6(float) CompositeExtract 90 3 2
+             103:   14(fvec3) CompositeConstruct 91 92 93
+             104:   14(fvec3) CompositeConstruct 94 95 96
+             105:   14(fvec3) CompositeConstruct 97 98 99
+             106:   14(fvec3) CompositeConstruct 100 101 102
+             107:          15 CompositeConstruct 103 104 105 106
+             108:    7(fvec4) VectorTimesMatrix 88 107
+                              Store 86(r20) 108
+             110:     38(ptr) AccessChain 22 37
+             111:    7(fvec4) Load 110
+             112:    6(float) CompositeExtract 111 0
+             113:    6(float) CompositeExtract 111 1
+             114:    6(float) CompositeExtract 111 2
+             115:   14(fvec3) CompositeConstruct 112 113 114
+             118:    117(ptr) AccessChain 22 116
+             119:          15 Load 118
+             120:    7(fvec4) VectorTimesMatrix 115 119
+                              Store 109(r21) 120
+             121:    7(fvec4) Load 48(r10)
+             122:    7(fvec4) Load 74(r11)
+             123:    7(fvec4) FAdd 121 122
+             124:    7(fvec4) Load 86(r20)
+             125:    7(fvec4) FAdd 123 124
+             126:    7(fvec4) Load 109(r21)
+             127:    7(fvec4) FAdd 125 126
+             128:    6(float) Load 12(r00)
+             129:    7(fvec4) CompositeConstruct 128 128 128 128
+             130:    7(fvec4) FAdd 127 129
+             131:    6(float) Load 36(r01)
+             132:    7(fvec4) CompositeConstruct 131 131 131 131
+             133:    7(fvec4) FAdd 130 132
+                              ReturnValue 133
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.snorm.uav.comp.out b/Test/baseResults/hlsl.snorm.uav.comp.out
new file mode 100644
index 0000000..1db3da5
--- /dev/null
+++ b/Test/baseResults/hlsl.snorm.uav.comp.out
@@ -0,0 +1,212 @@
+hlsl.snorm.uav.comp
+Shader version: 500
+local_size = (16, 16, 1)
+0:? Sequence
+0:12  Function Definition: @main(vu3; ( temp void)
+0:12    Function Parameters: 
+0:12      'tid' ( in 3-component vector of uint)
+0:?     Sequence
+0:13      Sequence
+0:13        move second child to first child ( temp 4-component vector of float)
+0:13          'storeTemp' ( temp 4-component vector of float)
+0:13          add ( temp 4-component vector of float)
+0:13            textureFetch ( temp 4-component vector of float)
+0:13              'ResultInS' (layout( binding=1) uniform texture3D)
+0:13              'tid' ( in 3-component vector of uint)
+0:13              Constant:
+0:13                0 (const int)
+0:13            uf4: direct index for structure ( uniform 4-component vector of float)
+0:13              'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float uf4})
+0:13              Constant:
+0:13                0 (const uint)
+0:13        imageStore ( temp void)
+0:13          'ResultOutS' (layout( binding=1 rgba32f) uniform image3D)
+0:13          'tid' ( in 3-component vector of uint)
+0:13          'storeTemp' ( temp 4-component vector of float)
+0:13        'storeTemp' ( temp 4-component vector of float)
+0:14      Sequence
+0:14        move second child to first child ( temp 4-component vector of float)
+0:14          'storeTemp' ( temp 4-component vector of float)
+0:14          textureFetch ( temp 4-component vector of float)
+0:14            'ResultInU' (layout( binding=0) uniform texture3D)
+0:14            'tid' ( in 3-component vector of uint)
+0:14            Constant:
+0:14              0 (const int)
+0:14        imageStore ( temp void)
+0:14          'ResultOutU' (layout( binding=0 rgba32f) uniform image3D)
+0:14          'tid' ( in 3-component vector of uint)
+0:14          'storeTemp' ( temp 4-component vector of float)
+0:14        'storeTemp' ( temp 4-component vector of float)
+0:12  Function Definition: main( ( temp void)
+0:12    Function Parameters: 
+0:?     Sequence
+0:12      move second child to first child ( temp 3-component vector of uint)
+0:?         'tid' ( temp 3-component vector of uint)
+0:?         'tid' ( in 3-component vector of uint GlobalInvocationID)
+0:12      Function Call: @main(vu3; ( temp void)
+0:?         'tid' ( temp 3-component vector of uint)
+0:?   Linker Objects
+0:?     'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float uf4})
+0:?     'ResultInU' (layout( binding=0) uniform texture3D)
+0:?     'ResultOutU' (layout( binding=0 rgba32f) uniform image3D)
+0:?     'ResultInS' (layout( binding=1) uniform texture3D)
+0:?     'ResultOutS' (layout( binding=1 rgba32f) uniform image3D)
+0:?     'tid' ( in 3-component vector of uint GlobalInvocationID)
+
+
+Linked compute stage:
+
+
+Shader version: 500
+local_size = (16, 16, 1)
+0:? Sequence
+0:12  Function Definition: @main(vu3; ( temp void)
+0:12    Function Parameters: 
+0:12      'tid' ( in 3-component vector of uint)
+0:?     Sequence
+0:13      Sequence
+0:13        move second child to first child ( temp 4-component vector of float)
+0:13          'storeTemp' ( temp 4-component vector of float)
+0:13          add ( temp 4-component vector of float)
+0:13            textureFetch ( temp 4-component vector of float)
+0:13              'ResultInS' (layout( binding=1) uniform texture3D)
+0:13              'tid' ( in 3-component vector of uint)
+0:13              Constant:
+0:13                0 (const int)
+0:13            uf4: direct index for structure ( uniform 4-component vector of float)
+0:13              'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float uf4})
+0:13              Constant:
+0:13                0 (const uint)
+0:13        imageStore ( temp void)
+0:13          'ResultOutS' (layout( binding=1 rgba32f) uniform image3D)
+0:13          'tid' ( in 3-component vector of uint)
+0:13          'storeTemp' ( temp 4-component vector of float)
+0:13        'storeTemp' ( temp 4-component vector of float)
+0:14      Sequence
+0:14        move second child to first child ( temp 4-component vector of float)
+0:14          'storeTemp' ( temp 4-component vector of float)
+0:14          textureFetch ( temp 4-component vector of float)
+0:14            'ResultInU' (layout( binding=0) uniform texture3D)
+0:14            'tid' ( in 3-component vector of uint)
+0:14            Constant:
+0:14              0 (const int)
+0:14        imageStore ( temp void)
+0:14          'ResultOutU' (layout( binding=0 rgba32f) uniform image3D)
+0:14          'tid' ( in 3-component vector of uint)
+0:14          'storeTemp' ( temp 4-component vector of float)
+0:14        'storeTemp' ( temp 4-component vector of float)
+0:12  Function Definition: main( ( temp void)
+0:12    Function Parameters: 
+0:?     Sequence
+0:12      move second child to first child ( temp 3-component vector of uint)
+0:?         'tid' ( temp 3-component vector of uint)
+0:?         'tid' ( in 3-component vector of uint GlobalInvocationID)
+0:12      Function Call: @main(vu3; ( temp void)
+0:?         'tid' ( temp 3-component vector of uint)
+0:?   Linker Objects
+0:?     'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float uf4})
+0:?     'ResultInU' (layout( binding=0) uniform texture3D)
+0:?     'ResultOutU' (layout( binding=0 rgba32f) uniform image3D)
+0:?     'ResultInS' (layout( binding=1) uniform texture3D)
+0:?     'ResultOutS' (layout( binding=1 rgba32f) uniform image3D)
+0:?     'tid' ( in 3-component vector of uint GlobalInvocationID)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 54
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint GLCompute 4  "main" 49
+                              ExecutionMode 4 LocalSize 16 16 1
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 11  "@main(vu3;"
+                              Name 10  "tid"
+                              Name 16  "storeTemp"
+                              Name 19  "ResultInS"
+                              Name 25  "$Global"
+                              MemberName 25($Global) 0  "uf4"
+                              Name 27  ""
+                              Name 34  "ResultOutS"
+                              Name 38  "storeTemp"
+                              Name 39  "ResultInU"
+                              Name 43  "ResultOutU"
+                              Name 47  "tid"
+                              Name 49  "tid"
+                              Name 51  "param"
+                              Decorate 19(ResultInS) DescriptorSet 0
+                              Decorate 19(ResultInS) Binding 1
+                              MemberDecorate 25($Global) 0 Offset 0
+                              Decorate 25($Global) Block
+                              Decorate 27 DescriptorSet 0
+                              Decorate 34(ResultOutS) DescriptorSet 0
+                              Decorate 34(ResultOutS) Binding 1
+                              Decorate 39(ResultInU) DescriptorSet 0
+                              Decorate 39(ResultInU) Binding 0
+                              Decorate 43(ResultOutU) DescriptorSet 0
+                              Decorate 43(ResultOutU) Binding 0
+                              Decorate 49(tid) BuiltIn GlobalInvocationId
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeInt 32 0
+               7:             TypeVector 6(int) 3
+               8:             TypePointer Function 7(ivec3)
+               9:             TypeFunction 2 8(ptr)
+              13:             TypeFloat 32
+              14:             TypeVector 13(float) 4
+              15:             TypePointer Function 14(fvec4)
+              17:             TypeImage 13(float) 3D sampled format:Unknown
+              18:             TypePointer UniformConstant 17
+   19(ResultInS):     18(ptr) Variable UniformConstant
+              22:             TypeInt 32 1
+              23:     22(int) Constant 0
+     25($Global):             TypeStruct 14(fvec4)
+              26:             TypePointer Uniform 25($Global)
+              27:     26(ptr) Variable Uniform
+              28:             TypePointer Uniform 14(fvec4)
+              32:             TypeImage 13(float) 3D nonsampled format:Rgba32f
+              33:             TypePointer UniformConstant 32
+  34(ResultOutS):     33(ptr) Variable UniformConstant
+   39(ResultInU):     18(ptr) Variable UniformConstant
+  43(ResultOutU):     33(ptr) Variable UniformConstant
+              48:             TypePointer Input 7(ivec3)
+         49(tid):     48(ptr) Variable Input
+         4(main):           2 Function None 3
+               5:             Label
+         47(tid):      8(ptr) Variable Function
+       51(param):      8(ptr) Variable Function
+              50:    7(ivec3) Load 49(tid)
+                              Store 47(tid) 50
+              52:    7(ivec3) Load 47(tid)
+                              Store 51(param) 52
+              53:           2 FunctionCall 11(@main(vu3;) 51(param)
+                              Return
+                              FunctionEnd
+  11(@main(vu3;):           2 Function None 9
+         10(tid):      8(ptr) FunctionParameter
+              12:             Label
+   16(storeTemp):     15(ptr) Variable Function
+   38(storeTemp):     15(ptr) Variable Function
+              20:          17 Load 19(ResultInS)
+              21:    7(ivec3) Load 10(tid)
+              24:   14(fvec4) ImageFetch 20 21 Lod 23
+              29:     28(ptr) AccessChain 27 23
+              30:   14(fvec4) Load 29
+              31:   14(fvec4) FAdd 24 30
+                              Store 16(storeTemp) 31
+              35:          32 Load 34(ResultOutS)
+              36:    7(ivec3) Load 10(tid)
+              37:   14(fvec4) Load 16(storeTemp)
+                              ImageWrite 35 36 37
+              40:          17 Load 39(ResultInU)
+              41:    7(ivec3) Load 10(tid)
+              42:   14(fvec4) ImageFetch 40 41 Lod 23
+                              Store 38(storeTemp) 42
+              44:          32 Load 43(ResultOutU)
+              45:    7(ivec3) Load 10(tid)
+              46:   14(fvec4) Load 38(storeTemp)
+                              ImageWrite 44 45 46
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.texturebuffer.frag.out b/Test/baseResults/hlsl.texturebuffer.frag.out
new file mode 100644
index 0000000..e1e36b0
--- /dev/null
+++ b/Test/baseResults/hlsl.texturebuffer.frag.out
@@ -0,0 +1,153 @@
+hlsl.texturebuffer.frag
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:15  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:15    Function Parameters: 
+0:15      'pos' ( in 4-component vector of float)
+0:?     Sequence
+0:16      Branch: Return with expression
+0:16        add ( temp 4-component vector of float)
+0:16          f: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
+0:16            'TextureBuffer_var' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float f, layout( row_major std430) buffer 4-component vector of int i})
+0:16            Constant:
+0:16              0 (const int)
+0:16          f2: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
+0:16            'anon@0' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float f2, layout( row_major std430) buffer 4-component vector of int i2})
+0:16            Constant:
+0:16              0 (const uint)
+0:15  Function Definition: main( ( temp void)
+0:15    Function Parameters: 
+0:?     Sequence
+0:15      move second child to first child ( temp 4-component vector of float)
+0:?         'pos' ( temp 4-component vector of float)
+0:?         'pos' ( in 4-component vector of float FragCoord)
+0:15      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:15        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'pos' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'TextureBuffer_var' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float f, layout( row_major std430) buffer 4-component vector of int i})
+0:?     'anon@0' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float f2, layout( row_major std430) buffer 4-component vector of int i2})
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'pos' ( in 4-component vector of float FragCoord)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:15  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:15    Function Parameters: 
+0:15      'pos' ( in 4-component vector of float)
+0:?     Sequence
+0:16      Branch: Return with expression
+0:16        add ( temp 4-component vector of float)
+0:16          f: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
+0:16            'TextureBuffer_var' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float f, layout( row_major std430) buffer 4-component vector of int i})
+0:16            Constant:
+0:16              0 (const int)
+0:16          f2: direct index for structure (layout( row_major std430) buffer 4-component vector of float)
+0:16            'anon@0' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float f2, layout( row_major std430) buffer 4-component vector of int i2})
+0:16            Constant:
+0:16              0 (const uint)
+0:15  Function Definition: main( ( temp void)
+0:15    Function Parameters: 
+0:?     Sequence
+0:15      move second child to first child ( temp 4-component vector of float)
+0:?         'pos' ( temp 4-component vector of float)
+0:?         'pos' ( in 4-component vector of float FragCoord)
+0:15      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:15        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'pos' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'TextureBuffer_var' (layout( binding=0 row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float f, layout( row_major std430) buffer 4-component vector of int i})
+0:?     'anon@0' (layout( row_major std430) readonly buffer block{layout( row_major std430) buffer 4-component vector of float f2, layout( row_major std430) buffer 4-component vector of int i2})
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'pos' ( in 4-component vector of float FragCoord)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 39
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 32 35
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 11  "@main(vf4;"
+                              Name 10  "pos"
+                              Name 15  "TextureBuffer_var"
+                              MemberName 15(TextureBuffer_var) 0  "f"
+                              MemberName 15(TextureBuffer_var) 1  "i"
+                              Name 17  "TextureBuffer_var"
+                              Name 22  "tbuf2"
+                              MemberName 22(tbuf2) 0  "f2"
+                              MemberName 22(tbuf2) 1  "i2"
+                              Name 24  ""
+                              Name 30  "pos"
+                              Name 32  "pos"
+                              Name 35  "@entryPointOutput"
+                              Name 36  "param"
+                              MemberDecorate 15(TextureBuffer_var) 0 NonWritable
+                              MemberDecorate 15(TextureBuffer_var) 0 Offset 0
+                              MemberDecorate 15(TextureBuffer_var) 1 NonWritable
+                              MemberDecorate 15(TextureBuffer_var) 1 Offset 16
+                              Decorate 15(TextureBuffer_var) BufferBlock
+                              Decorate 17(TextureBuffer_var) DescriptorSet 0
+                              Decorate 17(TextureBuffer_var) Binding 0
+                              MemberDecorate 22(tbuf2) 0 NonWritable
+                              MemberDecorate 22(tbuf2) 0 Offset 0
+                              MemberDecorate 22(tbuf2) 1 NonWritable
+                              MemberDecorate 22(tbuf2) 1 Offset 16
+                              Decorate 22(tbuf2) BufferBlock
+                              Decorate 24 DescriptorSet 0
+                              Decorate 32(pos) BuiltIn FragCoord
+                              Decorate 35(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypePointer Function 7(fvec4)
+               9:             TypeFunction 7(fvec4) 8(ptr)
+              13:             TypeInt 32 1
+              14:             TypeVector 13(int) 4
+15(TextureBuffer_var):             TypeStruct 7(fvec4) 14(ivec4)
+              16:             TypePointer Uniform 15(TextureBuffer_var)
+17(TextureBuffer_var):     16(ptr) Variable Uniform
+              18:     13(int) Constant 0
+              19:             TypePointer Uniform 7(fvec4)
+       22(tbuf2):             TypeStruct 7(fvec4) 14(ivec4)
+              23:             TypePointer Uniform 22(tbuf2)
+              24:     23(ptr) Variable Uniform
+              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
+               5:             Label
+         30(pos):      8(ptr) Variable Function
+       36(param):      8(ptr) Variable Function
+              33:    7(fvec4) Load 32(pos)
+                              Store 30(pos) 33
+              37:    7(fvec4) Load 30(pos)
+                              Store 36(param) 37
+              38:    7(fvec4) FunctionCall 11(@main(vf4;) 36(param)
+                              Store 35(@entryPointOutput) 38
+                              Return
+                              FunctionEnd
+  11(@main(vf4;):    7(fvec4) Function None 9
+         10(pos):      8(ptr) FunctionParameter
+              12:             Label
+              20:     19(ptr) AccessChain 17(TextureBuffer_var) 18
+              21:    7(fvec4) Load 20
+              25:     19(ptr) AccessChain 24 18
+              26:    7(fvec4) Load 25
+              27:    7(fvec4) FAdd 21 26
+                              ReturnValue 27
+                              FunctionEnd
diff --git a/Test/baseResults/spv.arbPostDepthCoverage.frag.out b/Test/baseResults/spv.arbPostDepthCoverage.frag.out
index 7c5a3b6..b7ac2b6 100644
--- a/Test/baseResults/spv.arbPostDepthCoverage.frag.out
+++ b/Test/baseResults/spv.arbPostDepthCoverage.frag.out
@@ -4,7 +4,6 @@
 // Id's are bound by 18
 
                               Capability Shader
-                              Capability SampleRateShading
                               Capability SampleMaskPostDepthCoverage
                               Extension  "SPV_KHR_post_depth_coverage"
                1:             ExtInstImport  "GLSL.std.450"
diff --git a/Test/baseResults/spv.sample.frag.out b/Test/baseResults/spv.sample.frag.out
new file mode 100755
index 0000000..166ce94
--- /dev/null
+++ b/Test/baseResults/spv.sample.frag.out
@@ -0,0 +1,32 @@
+spv.sample.frag
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 13
+
+                              Capability Shader
+                              Capability SampleRateShading
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 9 11
+                              ExecutionMode 4 OriginUpperLeft
+                              Source GLSL 450
+                              Name 4  "main"
+                              Name 9  "color"
+                              Name 11  "samp"
+                              Decorate 9(color) Location 0
+                              Decorate 11(samp) Sample
+                              Decorate 11(samp) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypePointer Output 7(fvec4)
+        9(color):      8(ptr) Variable Output
+              10:             TypePointer Input 7(fvec4)
+        11(samp):     10(ptr) Variable Input
+         4(main):           2 Function None 3
+               5:             Label
+              12:    7(fvec4) Load 11(samp)
+                              Store 9(color) 12
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/spv.sampleId.frag.out b/Test/baseResults/spv.sampleId.frag.out
new file mode 100755
index 0000000..11ade87
--- /dev/null
+++ b/Test/baseResults/spv.sampleId.frag.out
@@ -0,0 +1,52 @@
+spv.sampleId.frag
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 26
+
+                              Capability Shader
+                              Capability SampleRateShading
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 8 18 20
+                              ExecutionMode 4 OriginUpperLeft
+                              Source GLSL 450
+                              Name 4  "main"
+                              Name 8  "gl_SampleID"
+                              Name 18  "color"
+                              Name 20  "samp"
+                              Decorate 8(gl_SampleID) Flat
+                              Decorate 8(gl_SampleID) BuiltIn SampleId
+                              Decorate 18(color) Location 0
+                              Decorate 20(samp) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeInt 32 1
+               7:             TypePointer Input 6(int)
+  8(gl_SampleID):      7(ptr) Variable Input
+              10:      6(int) Constant 3
+              11:             TypeBool
+              15:             TypeFloat 32
+              16:             TypeVector 15(float) 4
+              17:             TypePointer Output 16(fvec4)
+       18(color):     17(ptr) Variable Output
+              19:             TypePointer Input 16(fvec4)
+        20(samp):     19(ptr) Variable Input
+              23:   15(float) Constant 1073741824
+         4(main):           2 Function None 3
+               5:             Label
+               9:      6(int) Load 8(gl_SampleID)
+              12:    11(bool) SLessThan 9 10
+                              SelectionMerge 14 None
+                              BranchConditional 12 13 22
+              13:               Label
+              21:   16(fvec4)   Load 20(samp)
+                                Store 18(color) 21
+                                Branch 14
+              22:               Label
+              24:   16(fvec4)   Load 20(samp)
+              25:   16(fvec4)   VectorTimesScalar 24 23
+                                Store 18(color) 25
+                                Branch 14
+              14:             Label
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out b/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out
index 3a974fb..848b4a0 100644
--- a/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out
+++ b/Test/baseResults/spv.sampleMaskOverrideCoverage.frag.out
@@ -4,7 +4,6 @@
 // Id's are bound by 20
 
                               Capability Shader
-                              Capability SampleRateShading
                               Extension  "SPV_NV_sample_mask_override_coverage"
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
diff --git a/Test/baseResults/spv.samplePosition.frag.out b/Test/baseResults/spv.samplePosition.frag.out
new file mode 100755
index 0000000..5f4a0b9
--- /dev/null
+++ b/Test/baseResults/spv.samplePosition.frag.out
@@ -0,0 +1,55 @@
+spv.samplePosition.frag
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 30
+
+                              Capability Shader
+                              Capability SampleRateShading
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 9 22 24
+                              ExecutionMode 4 OriginUpperLeft
+                              Source GLSL 450
+                              Name 4  "main"
+                              Name 9  "gl_SamplePosition"
+                              Name 22  "color"
+                              Name 24  "samp"
+                              Decorate 9(gl_SamplePosition) BuiltIn SamplePosition
+                              Decorate 22(color) Location 0
+                              Decorate 24(samp) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 2
+               8:             TypePointer Input 7(fvec2)
+9(gl_SamplePosition):      8(ptr) Variable Input
+              10:             TypeInt 32 0
+              11:     10(int) Constant 1
+              12:             TypePointer Input 6(float)
+              15:    6(float) Constant 1056964608
+              16:             TypeBool
+              20:             TypeVector 6(float) 4
+              21:             TypePointer Output 20(fvec4)
+       22(color):     21(ptr) Variable Output
+              23:             TypePointer Input 20(fvec4)
+        24(samp):     23(ptr) Variable Input
+              27:    6(float) Constant 1073741824
+         4(main):           2 Function None 3
+               5:             Label
+              13:     12(ptr) AccessChain 9(gl_SamplePosition) 11
+              14:    6(float) Load 13
+              17:    16(bool) FOrdLessThan 14 15
+                              SelectionMerge 19 None
+                              BranchConditional 17 18 26
+              18:               Label
+              25:   20(fvec4)   Load 24(samp)
+                                Store 22(color) 25
+                                Branch 19
+              26:               Label
+              28:   20(fvec4)   Load 24(samp)
+              29:   20(fvec4)   VectorTimesScalar 28 27
+                                Store 22(color) 29
+                                Branch 19
+              19:             Label
+                              Return
+                              FunctionEnd
diff --git a/Test/hlsl.gs-hs-mix.tesc b/Test/hlsl.gs-hs-mix.tesc
new file mode 100644
index 0000000..4519696
--- /dev/null
+++ b/Test/hlsl.gs-hs-mix.tesc
@@ -0,0 +1,119 @@
+cbuffer UniformBlock0 : register(b0)

+{

+  float4x4 model_view_matrix;

+  float4x4 proj_matrix;

+  float4x4 model_view_proj_matrix;

+  float3x3 normal_matrix;

+  float3   color;

+  float3   view_dir;

+  float3   tess_factor;

+};

+

+// =============================================================================

+// Hull Shader

+// =============================================================================

+struct HSInput {

+  float3 PositionWS : POSITION;

+  float3 NormalWS   : NORMAL;

+};

+

+struct HSOutput {

+  float3 PositionWS : POSITION;

+};

+

+struct HSTrianglePatchConstant {

+  float  EdgeTessFactor[3] : SV_TessFactor;

+  float  InsideTessFactor  : SV_InsideTessFactor;

+  float3 NormalWS[3]       : NORMAL;

+};

+

+HSTrianglePatchConstant HSPatchConstant(InputPatch<HSInput, 3> patch)

+{

+  float3 roundedEdgeTessFactor = tess_factor;

+  float  roundedInsideTessFactor = 3;

+  float  insideTessFactor = 1;

+

+  HSTrianglePatchConstant result;

+

+  // Edge and inside tessellation factors

+  result.EdgeTessFactor[0] = roundedEdgeTessFactor.x;

+  result.EdgeTessFactor[1] = roundedEdgeTessFactor.y;

+  result.EdgeTessFactor[2] = roundedEdgeTessFactor.z;

+  result.InsideTessFactor  = roundedInsideTessFactor;

+

+  // Constant data

+  result.NormalWS[0] = patch[0].NormalWS;

+  result.NormalWS[1] = patch[1].NormalWS;

+  result.NormalWS[2] = patch[2].NormalWS;

+

+  return result;

+}

+

+[domain("tri")]

+[partitioning("fractional_odd")]

+[outputtopology("triangle_ccw")]

+[outputcontrolpoints(3)]

+[patchconstantfunc("HSPatchConstant")]

+HSOutput HSMain(

+  InputPatch<HSInput, 3>  patch,

+  uint                    id : SV_OutputControlPointID

+)

+{

+  HSOutput output;

+  output.PositionWS = patch[id].PositionWS;

+  return output;

+}

+

+// =============================================================================

+// Geometry Shader

+// =============================================================================

+struct GSVertexInput {

+  float3 PositionWS : POSITION;

+  float3 NormalWS   : NORMAL;

+};

+

+struct GSVertexOutput {

+  float4 PositionCS : SV_POSITION;

+};

+

+[maxvertexcount(6)]

+void GSMain(

+  triangle GSVertexInput            input[3],

+  inout LineStream<GSVertexOutput>  output

+)

+{

+

+  float3 P0 = input[0].PositionWS.xyz;

+  float3 P1 = input[1].PositionWS.xyz;

+  float3 P2 = input[2].PositionWS.xyz;

+

+  GSVertexOutput vertex;

+  // Totally hacky...

+  P0.z += 0.001;

+  P1.z += 0.001;

+  P2.z += 0.001;

+  float4 Q0 = mul(proj_matrix, float4(P0, 1.0));

+  float4 Q1 = mul(proj_matrix, float4(P1, 1.0));

+  float4 Q2 = mul(proj_matrix, float4(P2, 1.0));

+

+  // Edge 0

+  vertex.PositionCS = Q0;

+  output.Append(vertex);

+  vertex.PositionCS = Q1;

+  output.Append(vertex);

+  output.RestartStrip();

+

+  // Edge 1

+  vertex.PositionCS = Q1;

+  output.Append(vertex);

+  vertex.PositionCS = Q2;

+  output.Append(vertex);

+  output.RestartStrip();

+

+  // Edge 2

+  vertex.PositionCS = Q2;

+  output.Append(vertex);

+  vertex.PositionCS = Q0;

+  output.Append(vertex);

+  output.RestartStrip();

+}

diff --git a/Test/hlsl.mul-truncate.frag b/Test/hlsl.mul-truncate.frag
new file mode 100644
index 0000000..6baf2ac
--- /dev/null
+++ b/Test/hlsl.mul-truncate.frag
@@ -0,0 +1,37 @@
+
+// Test v*v, v*m, m*v, and m*m argument clamping.
+
+cbuffer Matrix
+{
+    float4x4  m44;
+    float4x3  m43;
+    float3x4  m34;
+    float2x4  m24;
+    float4x2  m42;
+    float4    v4;
+    float3    v3;
+    float2    v2;
+}
+
+float4 main() : SV_Target0
+{
+    // v*v:
+    float  r00 = mul(v2, v3);  // float = float2*float3; // clamp to float2 dot product
+    float  r01 = mul(v4, v2);  // float = float4*float2; // clamp to float2 dot product
+
+    // v*m
+    float4 r10 = mul(v3, m44); // float4 = float3 * float4x4;  // clamp mat to float3x4;
+    float4 r11 = mul(v4, m34); // truncate vector to vec3
+
+    // m*v
+    float4 r20 = mul(m44, v3); // float4 = float4x4 * float3;  // clamp mat to float4x3;
+    float4 r21 = mul(m43, v4); // truncate vector to vec3
+
+    // // m*m
+    // float2x3 r30 = mul(m24, m33);  // float2x3 = float2x4 * float3x3;
+    // float3x4 r31 = mul(m33, m24);  // float3x4 = float3x3 * float2x4;
+    // float3x2 r32 = mul(m33, m42);  // float3x2 = float3x3 * float4x2;
+    // float4x3 r33 = mul(m42, m33);  // float4x3 = float4x2 * float3x3;
+
+    return r10 + r11 + r20 + r21 + r00 + r01; // + r30[0].x + r31[0] + r32[0].x + transpose(r33)[0];
+}
diff --git a/Test/hlsl.snorm.uav.comp b/Test/hlsl.snorm.uav.comp
new file mode 100644
index 0000000..c6cafeb
--- /dev/null
+++ b/Test/hlsl.snorm.uav.comp
@@ -0,0 +1,15 @@
+
+unorm float4 uf4;
+
+Texture3D<unorm float4> ResultInU: register(t0);
+RWTexture3D<unorm float4> ResultOutU: register(u0);
+
+Texture3D<snorm float4> ResultInS: register(t1);
+RWTexture3D<snorm float4> ResultOutS: register(u1);
+
+[numthreads(16, 16, 1)]
+void main(uint3 tid: SV_DispatchThreadID)
+{
+    ResultOutS[tid] = ResultInS[tid] + uf4;
+    ResultOutU[tid] = ResultInU[tid];
+}
diff --git a/Test/hlsl.texturebuffer.frag b/Test/hlsl.texturebuffer.frag
new file mode 100644
index 0000000..d069746
--- /dev/null
+++ b/Test/hlsl.texturebuffer.frag
@@ -0,0 +1,17 @@
+
+struct Data {
+    float4  f;
+    int4    i;
+};
+
+TextureBuffer<Data> TextureBuffer_var : register(t0);
+
+tbuffer tbuf2 {
+    float4 f2;
+    int4   i2;
+};
+
+float4 main(float4 pos : SV_POSITION) : SV_TARGET
+{
+    return TextureBuffer_var.f + f2;
+}
diff --git a/Test/spv.sample.frag b/Test/spv.sample.frag
new file mode 100644
index 0000000..b62afe2
--- /dev/null
+++ b/Test/spv.sample.frag
@@ -0,0 +1,9 @@
+#version 450
+
+layout(location = 0) in sample vec4 samp;
+layout(location = 0) out vec4 color;
+
+void main()
+{
+    color = samp;
+}
\ No newline at end of file
diff --git a/Test/spv.sampleId.frag b/Test/spv.sampleId.frag
new file mode 100644
index 0000000..d5473f7
--- /dev/null
+++ b/Test/spv.sampleId.frag
@@ -0,0 +1,12 @@
+#version 450
+
+layout(location = 0) in vec4 samp;
+layout(location = 0) out vec4 color;
+
+void main()
+{
+    if (gl_SampleID < 3)
+        color = samp;
+    else
+        color = 2 * samp;
+}
\ No newline at end of file
diff --git a/Test/spv.samplePosition.frag b/Test/spv.samplePosition.frag
new file mode 100644
index 0000000..b73dd61
--- /dev/null
+++ b/Test/spv.samplePosition.frag
@@ -0,0 +1,12 @@
+#version 450
+
+layout(location = 0) in vec4 samp;
+layout(location = 0) out vec4 color;
+
+void main()
+{
+    if (gl_SamplePosition.y < 0.5)
+        color = samp;
+    else
+        color = 2 * samp;
+}
\ No newline at end of file
diff --git a/glslang/Include/Common.h b/glslang/Include/Common.h
index 6e201e3..06a9475 100644
--- a/glslang/Include/Common.h
+++ b/glslang/Include/Common.h
@@ -240,7 +240,10 @@
     int column;
 };
 
-typedef TMap<TString, TString> TPragmaTable;
+class TPragmaTable : public TMap<TString, TString> {
+public:
+    POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
+};
 
 const int MaxTokenLength = 1024;
 
diff --git a/glslang/Include/InitializeGlobals.h b/glslang/Include/InitializeGlobals.h
index 4cf2dca..95d0a40 100644
--- a/glslang/Include/InitializeGlobals.h
+++ b/glslang/Include/InitializeGlobals.h
@@ -37,10 +37,7 @@
 
 namespace glslang {
 
-void InitializeMemoryPools();
-void FreeGlobalPools();
 bool InitializePoolIndex();
-void FreePoolIndex();
 
 } // end namespace glslang
 
diff --git a/glslang/Include/PoolAlloc.h b/glslang/Include/PoolAlloc.h
index 69bacb1..0e237a6 100644
--- a/glslang/Include/PoolAlloc.h
+++ b/glslang/Include/PoolAlloc.h
@@ -250,15 +250,8 @@
 // different times.  But a simple use is to have a global pop
 // with everyone using the same global allocator.
 //
-typedef TPoolAllocator* PoolAllocatorPointer;
 extern TPoolAllocator& GetThreadPoolAllocator();
-
-struct TThreadMemoryPools
-{
-    TPoolAllocator* threadPoolAllocator;
-};
-
-void SetThreadPoolAllocator(TPoolAllocator& poolAllocator);
+void SetThreadPoolAllocator(TPoolAllocator* poolAllocator);
 
 //
 // This STL compatible allocator is intended to be used as the allocator
diff --git a/glslang/Include/ShHandle.h b/glslang/Include/ShHandle.h
index 64ba6d6..df07bd8 100644
--- a/glslang/Include/ShHandle.h
+++ b/glslang/Include/ShHandle.h
@@ -56,11 +56,14 @@
 //
 class TShHandleBase {
 public:
-    TShHandleBase() { }
-    virtual ~TShHandleBase() { }
+    TShHandleBase() { pool = new glslang::TPoolAllocator; }
+    virtual ~TShHandleBase() { delete pool; }
     virtual TCompiler* getAsCompiler() { return 0; }
     virtual TLinker* getAsLinker() { return 0; }
     virtual TUniformMap* getAsUniformMap() { return 0; }
+    virtual glslang::TPoolAllocator* getPool() const { return pool; }
+private:
+    glslang::TPoolAllocator* pool;
 };
 
 //
diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h
index 371ba1c..04674d2 100644
--- a/glslang/Include/Types.h
+++ b/glslang/Include/Types.h
@@ -1159,6 +1159,7 @@
                                 sampler.clear();
                                 qualifier.clear();
                                 qualifier.storage = q;
+                                assert(!(isMatrix() && vectorSize != 0));  // prevent vectorSize != 0 on matrices
                             }
     // for explicit precision qualifier
     TType(TBasicType t, TStorageQualifier q, TPrecisionQualifier p, int vs = 1, int mc = 0, int mr = 0,
@@ -1171,6 +1172,7 @@
                                 qualifier.storage = q;
                                 qualifier.precision = p;
                                 assert(p >= EpqNone && p <= EpqHigh);
+                                assert(!(isMatrix() && vectorSize != 0));  // prevent vectorSize != 0 on matrices
                             }
     // for turning a TPublicType into a TType, using a shallow copy
     explicit TType(const TPublicType& p) :
diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h
index c77c356..6d865c6 100644
--- a/glslang/Include/intermediate.h
+++ b/glslang/Include/intermediate.h
@@ -1457,8 +1457,8 @@
 //
 class TIntermAggregate : public TIntermOperator {
 public:
-    TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(0) { }
-    TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(0) { }
+    TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false), pragmaTable(nullptr) { }
+    TIntermAggregate(TOperator o) : TIntermOperator(o), pragmaTable(nullptr) { }
     ~TIntermAggregate() { delete pragmaTable; }
     virtual       TIntermAggregate* getAsAggregate()       { return this; }
     virtual const TIntermAggregate* getAsAggregate() const { return this; }
@@ -1476,7 +1476,7 @@
     void setDebug(bool d) { debug = d; }
     bool getOptimize() const { return optimize; }
     bool getDebug() const { return debug; }
-    void addToPragmaTable(const TPragmaTable& pTable);
+    void setPragmaTable(const TPragmaTable& pTable);
     const TPragmaTable& getPragmaTable() const { return *pragmaTable; }
 protected:
     TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp
index b5e2aac..82b4ace 100644
--- a/glslang/MachineIndependent/Intermediate.cpp
+++ b/glslang/MachineIndependent/Intermediate.cpp
@@ -3748,10 +3748,10 @@
                             node->getLoc());
 }
 
-void TIntermAggregate::addToPragmaTable(const TPragmaTable& pTable)
+void TIntermAggregate::setPragmaTable(const TPragmaTable& pTable)
 {
-    assert(!pragmaTable);
-    pragmaTable = new TPragmaTable();
+    assert(pragmaTable == nullptr);
+    pragmaTable = new TPragmaTable;
     *pragmaTable = pTable;
 }
 
diff --git a/glslang/MachineIndependent/PoolAlloc.cpp b/glslang/MachineIndependent/PoolAlloc.cpp
index 4007c38..84c40f4 100644
--- a/glslang/MachineIndependent/PoolAlloc.cpp
+++ b/glslang/MachineIndependent/PoolAlloc.cpp
@@ -40,35 +40,22 @@
 
 namespace glslang {
 
+// Process-wide TLS index
 OS_TLSIndex PoolIndex;
 
-void InitializeMemoryPools()
+// Return the thread-specific current pool.
+TPoolAllocator& GetThreadPoolAllocator()
 {
-    TThreadMemoryPools* pools = static_cast<TThreadMemoryPools*>(OS_GetTLSValue(PoolIndex));
-    if (pools)
-        return;
-
-    TPoolAllocator *threadPoolAllocator = new TPoolAllocator();
-
-    TThreadMemoryPools* threadData = new TThreadMemoryPools();
-
-    threadData->threadPoolAllocator = threadPoolAllocator;
-
-    OS_SetTLSValue(PoolIndex, threadData);
+    return *static_cast<TPoolAllocator*>(OS_GetTLSValue(PoolIndex));
 }
 
-void FreeGlobalPools()
+// Set the thread-specific current pool.
+void SetThreadPoolAllocator(TPoolAllocator* poolAllocator)
 {
-    // Release the allocated memory for this thread.
-    TThreadMemoryPools* globalPools = static_cast<TThreadMemoryPools*>(OS_GetTLSValue(PoolIndex));
-    if (! globalPools)
-        return;
-
-    GetThreadPoolAllocator().popAll();
-    delete &GetThreadPoolAllocator();
-    delete globalPools;
+    OS_SetTLSValue(PoolIndex, poolAllocator);
 }
 
+// Process-wide set up of the TLS pool storage.
 bool InitializePoolIndex()
 {
     // Allocate a TLS index.
@@ -78,26 +65,6 @@
     return true;
 }
 
-void FreePoolIndex()
-{
-    // Release the TLS index.
-    OS_FreeTLSIndex(PoolIndex);
-}
-
-TPoolAllocator& GetThreadPoolAllocator()
-{
-    TThreadMemoryPools* threadData = static_cast<TThreadMemoryPools*>(OS_GetTLSValue(PoolIndex));
-
-    return *threadData->threadPoolAllocator;
-}
-
-void SetThreadPoolAllocator(TPoolAllocator& poolAllocator)
-{
-    TThreadMemoryPools* threadData = static_cast<TThreadMemoryPools*>(OS_GetTLSValue(PoolIndex));
-
-    threadData->threadPoolAllocator = &poolAllocator;
-}
-
 //
 // Implement the functionality of the TPoolAllocator class, which
 // is documented in PoolAlloc.h.
@@ -234,13 +201,16 @@
     currentPageOffset = stack.back().offset;
 
     while (inUseList != page) {
-        // invoke destructor to free allocation list
-        inUseList->~tHeader();
-
         tHeader* nextInUse = inUseList->nextPage;
-        if (inUseList->pageCount > 1)
+        size_t pageCount = inUseList->pageCount;
+
+        // This technically ends the lifetime of the header as C++ object,
+        // but we will still control the memory and reuse it.
+        inUseList->~tHeader(); // currently, just a debug allocation checker
+
+        if (pageCount > 1) {
             delete [] reinterpret_cast<char*>(inUseList);
-        else {
+        } else {
             inUseList->nextPage = freeList;
             freeList = inUseList;
         }
diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp
index c8e954c..62e079e 100644
--- a/glslang/MachineIndependent/ShaderLang.cpp
+++ b/glslang/MachineIndependent/ShaderLang.cpp
@@ -69,6 +69,10 @@
 
 namespace { // anonymous namespace for file-local functions and symbols
 
+// Total number of successful initializers of glslang: a refcount
+// Shared global; access should be protected by a global mutex/critical section.
+int NumberOfClients = 0;
+
 using namespace glslang;
 
 // Create a language specific version of parseables.
@@ -217,7 +221,7 @@
 TSymbolTable* CommonSymbolTable[VersionCount][SpvVersionCount][ProfileCount][SourceCount][EPcCount] = {};
 TSymbolTable* SharedSymbolTables[VersionCount][SpvVersionCount][ProfileCount][SourceCount][EShLangCount] = {};
 
-TPoolAllocator* PerProcessGPA = 0;
+TPoolAllocator* PerProcessGPA = nullptr;
 
 //
 // Parse and add to the given symbol table the content of the given shader string.
@@ -361,7 +365,7 @@
 // pool allocator intact, so:
 //  - Switch to a new pool for parsing the built-ins
 //  - Do the parsing, which builds the symbol table, using the new pool
-//  - Switch to the process-global pool to save a copy the resulting symbol table
+//  - Switch to the process-global pool to save a copy of the resulting symbol table
 //  - Free up the new pool used to parse the built-ins
 //  - Switch back to the original thread's pool
 //
@@ -388,8 +392,8 @@
 
     // Switch to a new pool
     TPoolAllocator& previousAllocator = GetThreadPoolAllocator();
-    TPoolAllocator* builtInPoolAllocator = new TPoolAllocator();
-    SetThreadPoolAllocator(*builtInPoolAllocator);
+    TPoolAllocator* builtInPoolAllocator = new TPoolAllocator;
+    SetThreadPoolAllocator(builtInPoolAllocator);
 
     // Dynamically allocate the local symbol tables so we can control when they are deallocated WRT when the pool is popped.
     TSymbolTable* commonTable[EPcCount];
@@ -403,7 +407,7 @@
     InitializeSymbolTables(infoSink, commonTable, stageTables, version, profile, spvVersion, source);
 
     // Switch to the process-global pool
-    SetThreadPoolAllocator(*PerProcessGPA);
+    SetThreadPoolAllocator(PerProcessGPA);
 
     // Copy the local symbol tables from the new pool to the global tables using the process-global pool
     for (int precClass = 0; precClass < EPcCount; ++precClass) {
@@ -430,7 +434,7 @@
         delete stageTables[stage];
 
     delete builtInPoolAllocator;
-    SetThreadPoolAllocator(previousAllocator);
+    SetThreadPoolAllocator(&previousAllocator);
 
     glslang::ReleaseGlobalLock();
 }
@@ -722,9 +726,6 @@
     const std::string sourceEntryPointName = "",
     const TEnvironment* environment = nullptr)  // optional way of fully setting all versions, overriding the above
 {
-    if (! InitThread())
-        return false;
-
     // This must be undone (.pop()) by the caller, after it finishes consuming the created tree.
     GetThreadPoolAllocator().push();
 
@@ -1196,7 +1197,11 @@
     if (! InitProcess())
         return 0;
 
-    if (! PerProcessGPA)
+    glslang::GetGlobalLock();
+    ++NumberOfClients;
+    glslang::ReleaseGlobalLock();
+
+    if (PerProcessGPA == nullptr)
         PerProcessGPA = new TPoolAllocator();
 
     glslang::TScanContext::fillInKeywordMap();
@@ -1262,6 +1267,14 @@
 //
 int __fastcall ShFinalize()
 {
+    glslang::GetGlobalLock();
+    --NumberOfClients;
+    assert(NumberOfClients >= 0);
+    bool finalize = NumberOfClients == 0;
+    glslang::ReleaseGlobalLock();
+    if (! finalize)
+        return 1;
+
     for (int version = 0; version < VersionCount; ++version) {
         for (int spvVersion = 0; spvVersion < SpvVersionCount; ++spvVersion) {
             for (int p = 0; p < ProfileCount; ++p) {
@@ -1288,10 +1301,9 @@
         }
     }
 
-    if (PerProcessGPA) {
-        PerProcessGPA->popAll();
+    if (PerProcessGPA != nullptr) {
         delete PerProcessGPA;
-        PerProcessGPA = 0;
+        PerProcessGPA = nullptr;
     }
 
     glslang::TScanContext::deleteKeywordMap();
@@ -1332,6 +1344,8 @@
     if (compiler == 0)
         return 0;
 
+    SetThreadPoolAllocator(compiler->getPool());
+
     compiler->infoSink.info.erase();
     compiler->infoSink.debug.erase();
 
@@ -1389,6 +1403,8 @@
     TShHandleBase* base = reinterpret_cast<TShHandleBase*>(linkHandle);
     TLinker* linker = static_cast<TLinker*>(base->getAsLinker());
 
+    SetThreadPoolAllocator(linker->getPool());
+
     if (linker == 0)
         return 0;
 
@@ -1423,9 +1439,6 @@
 //
 const char* ShGetInfoLog(const ShHandle handle)
 {
-    if (!InitThread())
-        return 0;
-
     if (handle == 0)
         return 0;
 
@@ -1449,9 +1462,6 @@
 //
 const void* ShGetExecutable(const ShHandle handle)
 {
-    if (!InitThread())
-        return 0;
-
     if (handle == 0)
         return 0;
 
@@ -1474,9 +1484,6 @@
 //
 int ShSetVirtualAttributeBindings(const ShHandle handle, const ShBindingTable* table)
 {
-    if (!InitThread())
-        return 0;
-
     if (handle == 0)
         return 0;
 
@@ -1496,9 +1503,6 @@
 //
 int ShSetFixedAttributeBindings(const ShHandle handle, const ShBindingTable* table)
 {
-    if (!InitThread())
-        return 0;
-
     if (handle == 0)
         return 0;
 
@@ -1517,9 +1521,6 @@
 //
 int ShExcludeAttributes(const ShHandle handle, int *attributes, int count)
 {
-    if (!InitThread())
-        return 0;
-
     if (handle == 0)
         return 0;
 
@@ -1541,9 +1542,6 @@
 //
 int ShGetUniformLocation(const ShHandle handle, const char* name)
 {
-    if (!InitThread())
-        return 0;
-
     if (handle == 0)
         return -1;
 
@@ -1602,8 +1600,9 @@
 };
 
 TShader::TShader(EShLanguage s)
-    : pool(0), stage(s), lengths(nullptr), stringNames(nullptr), preamble("")
+    : stage(s), lengths(nullptr), stringNames(nullptr), preamble("")
 {
+    pool = new TPoolAllocator;
     infoSink = new TInfoSink;
     compiler = new TDeferredCompiler(stage, *infoSink);
     intermediate = new TIntermediate(s);
@@ -1706,9 +1705,8 @@
 {
     if (! InitThread())
         return false;
+    SetThreadPoolAllocator(pool);
 
-    pool = new TPoolAllocator();
-    SetThreadPoolAllocator(*pool);
     if (! preamble)
         preamble = "";
 
@@ -1730,9 +1728,8 @@
 {
     if (! InitThread())
         return false;
+    SetThreadPoolAllocator(pool);
 
-    pool = new TPoolAllocator();
-    SetThreadPoolAllocator(*pool);
     if (! preamble)
         preamble = "";
 
@@ -1752,8 +1749,9 @@
     return infoSink->debug.c_str();
 }
 
-TProgram::TProgram() : pool(0), reflection(0), ioMapper(nullptr), linked(false)
+TProgram::TProgram() : reflection(0), ioMapper(nullptr), linked(false)
 {
+    pool = new TPoolAllocator;
     infoSink = new TInfoSink;
     for (int s = 0; s < EShLangCount; ++s) {
         intermediate[s] = 0;
@@ -1788,8 +1786,7 @@
 
     bool error = false;
 
-    pool = new TPoolAllocator();
-    SetThreadPoolAllocator(*pool);
+    SetThreadPoolAllocator(pool);
 
     for (int s = 0; s < EShLangCount; ++s) {
         if (! linkStage((EShLanguage)s, messages))
diff --git a/glslang/MachineIndependent/glslang.y b/glslang/MachineIndependent/glslang.y
index c87ac7d..3f6eb27 100644
--- a/glslang/MachineIndependent/glslang.y
+++ b/glslang/MachineIndependent/glslang.y
@@ -3172,7 +3172,7 @@
         // information. This information can be queried from the parse tree
         $$->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
         $$->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
-        $$->getAsAggregate()->addToPragmaTable(parseContext.contextPragma.pragmaTable);
+        $$->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable);
     }
     ;
 
diff --git a/glslang/MachineIndependent/glslang_tab.cpp b/glslang/MachineIndependent/glslang_tab.cpp
index 4682b99..dc6da90 100644
--- a/glslang/MachineIndependent/glslang_tab.cpp
+++ b/glslang/MachineIndependent/glslang_tab.cpp
@@ -8789,7 +8789,7 @@
         // information. This information can be queried from the parse tree
         (yyval.interm.intermNode)->getAsAggregate()->setOptimize(parseContext.contextPragma.optimize);
         (yyval.interm.intermNode)->getAsAggregate()->setDebug(parseContext.contextPragma.debug);
-        (yyval.interm.intermNode)->getAsAggregate()->addToPragmaTable(parseContext.contextPragma.pragmaTable);
+        (yyval.interm.intermNode)->getAsAggregate()->setPragmaTable(parseContext.contextPragma.pragmaTable);
     }
 #line 8795 "MachineIndependent/glslang_tab.cpp" /* yacc.c:1646  */
     break;
diff --git a/glslang/OSDependent/Unix/ossource.cpp b/glslang/OSDependent/Unix/ossource.cpp
index 24b77e1..f59bbce 100644
--- a/glslang/OSDependent/Unix/ossource.cpp
+++ b/glslang/OSDependent/Unix/ossource.cpp
@@ -43,6 +43,9 @@
 #include <assert.h>
 #include <errno.h>
 #include <stdint.h>
+#include <cstdio>
+#include <sys/time.h>
+#include <sys/resource.h>
 
 namespace glslang {
 
@@ -184,8 +187,18 @@
   pthread_mutex_unlock(&gMutex);
 }
 
+// #define DUMP_COUNTERS
+
 void OS_DumpMemoryCounters()
 {
+#ifdef DUMP_COUNTERS
+    struct rusage usage;
+
+    if (getrusage(RUSAGE_SELF, &usage) == 0)
+        printf("Working set size: %ld\n", usage.ru_maxrss * 1024);
+#else
+    printf("Recompile with DUMP_COUNTERS defined to see counters.\n");
+#endif
 }
 
 } // end namespace glslang
diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h
index 6fadfbf..6e22bdd 100644
--- a/glslang/Public/ShaderLang.h
+++ b/glslang/Public/ShaderLang.h
@@ -68,15 +68,14 @@
 #endif
 
 //
-// Driver must call this first, once, before doing any other
-// compiler/linker operations.
+// Call before doing any other compiler/linker operations.
 //
 // (Call once per process, not once per thread.)
 //
 SH_IMPORT_EXPORT int ShInitialize();
 
 //
-// Driver should call this at process shutdown.
+// Call this at process shutdown to clean up memory.
 //
 SH_IMPORT_EXPORT int __fastcall ShFinalize();
 
@@ -290,7 +289,7 @@
 // Deferred-Lowering C++ Interface
 // -----------------------------------
 //
-// Below is a new alternate C++ interface that might potentially replace the above
+// Below is a new alternate C++ interface, which deprecates the above
 // opaque handle-based interface.
 //
 // The below is further designed to handle multiple compilation units per stage, where
diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp
index 3873ff7..850aee8 100644
--- a/gtests/Hlsl.FromFile.cpp
+++ b/gtests/Hlsl.FromFile.cpp
@@ -172,6 +172,7 @@
         {"hlsl.getdimensions.dx10.vert", "main"},
         {"hlsl.getsampleposition.dx10.frag", "main"},
         {"hlsl.global-const-init.frag", "main"},
+        {"hlsl.gs-hs-mix.tesc", "HSMain"},
         {"hlsl.domain.1.tese", "main"},
         {"hlsl.domain.2.tese", "main"},
         {"hlsl.domain.3.tese", "main"},
@@ -237,6 +238,7 @@
         {"hlsl.matrixSwizzle.vert", "ShaderFunction"},
         {"hlsl.memberFunCall.frag", "main"},
         {"hlsl.mintypes.frag", "main"},
+        {"hlsl.mul-truncate.frag", "main"},
         {"hlsl.multiEntry.vert", "RealEntrypoint"},
         {"hlsl.multiReturn.frag", "main"},
         {"hlsl.matrixindex.frag", "main"},
@@ -297,6 +299,7 @@
         {"hlsl.semicolons.frag", "main"},
         {"hlsl.shapeConv.frag", "main"},
         {"hlsl.shapeConvRet.frag", "main"},
+        {"hlsl.snorm.uav.comp", "main"},
         {"hlsl.staticMemberFunction.frag", "main"},
         {"hlsl.stringtoken.frag", "main"},
         {"hlsl.string.frag", "main"},
@@ -326,6 +329,7 @@
         {"hlsl.structStructName.frag", "main"},
         {"hlsl.subpass.frag", "main"},
         {"hlsl.synthesizeInput.frag", "main"},
+        {"hlsl.texturebuffer.frag", "main"},
         {"hlsl.texture.struct.frag", "main"},
         {"hlsl.texture.subvec4.frag", "main"},
         {"hlsl.this.frag", "main"},
@@ -395,7 +399,10 @@
         {"hlsl.flattenOpaque.frag", "main"},
         {"hlsl.flattenOpaqueInit.vert", "main"},
         {"hlsl.flattenOpaqueInitMix.vert", "main"},
-        {"hlsl.flattenSubset.frag", "main"}
+        {"hlsl.flattenSubset.frag", "main"},
+        {"hlsl.flattenSubset2.frag", "main"},
+        {"hlsl.partialFlattenLocal.vert", "main"},
+        {"hlsl.partialFlattenMixed.vert", "main"}
     }),
     FileNameAsCustomTestSuffix
 );
diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp
index 9143df2..6456422 100644
--- a/gtests/Spv.FromFile.cpp
+++ b/gtests/Spv.FromFile.cpp
@@ -280,6 +280,9 @@
         "spv.precisionNonESSamp.frag",
         "spv.prepost.frag",
         "spv.qualifiers.vert",
+        "spv.sample.frag",
+        "spv.sampleId.frag",
+        "spv.samplePosition.frag",
         "spv.sampleMaskOverrideCoverage.frag",
         "spv.shaderBallot.comp",
         "spv.shaderDrawParams.vert",
diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp
index 5b078ba..889082c 100755
--- a/hlsl/hlslGrammar.cpp
+++ b/hlsl/hlslGrammar.cpp
@@ -1378,6 +1378,23 @@
         }
     }
 
+    bool isUnorm = false;
+    bool isSnorm = false;
+
+    // Accept snorm and unorm.  Presently, this is ignored, save for an error check below.
+    switch (peek()) {
+    case EHTokUnorm:
+        isUnorm = true;
+        advanceToken();  // eat the token
+        break;
+    case EHTokSNorm:
+        isSnorm = true;
+        advanceToken();  // eat the token
+        break;
+    default:
+        break;
+    }
+
     switch (peek()) {
     case EHTokVector:
         return acceptVectorTemplateType(type);
@@ -1453,6 +1470,10 @@
         return acceptStructBufferType(type);
         break;
 
+    case EHTokTextureBuffer:
+        return acceptTextureBufferType(type);
+        break;
+
     case EHTokConstantBuffer:
         return acceptConstantBufferType(type);
 
@@ -1972,6 +1993,11 @@
 
     advanceToken();
 
+    if ((isUnorm || isSnorm) && !type.isFloatingDomain()) {
+        parseContext.error(token.loc, "unorm and snorm only valid in floating point domain", "", "");
+        return false;
+    }
+
     return true;
 }
 
@@ -2131,6 +2157,43 @@
     }
 }
 
+// texture_buffer
+//    : TEXTUREBUFFER LEFT_ANGLE type RIGHT_ANGLE
+bool HlslGrammar::acceptTextureBufferType(TType& type)
+{
+    if (! acceptTokenClass(EHTokTextureBuffer))
+        return false;
+
+    if (! acceptTokenClass(EHTokLeftAngle)) {
+        expected("left angle bracket");
+        return false;
+    }
+    
+    TType templateType;
+    if (! acceptType(templateType)) {
+        expected("type");
+        return false;
+    }
+
+    if (! acceptTokenClass(EHTokRightAngle)) {
+        expected("right angle bracket");
+        return false;
+    }
+
+    templateType.getQualifier().storage = EvqBuffer;
+    templateType.getQualifier().readonly = true;
+
+    TType blockType(templateType.getWritableStruct(), "", templateType.getQualifier());
+
+    blockType.getQualifier().storage = EvqBuffer;
+    blockType.getQualifier().readonly = true;
+
+    type.shallowCopy(blockType);
+
+    return true;
+}
+
+
 // struct_buffer
 //    : APPENDSTRUCTUREDBUFFER
 //    | BYTEADDRESSBUFFER
diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h
index f0adfa0..9d5380c 100755
--- a/hlsl/hlslGrammar.h
+++ b/hlsl/hlslGrammar.h
@@ -89,6 +89,7 @@
         bool acceptTextureType(TType&);
         bool acceptSubpassInputType(TType&);
         bool acceptStructBufferType(TType&);
+        bool acceptTextureBufferType(TType&);
         bool acceptConstantBufferType(TType&);
         bool acceptStruct(TType&, TIntermNode*& nodeList);
         bool acceptStructDeclarationList(TTypeList*&, TIntermNode*& nodeList, TVector<TFunctionDeclarator>&);
diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp
index df444f5..06ee659 100755
--- a/hlsl/hlslParseHelper.cpp
+++ b/hlsl/hlslParseHelper.cpp
@@ -5121,6 +5121,12 @@
         bool builtIn = false;
         int thisDepth = 0;
 
+        // For mat mul, the situation is unusual: we have to compare vector sizes to mat row or col sizes,
+        // and clamp the opposite arg.  Since that's complex, we farm it off to a separate method.
+        // It doesn't naturally fall out of processing an argument at a time in isolation.
+        if (function->getName() == "mul")
+            addGenMulArgumentConversion(loc, *function, arguments);
+
         TIntermAggregate* aggregate = arguments ? arguments->getAsAggregate() : nullptr;
 
         // TODO: this needs improvement: there's no way at present to look up a signature in
@@ -5283,6 +5289,68 @@
 }
 
 //
+// HLSL allows mismatched dimensions on vec*mat, mat*vec, vec*vec, and mat*mat.  This is a
+// situation not well suited to resolution in intrinsic selection, but we can do so here, since we
+// can look at both arguments insert explicit shape changes here, if required.
+//
+void HlslParseContext::addGenMulArgumentConversion(const TSourceLoc& loc, TFunction& call, TIntermTyped*& args)
+{
+    TIntermAggregate* argAggregate = args ? args->getAsAggregate() : nullptr;
+
+    if (argAggregate == nullptr || argAggregate->getSequence().size() != 2) {
+        // It really ought to have two arguments.
+        error(loc, "expected: mul arguments", "", "");
+        return;
+    }
+
+    TIntermTyped* arg0 = argAggregate->getSequence()[0]->getAsTyped();
+    TIntermTyped* arg1 = argAggregate->getSequence()[1]->getAsTyped();
+
+    if (arg0->isVector() && arg1->isVector()) {
+        // For:
+        //    vec * vec: it's handled during intrinsic selection, so while we could do it here,
+        //               we can also ignore it, which is easier.
+    } else if (arg0->isVector() && arg1->isMatrix()) {
+        // vec * mat: we clamp the vec if the mat col is smaller, else clamp the mat col.
+        if (arg0->getVectorSize() < arg1->getMatrixCols()) {
+            // vec is smaller, so truncate larger mat dimension
+            const TType truncType(arg1->getBasicType(), arg1->getQualifier().storage, arg1->getQualifier().precision,
+                                  0, arg0->getVectorSize(), arg1->getMatrixRows());
+            arg1 = addConstructor(loc, arg1, truncType);
+        } else if (arg0->getVectorSize() > arg1->getMatrixCols()) {
+            // vec is larger, so truncate vec to mat size
+            const TType truncType(arg0->getBasicType(), arg0->getQualifier().storage, arg0->getQualifier().precision,
+                                  arg1->getMatrixCols());
+            arg0 = addConstructor(loc, arg0, truncType);
+        }
+    } else if (arg0->isMatrix() && arg1->isVector()) {
+        // mat * vec: we clamp the vec if the mat col is smaller, else clamp the mat col.
+        if (arg1->getVectorSize() < arg0->getMatrixRows()) {
+            // vec is smaller, so truncate larger mat dimension
+            const TType truncType(arg0->getBasicType(), arg0->getQualifier().storage, arg0->getQualifier().precision,
+                                  0, arg0->getMatrixCols(), arg1->getVectorSize());
+            arg0 = addConstructor(loc, arg0, truncType);
+        } else if (arg1->getVectorSize() > arg0->getMatrixRows()) {
+            // vec is larger, so truncate vec to mat size
+            const TType truncType(arg1->getBasicType(), arg1->getQualifier().storage, arg1->getQualifier().precision,
+                                  arg0->getMatrixRows());
+            arg1 = addConstructor(loc, arg1, truncType);
+        }
+    } else if (arg0->isMatrix() && arg1->isMatrix()) {
+        // mat * mat
+    } else {
+        // It's something with scalars: we'll just leave it alone.
+    }
+
+    // Put arguments back.
+    argAggregate->getSequence()[0] = arg0;
+    argAggregate->getSequence()[1] = arg1;
+
+    call[0].type = &arg0->getWritableType();
+    call[1].type = &arg1->getWritableType();
+}
+
+//
 // Add any needed implicit conversions for function-call arguments to input parameters.
 //
 void HlslParseContext::addInputArgumentConversions(const TFunction& function, TIntermTyped*& arguments)
@@ -7128,6 +7196,7 @@
     }
 }
 
+
 //
 // Look up a function name in the symbol table, and make sure it is a function.
 //
@@ -8672,6 +8741,11 @@
 //
 bool HlslParseContext::handleOutputGeometry(const TSourceLoc& loc, const TLayoutGeometry& geometry)
 {
+    // If this is not a geometry shader, ignore.  It might be a mixed shader including several stages.
+    // Since that's an OK situation, return true for success.
+    if (language != EShLangGeometry)
+        return true;
+
     switch (geometry) {
     case ElgPoints:
     case ElgLineStrip:
diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h
index c1752f1..67d192d 100755
--- a/hlsl/hlslParseHelper.h
+++ b/hlsl/hlslParseHelper.h
@@ -141,6 +141,7 @@
     void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&);
 
     const TFunction* findFunction(const TSourceLoc& loc, TFunction& call, bool& builtIn, int& thisDepth, TIntermTyped*& args);
+    void addGenMulArgumentConversion(const TSourceLoc& loc, TFunction& call, TIntermTyped*& args);
     void declareTypedef(const TSourceLoc&, const TString& identifier, const TType&);
     void declareStruct(const TSourceLoc&, TString& structName, TType&);
     TSymbol* lookupUserType(const TString&, TType&);
diff --git a/hlsl/hlslScanContext.cpp b/hlsl/hlslScanContext.cpp
index c6fb122..577b8f4 100755
--- a/hlsl/hlslScanContext.cpp
+++ b/hlsl/hlslScanContext.cpp
@@ -346,6 +346,7 @@
     (*KeywordMap)["RWByteAddressBuffer"] =     EHTokRWByteAddressBuffer;
     (*KeywordMap)["RWStructuredBuffer"] =      EHTokRWStructuredBuffer;
     (*KeywordMap)["StructuredBuffer"] =        EHTokStructuredBuffer;
+    (*KeywordMap)["TextureBuffer"] =           EHTokTextureBuffer;
 
     (*KeywordMap)["class"] =                   EHTokClass;
     (*KeywordMap)["struct"] =                  EHTokStruct;
@@ -831,6 +832,7 @@
     case EHTokRWByteAddressBuffer:
     case EHTokRWStructuredBuffer:
     case EHTokStructuredBuffer:
+    case EHTokTextureBuffer:
     case EHTokSubpassInput:
     case EHTokSubpassInputMS:
         return keyword;
diff --git a/hlsl/hlslTokens.h b/hlsl/hlslTokens.h
index 621e272..9354ad9 100755
--- a/hlsl/hlslTokens.h
+++ b/hlsl/hlslTokens.h
@@ -284,6 +284,7 @@
     EHTokRWByteAddressBuffer,
     EHTokRWStructuredBuffer,
     EHTokStructuredBuffer,
+    EHTokTextureBuffer,
 
     // variable, user type, ...
     EHTokIdentifier,
diff --git a/known_good.json b/known_good.json
index 87cc63d..d318235 100644
--- a/known_good.json
+++ b/known_good.json
@@ -5,7 +5,7 @@
       "site" : "github",
       "subrepo" : "KhronosGroup/SPIRV-Tools",
       "subdir" : "External/spirv-tools",
-      "commit" : "5834719fc17d4735fce0102738b87b70255cfd5f"
+      "commit" : "ac04b2faeabc15811e8c542a5d7a36dbdba243b8"
     },
     {
       "name" : "spirv-tools/external/spirv-headers",