Merge remote-tracking branch 'GitHub/master'
diff --git a/.appveyor.yml b/.appveyor.yml
index 64e7ae6..d5c7225 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -25,6 +25,7 @@
 # scripts that run after cloning repository
 install:
   - git clone https://github.com/google/googletest.git External/googletest
+  - C:/Python27/python.exe update_glslang_sources.py
 
 build:
   parallel: true  # enable MSBuild parallel builds
diff --git a/.gitignore b/.gitignore
index 3e6cc14..a1fe394 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@
 build/
 Test/localResults/
 External/googletest
+External/spirv-tools
diff --git a/.travis.yml b/.travis.yml
index 40e3fc7..0237d25 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -39,11 +39,8 @@
   apt:
     packages:
       - clang-3.6
-      - ninja-build
 
 install:
-  # Install ninja on Mac OS X.
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew install ninja; fi
   # Make sure that clang-3.6 is selected on Linux.
   - if [[ "$TRAVIS_OS_NAME" == "linux" && "$CC" == "clang" ]]; then
       export CC=clang-3.6 CXX=clang++-3.6;
@@ -57,7 +54,8 @@
     fi
 
 before_script:
-  - git clone https://github.com/google/googletest.git External/googletest
+  - git clone --depth=1 https://github.com/google/googletest.git External/googletest
+  - ./update_glslang_sources.py
 
 script:
   - mkdir build && cd build
@@ -68,14 +66,12 @@
             -DANDROID_NATIVE_API_LEVEL=android-12
             -DCMAKE_BUILD_TYPE=Release
             -DANDROID_ABI="armeabi-v7a with NEON"
-            -DBUILD_TESTING=OFF
-            -GNinja ..;
-      ninja;
+            -DBUILD_TESTING=OFF ..;
+      make -j4;
     else
       cmake -DCMAKE_BUILD_TYPE=${GLSLANG_BUILD_TYPE}
-            -DCMAKE_INSTALL_PREFIX=`pwd`/install
-            -GNinja ..;
-      ninja install;
+            -DCMAKE_INSTALL_PREFIX=`pwd`/install ..;
+      make -j4 install;
       ctest --output-on-failure &&
       cd ../Test && ./runtests;
     fi
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9bc94b0..dbe4308 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,6 +18,8 @@
 
 option(ENABLE_HLSL "Enables HLSL input support" ON)
 
+option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
+
 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND WIN32)
     set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "..." FORCE)
 endif()
@@ -52,7 +54,7 @@
 
 if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
     add_compile_options(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs
-                        -Wunused-parameter -Wunused-value  -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable)
+                        -Wunused-parameter -Wunused-value  -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable -fno-exceptions)
     add_compile_options(-Wno-reorder)  # disable this from -Wall, since it happens all over.
 elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
     add_compile_options(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
@@ -83,6 +85,17 @@
 # We depend on these for later projects, so they should come first.
 add_subdirectory(External)
 
+if(NOT TARGET SPIRV-Tools-opt)
+    set(ENABLE_OPT OFF)
+endif()
+
+if(ENABLE_OPT)
+    message(STATUS "optimizer enabled")
+    add_definitions(-DENABLE_OPT)
+elseif(ENABLE_HLSL)
+    message(STATUS "spirv-tools not linked - illegal SPIRV may be generated for HLSL")
+endif()
+
 add_subdirectory(glslang)
 add_subdirectory(OGLCompilersDLL)
 if(ENABLE_GLSLANG_BINARIES)
diff --git a/External/CMakeLists.txt b/External/CMakeLists.txt
index 4f694ee..4d96901 100644
--- a/External/CMakeLists.txt
+++ b/External/CMakeLists.txt
@@ -33,3 +33,11 @@
             "Google Mock was not found - tests based on that will not build")
     endif()
 endif()
+
+if(ENABLE_OPT AND NOT TARGET SPIRV-Tools-opt)
+    if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools)
+        set(SPIRV_SKIP_TESTS ON CACHE BOOL "Skip building SPIRV-Tools tests")
+        add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools spirv-tools)
+    endif()
+endif()
+
diff --git a/README.md b/README.md
index f0a4df4..504447e 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,7 @@
 ### Dependencies
 
 * [CMake][cmake]: for generating compilation targets.
+* [Python 2.7][python]: for executing SPIRV-Tools scripts. (Optional if not using SPIRV-Tools.)
 * [bison][bison]: _optional_, but needed when changing the grammar (glslang.y).
 * [googletest][googletest]: needed if making any changes to glslang.
 
@@ -31,6 +32,18 @@
 git clone https://github.com/google/googletest.git External/googletest
 ```
 
+If you wish to assure that SPIR-V generated from HLSL is legal for Vulkan,
+or wish to invoke -Os to reduce SPIR-V size from HLSL or GLSL, install
+spirv-tools with this:
+
+```bash
+./update_glslang_sources.py
+```
+
+For running the CMake GUI or Visual Studio with python dependencies, you will,
+in addition to python within the cygwin environment, need a Windows [python][python]
+installation, including selecting the `PATH` update.
+
 #### 3) Configure
 
 Assume the source directory is `$SOURCE_DIR` and
@@ -258,6 +271,7 @@
 
 
 [cmake]: https://cmake.org/
+[python]: https://www.python.org/
 [bison]: https://www.gnu.org/software/bison/
 [googletest]: https://github.com/google/googletest
 [bison-gnu-win32]: http://gnuwin32.sourceforge.net/packages/bison.htm
diff --git a/SPIRV/CMakeLists.txt b/SPIRV/CMakeLists.txt
index 3c5ebab..b1c0277 100755
--- a/SPIRV/CMakeLists.txt
+++ b/SPIRV/CMakeLists.txt
@@ -42,12 +42,21 @@
 add_library(SPIRV STATIC ${SOURCES} ${HEADERS})
 set_property(TARGET SPIRV PROPERTY FOLDER glslang)
 set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON)
-target_link_libraries(SPIRV glslang)
 
 add_library(SPVRemapper STATIC ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
 set_property(TARGET SPVRemapper PROPERTY FOLDER glslang)
 set_property(TARGET SPVRemapper PROPERTY POSITION_INDEPENDENT_CODE ON)
 
+if(ENABLE_OPT)
+    target_include_directories(SPIRV
+        PRIVATE ${spirv-tools_SOURCE_DIR}/include
+        PRIVATE ${spirv-tools_SOURCE_DIR}/source
+    )
+    target_link_libraries(SPIRV glslang SPIRV-Tools-opt SPVRemapper)
+else()
+    target_link_libraries(SPIRV glslang)
+endif(ENABLE_OPT)
+
 if(WIN32)
     source_group("Source" FILES ${SOURCES} ${HEADERS})
     source_group("Source" FILES ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 92f0448..0662787 100644
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -53,6 +53,16 @@
 #endif
 }
 
+#ifdef ENABLE_OPT
+    #include "spirv-tools/optimizer.hpp"
+    #include "message.h"
+    #include "SPVRemapper.h"
+#endif
+
+#ifdef ENABLE_OPT
+using namespace spvtools;
+#endif
+
 // Glslang includes
 #include "../glslang/MachineIndependent/localintermediate.h"
 #include "../glslang/MachineIndependent/SymbolTable.h"
@@ -149,6 +159,8 @@
     void declareUseOfStructMember(const glslang::TTypeList& members, int glslangMember);
 
     bool isShaderEntryPoint(const glslang::TIntermAggregate* node);
+    bool writableParam(glslang::TStorageQualifier);
+    bool originalParam(glslang::TStorageQualifier, const glslang::TType&, bool implicitThisParam);
     void makeFunctions(const glslang::TIntermSequence&);
     void makeGlobalInitializers(const glslang::TIntermSequence&);
     void visitFunctions(const glslang::TIntermSequence&);
@@ -804,33 +816,41 @@
 {
     if (type.getQualifier().isPipeInput())
         return spv::StorageClassInput;
-    else if (type.getQualifier().isPipeOutput())
+    if (type.getQualifier().isPipeOutput())
         return spv::StorageClassOutput;
-    else if (type.getBasicType() == glslang::EbtAtomicUint)
-        return spv::StorageClassAtomicCounter;
-    else if (type.containsOpaque())
-        return spv::StorageClassUniformConstant;
-    else if (glslangIntermediate->usingStorageBuffer() && type.getQualifier().storage == glslang::EvqBuffer) {
+
+    if (glslangIntermediate->getSource() != glslang::EShSourceHlsl ||
+        type.getQualifier().storage == glslang::EvqUniform) {
+        if (type.getBasicType() == glslang::EbtAtomicUint)
+            return spv::StorageClassAtomicCounter;
+        if (type.containsOpaque())
+            return spv::StorageClassUniformConstant;
+    }
+
+    if (glslangIntermediate->usingStorageBuffer() && type.getQualifier().storage == glslang::EvqBuffer) {
         builder.addExtension(spv::E_SPV_KHR_storage_buffer_storage_class);
         return spv::StorageClassStorageBuffer;
-    } else if (type.getQualifier().isUniformOrBuffer()) {
+    }
+
+    if (type.getQualifier().isUniformOrBuffer()) {
         if (type.getQualifier().layoutPushConstant)
             return spv::StorageClassPushConstant;
         if (type.getBasicType() == glslang::EbtBlock)
             return spv::StorageClassUniform;
-        else
-            return spv::StorageClassUniformConstant;
-    } else {
-        switch (type.getQualifier().storage) {
-        case glslang::EvqShared:        return spv::StorageClassWorkgroup;  break;
-        case glslang::EvqGlobal:        return spv::StorageClassPrivate;
-        case glslang::EvqConstReadOnly: return spv::StorageClassFunction;
-        case glslang::EvqTemporary:     return spv::StorageClassFunction;
-        default:
-            assert(0);
-            return spv::StorageClassFunction;
-        }
+        return spv::StorageClassUniformConstant;
     }
+
+    switch (type.getQualifier().storage) {
+    case glslang::EvqShared:        return spv::StorageClassWorkgroup;
+    case glslang::EvqGlobal:        return spv::StorageClassPrivate;
+    case glslang::EvqConstReadOnly: return spv::StorageClassFunction;
+    case glslang::EvqTemporary:     return spv::StorageClassFunction;
+    default:
+        assert(0);
+        break;
+    }
+
+    return spv::StorageClassFunction;
 }
 
 // Return whether or not the given type is something that should be tied to a
@@ -1125,8 +1145,10 @@
     // Include all "static use" and "linkage only" interface variables on the OpEntryPoint instruction
     if (builder.isPointer(id)) {
         spv::StorageClass sc = builder.getStorageClass(id);
-        if (sc == spv::StorageClassInput || sc == spv::StorageClassOutput)
-            iOSet.insert(id);
+        if (sc == spv::StorageClassInput || sc == spv::StorageClassOutput) {
+            if (!symbol->getType().isStruct() || symbol->getType().getStruct()->size() > 0)
+                iOSet.insert(id);
+        }
     }
 
     // Only process non-linkage-only nodes for generating actual static uses
@@ -3007,6 +3029,24 @@
     return node->getName().compare(glslangIntermediate->getEntryPointMangledName().c_str()) == 0;
 }
 
+// Does parameter need a place to keep writes, separate from the original?
+bool TGlslangToSpvTraverser::writableParam(glslang::TStorageQualifier qualifier)
+{
+    return qualifier != glslang::EvqConstReadOnly;
+}
+
+// Is parameter pass-by-original?
+bool TGlslangToSpvTraverser::originalParam(glslang::TStorageQualifier qualifier, const glslang::TType& paramType,
+                                           bool implicitThisParam)
+{
+    if (implicitThisParam)                                                                     // implicit this
+        return true;
+    if (glslangIntermediate->getSource() == glslang::EShSourceHlsl)
+        return false;
+    return paramType.containsOpaque() ||                                                       // sampler, etc.
+           (paramType.getBasicType() == glslang::EbtBlock && qualifier == glslang::EvqBuffer); // SSBO
+}
+
 // Make all the functions, skeletally, without actually visiting their bodies.
 void TGlslangToSpvTraverser::makeFunctions(const glslang::TIntermSequence& glslFunctions)
 {
@@ -3047,13 +3087,9 @@
         for (int p = 0; p < (int)parameters.size(); ++p) {
             const glslang::TType& paramType = parameters[p]->getAsTyped()->getType();
             spv::Id typeId = convertGlslangToSpvType(paramType);
-            // can we pass by reference?
-            if (paramType.containsOpaque() ||                                // sampler, etc.
-                (paramType.getBasicType() == glslang::EbtBlock &&
-                 paramType.getQualifier().storage == glslang::EvqBuffer) ||  // SSBO
-                (p == 0 && implicitThis))                                    // implicit 'this'
+            if (originalParam(paramType.getQualifier().storage, paramType, implicitThis && p == 0))
                 typeId = builder.makePointer(TranslateStorageClass(paramType), typeId);
-            else if (paramType.getQualifier().storage != glslang::EvqConstReadOnly)
+            else if (writableParam(paramType.getQualifier().storage))
                 typeId = builder.makePointer(spv::StorageClassFunction, typeId);
             else
                 rValueParameters.insert(parameters[p]->getAsSymbolNode()->getId());
@@ -3613,11 +3649,6 @@
     const glslang::TIntermSequence& glslangArgs = node->getSequence();
     const glslang::TQualifierList& qualifiers = node->getQualifierList();
 
-    // Encapsulate lvalue logic, used in two places below, for safety.
-    const auto isLValue = [](int qualifier, const glslang::TType& paramType) -> bool {
-        return qualifier != glslang::EvqConstReadOnly || paramType.containsOpaque();
-    };
-
     //  See comments in makeFunctions() for details about the semantics for parameter passing.
     //
     // These imply we need a four step process:
@@ -3636,8 +3667,9 @@
         builder.clearAccessChain();
         glslangArgs[a]->traverse(this);
         argTypes.push_back(&paramType);
-        // keep outputs and opaque objects as l-values, evaluate input-only as r-values
-        if (isLValue(qualifiers[a], paramType)) {
+        // keep outputs and pass-by-originals as l-values, evaluate others as r-values
+        if (writableParam(qualifiers[a]) ||
+            originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0)) {
             // save l-value
             lValues.push_back(builder.getAccessChain());
         } else {
@@ -3656,13 +3688,11 @@
     for (int a = 0; a < (int)glslangArgs.size(); ++a) {
         const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType();
         spv::Id arg;
-        if (paramType.containsOpaque() ||
-            (paramType.getBasicType() == glslang::EbtBlock && qualifiers[a] == glslang::EvqBuffer) ||
-            (a == 0 && function->hasImplicitThis())) {
+        if (originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0)) {
             builder.setAccessChain(lValues[lValueCount]);
             arg = builder.accessChainGetLValue();
             ++lValueCount;
-        } else if (isLValue(qualifiers[a], paramType)) {
+        } else if (writableParam(qualifiers[a])) {
             // need space to hold the copy
             arg = builder.createVariable(spv::StorageClassFunction, convertGlslangToSpvType(paramType), "param");
             if (qualifiers[a] == glslang::EvqIn || qualifiers[a] == glslang::EvqInOut) {
@@ -3689,7 +3719,9 @@
     lValueCount = 0;
     for (int a = 0; a < (int)glslangArgs.size(); ++a) {
         const glslang::TType& paramType = glslangArgs[a]->getAsTyped()->getType();
-        if (isLValue(qualifiers[a], paramType)) {
+        if (originalParam(qualifiers[a], paramType, function->hasImplicitThis() && a == 0))
+            ++lValueCount;
+        else if (writableParam(qualifiers[a])) {
             if (qualifiers[a] == glslang::EvqOut || qualifiers[a] == glslang::EvqInOut) {
                 spv::Id copy = builder.createLoad(spvArgs[a]);
                 builder.setAccessChain(lValues[lValueCount]);
@@ -4940,12 +4972,12 @@
     case glslang::EOpAtomicMin:
     case glslang::EOpImageAtomicMin:
     case glslang::EOpAtomicCounterMin:
-        opCode = typeProxy == glslang::EbtUint ? spv::OpAtomicUMin : spv::OpAtomicSMin;
+        opCode = (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) ? spv::OpAtomicUMin : spv::OpAtomicSMin;
         break;
     case glslang::EOpAtomicMax:
     case glslang::EOpImageAtomicMax:
     case glslang::EOpAtomicCounterMax:
-        opCode = typeProxy == glslang::EbtUint ? spv::OpAtomicUMax : spv::OpAtomicSMax;
+        opCode = (typeProxy == glslang::EbtUint || typeProxy == glslang::EbtUint64) ? spv::OpAtomicUMax : spv::OpAtomicSMax;
         break;
     case glslang::EOpAtomicAnd:
     case glslang::EOpImageAtomicAnd:
@@ -4986,6 +5018,9 @@
         break;
     }
 
+    if (typeProxy == glslang::EbtInt64 || typeProxy == glslang::EbtUint64)
+        builder.addCapability(spv::CapabilityInt64Atomics);
+
     // Sort out the operands
     //  - mapping from glslang -> SPV
     //  - there are extra SPV operands with no glslang source
@@ -6437,6 +6472,12 @@
     out.close();
 }
 
+#ifdef ENABLE_OPT
+void errHandler(const std::string& str) {
+    std::cerr << str << std::endl;
+}
+#endif
+
 //
 // Set up the glslang traversal
 //
@@ -6465,6 +6506,49 @@
     it.finishSpv();
     it.dumpSpv(spirv);
 
+#ifdef ENABLE_OPT
+    // If from HLSL, run spirv-opt to "legalize" the SPIR-V for Vulkan
+    // eg. forward and remove memory writes of opaque types.
+    if ((intermediate.getSource() == EShSourceHlsl ||
+                options->optimizeSize) &&
+            !options->disableOptimizer) {
+        spv_target_env target_env = SPV_ENV_UNIVERSAL_1_2;
+
+        spvtools::Optimizer optimizer(target_env);
+        optimizer.SetMessageConsumer([](spv_message_level_t level,
+                                         const char* source,
+                                         const spv_position_t& position,
+                                         const char* message) {
+            std::cerr << StringifyMessage(level, source, position, message)
+                      << std::endl;
+        });
+
+        optimizer.RegisterPass(CreateInlineExhaustivePass());
+        optimizer.RegisterPass(CreateLocalAccessChainConvertPass());
+        optimizer.RegisterPass(CreateLocalSingleBlockLoadStoreElimPass());
+        optimizer.RegisterPass(CreateLocalSingleStoreElimPass());
+        optimizer.RegisterPass(CreateInsertExtractElimPass());
+        optimizer.RegisterPass(CreateAggressiveDCEPass());
+        optimizer.RegisterPass(CreateDeadBranchElimPass());
+        optimizer.RegisterPass(CreateBlockMergePass());
+        optimizer.RegisterPass(CreateLocalMultiStoreElimPass());
+        optimizer.RegisterPass(CreateInsertExtractElimPass());
+        optimizer.RegisterPass(CreateAggressiveDCEPass());
+        // TODO(greg-lunarg): Add this when AMD driver issues are resolved
+        // if (options->optimizeSize)
+        //     optimizer.RegisterPass(CreateCommonUniformElimPass());
+
+        if (!optimizer.Run(spirv.data(), spirv.size(), &spirv))
+            return;
+
+        // Remove dead module-level objects: functions, types, vars
+        // TODO(greg-lunarg): Switch to spirv-opt versions when available
+        spv::spirvbin_t Remapper(0);
+        Remapper.registerErrorHandler(errHandler);
+        Remapper.remap(spirv, spv::spirvbin_t::DCE_ALL);
+    }
+#endif
+
     glslang::GetThreadPoolAllocator().pop();
 }
 
diff --git a/SPIRV/GlslangToSpv.h b/SPIRV/GlslangToSpv.h
index 0dad4d2..0398501 100644
--- a/SPIRV/GlslangToSpv.h
+++ b/SPIRV/GlslangToSpv.h
@@ -48,8 +48,11 @@
 namespace glslang {
 
 struct SpvOptions {
-    SpvOptions() : generateDebugInfo(false) { }
+    SpvOptions() : generateDebugInfo(false), disableOptimizer(true),
+        optimizeSize(false) { }
     bool generateDebugInfo;
+    bool disableOptimizer;
+    bool optimizeSize;
 };
 
 void GetSpirvVersion(std::string&);
diff --git a/SPIRV/SPVRemapper.cpp b/SPIRV/SPVRemapper.cpp
index 6e9ca6a..412f649 100755
--- a/SPIRV/SPVRemapper.cpp
+++ b/SPIRV/SPVRemapper.cpp
@@ -135,6 +135,9 @@
         const unsigned typeStart = idPos(id);
         const spv::Op  opCode    = asOpCode(typeStart);
 
+        if (errorLatch)
+            return 0;
+
         switch (opCode) {
         case spv::OpTypeInt:   // fall through...
         case spv::OpTypeFloat: return (spv[typeStart+2]+31)/32;
@@ -148,8 +151,10 @@
     unsigned spirvbin_t::idTypeSizeInWords(spv::Id id) const
     {
         const auto tid_it = idTypeSizeMap.find(id);
-        if (tid_it == idTypeSizeMap.end())
+        if (tid_it == idTypeSizeMap.end()) {
             error("type size for ID not found");
+            return 0;
+        }
 
         return tid_it->second;
     }
@@ -253,19 +258,31 @@
     {
         //assert(id != spv::NoResult && newId != spv::NoResult);
 
+        if (id > bound()) {
+            error(std::string("ID out of range: ") + std::to_string(id));
+            return spirvbin_t::unused;
+        }
+
         if (id >= idMapL.size())
             idMapL.resize(id+1, unused);
 
         if (newId != unmapped && newId != unused) {
-            if (isOldIdUnused(id))
+            if (isOldIdUnused(id)) {
                 error(std::string("ID unused in module: ") + std::to_string(id));
+                return spirvbin_t::unused;
+            }
 
-            if (!isOldIdUnmapped(id))
+            if (!isOldIdUnmapped(id)) {
                 error(std::string("ID already mapped: ") + std::to_string(id) + " -> "
-                + std::to_string(localId(id)));
+                        + std::to_string(localId(id)));
 
-            if (isNewIdMapped(newId))
+                return spirvbin_t::unused;
+            }
+
+            if (isNewIdMapped(newId)) {
                 error(std::string("ID already used in module: ") + std::to_string(newId));
+                return spirvbin_t::unused;
+            }
 
             msg(4, 4, std::string("map: ") + std::to_string(id) + " -> " + std::to_string(newId));
             setMapped(newId);
@@ -299,6 +316,10 @@
         process(inst_fn_nop, // ignore instructions
             [this](spv::Id& id) {
                 id = localId(id);
+
+                if (errorLatch)
+                    return;
+
                 assert(id != unused && id != unmapped);
             }
         );
@@ -317,14 +338,22 @@
                 continue;
 
             // Find a new mapping for any used but unmapped IDs
-            if (isOldIdUnmapped(id))
+            if (isOldIdUnmapped(id)) {
                 localId(id, unusedId = nextUnusedId(unusedId));
+                if (errorLatch)
+                    return;
+            }
 
-            if (isOldIdUnmapped(id))
+            if (isOldIdUnmapped(id)) {
                 error(std::string("old ID not mapped: ") + std::to_string(id));
+                return;
+            }
 
             // Track max bound
             maxBound = std::max(maxBound, localId(id) + 1);
+
+            if (errorLatch)
+                return;
         }
 
         bound(maxBound); // reset header ID bound to as big as it now needs to be
@@ -406,6 +435,9 @@
                     if (typeId != spv::NoResult) {
                         const unsigned idTypeSize = typeSizeInWords(typeId);
 
+                        if (errorLatch)
+                            return false;
+
                         if (idTypeSize != 0)
                             idTypeSizeMap[resultId] = idTypeSize;
                     }
@@ -421,17 +453,26 @@
                 } else if (opCode == spv::Op::OpEntryPoint) {
                     entryPoint = asId(start + 2);
                 } else if (opCode == spv::Op::OpFunction) {
-                    if (fnStart != 0)
+                    if (fnStart != 0) {
                         error("nested function found");
+                        return false;
+                    }
+
                     fnStart = start;
                     fnRes   = asId(start + 2);
                 } else if (opCode == spv::Op::OpFunctionEnd) {
                     assert(fnRes != spv::NoResult);
-                    if (fnStart == 0)
+                    if (fnStart == 0) {
                         error("function end without function start");
+                        return false;
+                    }
+
                     fnPos[fnRes] = range_t(fnStart, start + asWordCount(start));
                     fnStart = 0;
                 } else if (isConstOp(opCode)) {
+                    if (errorLatch)
+                        return false;
+
                     assert(asId(start + 2) != spv::NoResult);
                     typeConstPos.insert(start);
                 } else if (isTypeOp(opCode)) {
@@ -451,18 +492,24 @@
     {
         msg(2, 2, std::string("validating: "));
 
-        if (spv.size() < header_size)
+        if (spv.size() < header_size) {
             error("file too short: ");
+            return;
+        }
 
-        if (magic() != spv::MagicNumber)
+        if (magic() != spv::MagicNumber) {
             error("bad magic number");
+            return;
+        }
 
         // field 1 = version
         // field 2 = generator magic
         // field 3 = result <id> bound
 
-        if (schemaNum() != 0)
+        if (schemaNum() != 0) {
             error("bad schema, must be 0");
+            return;
+        }
     }
 
     int spirvbin_t::processInstruction(unsigned word, instfn_t instFn, idfn_t idFn)
@@ -472,8 +519,10 @@
         const int      nextInst  = word++ + wordCount;
         spv::Op  opCode    = asOpCode(instructionStart);
 
-        if (nextInst > int(spv.size()))
+        if (nextInst > int(spv.size())) {
             error("spir instruction terminated too early");
+            return -1;
+        }
 
         // Base for computing number of operands; will be updated as more is learned
         unsigned numOperands = wordCount - 1;
@@ -555,6 +604,9 @@
                     const unsigned literalSize = idTypeSizeInWords(idBuffer[literalSizePos]);
                     const unsigned numLiteralIdPairs = (nextInst-word) / (1+literalSize);
 
+                    if (errorLatch)
+                        return -1;
+
                     for (unsigned arg=0; arg<numLiteralIdPairs; ++arg) {
                         word += literalSize;  // literal
                         idFn(asId(word++));   // label
@@ -631,9 +683,13 @@
         // basic parsing and InstructionDesc table borrowed from SpvDisassemble.cpp...
         unsigned nextInst = unsigned(spv.size());
 
-        for (unsigned word = begin; word < end; word = nextInst)
+        for (unsigned word = begin; word < end; word = nextInst) {
             nextInst = processInstruction(word, instFn, idFn);
 
+            if (errorLatch)
+                return *this;
+        }
+
         return *this;
     }
 
@@ -648,8 +704,11 @@
             for (const char c : name.first)
                 hashval = hashval * 1009 + c;
 
-            if (isOldIdUnmapped(name.second))
+            if (isOldIdUnmapped(name.second)) {
                 localId(name.second, nextUnusedId(hashval % softTypeIdLimit + firstMappedID));
+                if (errorLatch)
+                    return;
+            }
         }
     }
 
@@ -671,6 +730,9 @@
             [&](spv::Op, unsigned start) { instPos.push_back(start); return true; },
             op_fn_nop);
 
+        if (errorLatch)
+            return;
+
         // Window size for context-sensitive canonicalization values
         // Empirical best size from a single data set.  TODO: Would be a good tunable.
         // We essentially perform a little convolution around each instruction,
@@ -706,8 +768,12 @@
                         hashval = hashval * 30103 + asOpCodeHash(instPos[i]); // 30103 = semiarbitrary prime
                     }
 
-                    if (isOldIdUnmapped(resId))
+                    if (isOldIdUnmapped(resId)) {
                         localId(resId, nextUnusedId(hashval % softTypeIdLimit + firstMappedID));
+                        if (errorLatch)
+                            return;
+                    }
+
                 }
             }
         }
@@ -800,6 +866,9 @@
             [&](spv::Id& id) { if (idMap.find(id) != idMap.end()) id = idMap[id]; }
         );
 
+        if (errorLatch)
+            return;
+
         // EXPERIMENTAL: Implicit output stores
         fnLocalVars.clear();
         idMap.clear();
@@ -820,11 +889,17 @@
             },
             op_fn_nop);
 
+        if (errorLatch)
+            return;
+
         process(
             inst_fn_nop,
             [&](spv::Id& id) { if (idMap.find(id) != idMap.end()) id = idMap[id]; }
         );
 
+        if (errorLatch)
+            return;
+
         strip();          // strip out data we decided to eliminate
     }
 
@@ -924,6 +999,9 @@
             }
         );
 
+        if (errorLatch)
+            return;
+
         process(
             [&](spv::Op opCode, unsigned start) {
                 if (opCode == spv::OpLoad && fnLocalVars.count(asId(start+3)) > 0)
@@ -932,6 +1010,9 @@
             },
             op_fn_nop);
 
+        if (errorLatch)
+            return;
+
         // Chase replacements to their origins, in case there is a chain such as:
         //   2 = store 1
         //   3 = load 2
@@ -965,6 +1046,9 @@
             }
         );
 
+        if (errorLatch)
+            return;
+
         strip();          // strip out data we decided to eliminate
     }
 
@@ -1008,6 +1092,9 @@
                         fn->second.first,
                         fn->second.second);
 
+                    if (errorLatch)
+                        return;
+
                     fn = fnPos.erase(fn);
                 } else ++fn;
             }
@@ -1040,6 +1127,9 @@
             [&](spv::Id& id) { if (varUseCount[id]) ++varUseCount[id]; }
         );
 
+        if (errorLatch)
+            return;
+
         // Remove single-use function variables + associated decorations and names
         process(
             [&](spv::Op opCode, unsigned start) {
@@ -1081,6 +1171,9 @@
                     [&](spv::Id& id) { if (isType[id]) ++typeUseCount[id]; }
                     );
 
+            if (errorLatch)
+                return;
+
             // Remove single reference types
             for (const auto typeStart : typeConstPos) {
                 const spv::Id typeId = asTypeConstId(typeStart);
@@ -1090,6 +1183,9 @@
                     stripInst(typeStart);
                 }
             }
+
+            if (errorLatch)
+                return;
         }
     }
 
@@ -1168,8 +1264,10 @@
     unsigned spirvbin_t::idPos(spv::Id id) const
     {
         const auto tid_it = idPosR.find(id);
-        if (tid_it == idPosR.end())
+        if (tid_it == idPosR.end()) {
             error("ID not found");
+            return 0;
+        }
 
         return tid_it->second;
     }
@@ -1268,8 +1366,14 @@
             const spv::Id       resId     = asTypeConstId(typeStart);
             const std::uint32_t hashval   = hashType(typeStart);
 
-            if (isOldIdUnmapped(resId))
+            if (errorLatch)
+                return;
+
+            if (isOldIdUnmapped(resId)) {
                 localId(resId, nextUnusedId(hashval % softTypeIdLimit + firstMappedID));
+                if (errorLatch)
+                    return;
+            }
         }
     }
 
@@ -1315,24 +1419,49 @@
         msg(3, 4, std::string("ID bound: ") + std::to_string(bound()));
 
         if (options & STRIP)         stripDebug();
+        if (errorLatch) return;
+
         strip();        // strip out data we decided to eliminate
+        if (errorLatch) return;
+
         if (options & OPT_LOADSTORE) optLoadStore();
+        if (errorLatch) return;
+
         if (options & OPT_FWD_LS)    forwardLoadStores();
+        if (errorLatch) return;
+
         if (options & DCE_FUNCS)     dceFuncs();
+        if (errorLatch) return;
+
         if (options & DCE_VARS)      dceVars();
+        if (errorLatch) return;
+
         if (options & DCE_TYPES)     dceTypes();
+        if (errorLatch) return;
 
         strip();         // strip out data we decided to eliminate
+        if (errorLatch) return;
+
         stripDeadRefs(); // remove references to things we DCEed
+        if (errorLatch) return;
+
         // after the last strip, we must clean any debug info referring to now-deleted data
 
         if (options & MAP_TYPES)     mapTypeConst();
+        if (errorLatch) return;
+
         if (options & MAP_NAMES)     mapNames();
+        if (errorLatch) return;
+
         if (options & MAP_FUNCS)     mapFnBodies();
+        if (errorLatch) return;
 
         if (options & MAP_ALL) {
             mapRemainder(); // map any unmapped IDs
+            if (errorLatch) return;
+
             applyMap();     // Now remap each shader to the new IDs we've come up with
+            if (errorLatch) return;
         }
     }
 
diff --git a/SPIRV/SPVRemapper.h b/SPIRV/SPVRemapper.h
index aab6d60..5abdd4a 100755
--- a/SPIRV/SPVRemapper.h
+++ b/SPIRV/SPVRemapper.h
@@ -39,6 +39,7 @@
 #include <string>
 #include <vector>
 #include <cstdlib>
+#include <exception>
 
 namespace spv {
 
@@ -111,7 +112,9 @@
 class spirvbin_t : public spirvbin_base_t
 {
 public:
-   spirvbin_t(int verbose = 0) : entryPoint(spv::NoResult), largestNewId(0), verbose(verbose) { }
+   spirvbin_t(int verbose = 0) : entryPoint(spv::NoResult), largestNewId(0), verbose(verbose), errorLatch(false)
+   { }
+
    virtual ~spirvbin_t() { }
 
    // remap on an existing binary in memory
@@ -165,7 +168,7 @@
    typedef std::unordered_map<spv::Id, unsigned> typesize_map_t;
 
    // handle error
-   void error(const std::string& txt) const { errorHandler(txt); }
+   void error(const std::string& txt) const { errorLatch = true; errorHandler(txt); }
 
    bool     isConstOp(spv::Op opCode)      const;
    bool     isTypeOp(spv::Op opCode)       const;
@@ -285,6 +288,11 @@
    std::uint32_t options;
    int           verbose;     // verbosity level
 
+   // Error latch: this is set if the error handler is ever executed.  It would be better to
+   // use a try/catch block and throw, but that's not desired for certain environments, so
+   // this is the alternative.
+   mutable bool errorLatch;
+
    static errorfn_t errorHandler;
    static logfn_t   logHandler;
 };
diff --git a/StandAlone/StandAlone.cpp b/StandAlone/StandAlone.cpp
index 3911e56..771ddeb 100644
--- a/StandAlone/StandAlone.cpp
+++ b/StandAlone/StandAlone.cpp
@@ -95,6 +95,8 @@
     EOptionAutoMapLocations     = (1 << 25),
     EOptionDebug                = (1 << 26),
     EOptionStdin                = (1 << 27),
+    EOptionOptimizeDisable      = (1 << 28),
+    EOptionOptimizeSize         = (1 << 29),
 };
 
 //
@@ -532,6 +534,18 @@
             case 'I':
                 IncludeDirectoryList.push_back(getStringOperand("-I<dir> include path"));
                 break;
+            case 'O':
+                if (argv[0][2] == 'd')
+                    Options |= EOptionOptimizeDisable;
+                else if (argv[0][2] == 's')
+#ifdef ENABLE_OPT
+                    Options |= EOptionOptimizeSize;
+#else
+                    Error("-Os not available; optimizer not linked");
+#endif
+                else
+                    Error("unknown -O option");
+                break;
             case 'S':
                 if (argc <= 1)
                     Error("no <stage> specified for -S");
@@ -771,8 +785,12 @@
         shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count);
         if (entryPointName) // HLSL todo: this needs to be tracked per compUnits
             shader->setEntryPoint(entryPointName);
-        if (sourceEntryPointName)
+        if (sourceEntryPointName) {
+            if (entryPointName == nullptr)
+                printf("Warning: Changing source entry point name without setting an entry-point name.\n"
+                       "Use '-e <name>'.\n");
             shader->setSourceEntryPoint(sourceEntryPointName);
+        }
         if (UserPreamble.isSet())
             shader->setPreamble(UserPreamble.get());
         shader->addProcesses(Processes);
@@ -886,6 +904,8 @@
                     glslang::SpvOptions spvOptions;
                     if (Options & EOptionDebug)
                         spvOptions.generateDebugInfo = true;
+                    spvOptions.disableOptimizer = (Options & EOptionOptimizeDisable) != 0;
+                    spvOptions.optimizeSize = (Options & EOptionOptimizeSize) != 0;
                     glslang::GlslangToSpv(*program.getIntermediate((EShLanguage)stage), spirv, &logger, &spvOptions);
 
                     // Dump the spv to a file or stdout, etc., but only if not doing
@@ -1205,6 +1225,8 @@
            "  -H          print human readable form of SPIR-V; turns on -V\n"
            "  -I<dir>     add dir to the include search path; includer's directory\n"
            "              is searched first, followed by left-to-right order of -I\n"
+           "  -Od         disables optimization. May cause illegal SPIR-V for HLSL.\n"
+           "  -Os         optimizes SPIR-V to minimize size.\n"
            "  -S <stage>  uses specified stage rather than parsing the file extension\n"
            "              choices for <stage> are vert, tesc, tese, geom, frag, or comp\n"
            "  -U<macro>   undefine a pre-processor macro\n"
diff --git a/Test/100samplerExternal.frag b/Test/100samplerExternal.frag
new file mode 100644
index 0000000..9f6f397
--- /dev/null
+++ b/Test/100samplerExternal.frag
@@ -0,0 +1,41 @@
+#version 100

+

+#extension GL_OES_EGL_image_external : enable

+

+uniform samplerExternalOES sExt;

+precision mediump samplerExternalOES;

+uniform samplerExternalOES mediumExt;

+uniform highp samplerExternalOES highExt;

+

+void main()

+{

+    texture2D(sExt, vec2(0.2));

+    texture2D(mediumExt, vec2(0.2));

+    texture2D(highExt, vec2(0.2));

+    texture2DProj(sExt, vec3(0.3));

+    texture2DProj(sExt, vec4(0.3));

+

+    int lod = 0;

+    highp float bias = 0.01;

+    textureSize(sExt, lod);  // ERROR

+    texture(sExt, vec2(0.2));  // ERROR

+    texture(sExt, vec2(0.2), bias);  // ERROR

+    textureProj(sExt, vec3(0.2));  // ERROR

+    textureProj(sExt, vec3(0.2), bias);  // ERROR

+    textureProj(sExt, vec4(0.2));  // ERROR

+    textureProj(sExt, vec4(0.2), bias);  // ERROR

+    texelFetch(sExt, ivec2(4), lod);  // ERROR

+

+    texture3D(sExt, vec3(0.3));  // ERROR

+    texture2DProjLod(sExt, vec3(0.3), 0.3);  // ERROR

+    texture(sExt, vec3(0.3));  // ERROR

+    textureProjLod(sExt, vec3(0.3), 0.3);  // ERROR

+}

+

+#extension GL_OES_EGL_image_external : disable

+

+#extension GL_OES_EGL_image_external_essl3 : enable

+uniform samplerExternalOES badExt;  // ERROR

+#extension GL_OES_EGL_image_external_essl3 : disable

+

+uniform samplerExternalOES badExt;  // ERROR

diff --git a/Test/300samplerExternal.frag b/Test/300samplerExternal.frag
new file mode 100644
index 0000000..3724f8e
--- /dev/null
+++ b/Test/300samplerExternal.frag
@@ -0,0 +1,41 @@
+#version 300 es

+

+#extension GL_OES_EGL_image_external_essl3 : enable

+

+uniform samplerExternalOES sExt;

+precision mediump samplerExternalOES;

+uniform samplerExternalOES mediumExt;

+uniform highp samplerExternalOES highExt;

+

+void main()

+{

+    texture2D(sExt, vec2(0.2));  // ERROR

+    texture2D(mediumExt, vec2(0.2));  // ERROR

+    texture2D(highExt, vec2(0.2));  // ERROR

+    texture2DProj(sExt, vec3(0.3));  // ERROR

+    texture2DProj(sExt, vec4(0.3));  // ERROR

+

+    int lod = 0;

+    highp float bias = 0.01;

+    textureSize(sExt, lod);

+    texture(sExt, vec2(0.2));

+    texture(sExt, vec2(0.2), bias);

+    textureProj(sExt, vec3(0.2));

+    textureProj(sExt, vec3(0.2), bias);

+    textureProj(sExt, vec4(0.2));

+    textureProj(sExt, vec4(0.2), bias);

+    texelFetch(sExt, ivec2(4), lod);

+

+    texture3D(sExt, vec3(0.3));  // ERROR

+    texture2DProjLod(sExt, vec3(0.3), 0.3);  // ERROR

+    texture(sExt, vec3(0.3));  // ERROR

+    textureProjLod(sExt, vec3(0.3), 0.3);  // ERROR

+}

+

+#extension GL_OES_EGL_image_external_essl3 : disable

+

+#extension GL_OES_EGL_image_external : enable

+uniform samplerExternalOES badExt;  // ERROR

+#extension GL_OES_EGL_image_external : disable

+

+uniform samplerExternalOES badExt;  // ERROR

diff --git a/Test/baseLegalResults/hlsl.aliasOpaque.frag.out b/Test/baseLegalResults/hlsl.aliasOpaque.frag.out
new file mode 100644
index 0000000..779d5e1
--- /dev/null
+++ b/Test/baseLegalResults/hlsl.aliasOpaque.frag.out
@@ -0,0 +1,50 @@
+hlsl.aliasOpaque.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 81
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 57
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 37  "gss2"
+                              Name 39  "gss"
+                              Name 43  "gtex"
+                              Name 57  "@entryPointOutput"
+                              Decorate 37(gss2) DescriptorSet 0
+                              Decorate 39(gss) DescriptorSet 0
+                              Decorate 43(gtex) DescriptorSet 0
+                              Decorate 57(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeSampler
+               8:             TypeFloat 32
+              10:             TypeImage 8(float) 2D sampled format:Unknown
+              12:             TypeVector 8(float) 4
+              25:             TypeSampledImage 10
+              27:             TypeVector 8(float) 2
+              28:    8(float) Constant 1045220557
+              29:    8(float) Constant 1050253722
+              30:   27(fvec2) ConstantComposite 28 29
+              36:             TypePointer UniformConstant 6
+        37(gss2):     36(ptr) Variable UniformConstant
+         39(gss):     36(ptr) Variable UniformConstant
+              42:             TypePointer UniformConstant 10
+        43(gtex):     42(ptr) Variable UniformConstant
+              46:    8(float) Constant 1077936128
+              56:             TypePointer Output 12(fvec4)
+57(@entryPointOutput):     56(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              68:           6 Load 39(gss)
+              69:          10 Load 43(gtex)
+              78:          25 SampledImage 69 68
+              79:   12(fvec4) ImageSampleImplicitLod 78 30
+              80:   12(fvec4) VectorTimesScalar 79 46
+                              Store 57(@entryPointOutput) 80
+                              Return
+                              FunctionEnd
diff --git a/Test/baseLegalResults/hlsl.flattenOpaque.frag.out b/Test/baseLegalResults/hlsl.flattenOpaque.frag.out
new file mode 100644
index 0000000..3c7d198
--- /dev/null
+++ b/Test/baseLegalResults/hlsl.flattenOpaque.frag.out
@@ -0,0 +1,65 @@
+hlsl.flattenOpaque.frag
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 144
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 97
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 38  "tex"
+                              Name 70  "s.s2D"
+                              Name 79  "s2.s2D"
+                              Name 80  "s2.tex"
+                              Name 97  "@entryPointOutput"
+                              Decorate 38(tex) DescriptorSet 0
+                              Decorate 70(s.s2D) DescriptorSet 0
+                              Decorate 79(s2.s2D) DescriptorSet 0
+                              Decorate 80(s2.tex) DescriptorSet 0
+                              Decorate 97(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeSampler
+               8:             TypeFloat 32
+               9:             TypeVector 8(float) 4
+              14:             TypeVector 8(float) 2
+              21:             TypeImage 8(float) 2D sampled format:Unknown
+              37:             TypePointer UniformConstant 21
+         38(tex):     37(ptr) Variable UniformConstant
+              41:             TypeSampledImage 21
+              43:    8(float) Constant 1045220557
+              44:    8(float) Constant 1050253722
+              45:   14(fvec2) ConstantComposite 43 44
+              69:             TypePointer UniformConstant 6
+       70(s.s2D):     69(ptr) Variable UniformConstant
+      79(s2.s2D):     69(ptr) Variable UniformConstant
+      80(s2.tex):     37(ptr) Variable UniformConstant
+              96:             TypePointer Output 9(fvec4)
+97(@entryPointOutput):     96(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+             109:           6 Load 70(s.s2D)
+             123:          21 Load 38(tex)
+             125:          41 SampledImage 123 109
+             126:    9(fvec4) ImageSampleImplicitLod 125 45
+             111:           6 Load 70(s.s2D)
+             128:          21 Load 38(tex)
+             130:          41 SampledImage 128 111
+             132:    9(fvec4) ImageSampleImplicitLod 130 45
+             113:    9(fvec4) FAdd 126 132
+             114:           6 Load 79(s2.s2D)
+             115:          21 Load 80(s2.tex)
+             136:          41 SampledImage 115 114
+             137:    9(fvec4) ImageSampleImplicitLod 136 45
+             117:    9(fvec4) FAdd 113 137
+             118:           6 Load 79(s2.s2D)
+             119:          21 Load 80(s2.tex)
+             141:          41 SampledImage 119 118
+             143:    9(fvec4) ImageSampleImplicitLod 141 45
+             121:    9(fvec4) FAdd 117 143
+                              Store 97(@entryPointOutput) 121
+                              Return
+                              FunctionEnd
diff --git a/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out b/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out
new file mode 100644
index 0000000..4aef874
--- /dev/null
+++ b/Test/baseLegalResults/hlsl.flattenOpaqueInit.vert.out
@@ -0,0 +1,49 @@
+hlsl.flattenOpaqueInit.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 125
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 82
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 17  "FxaaTex"
+                              MemberName 17(FxaaTex) 0  "smpl"
+                              MemberName 17(FxaaTex) 1  "tex"
+                              Name 38  "g_tInputTexture_sampler"
+                              Name 42  "g_tInputTexture"
+                              Name 82  "@entryPointOutput"
+                              Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
+                              Decorate 42(g_tInputTexture) DescriptorSet 0
+                              Decorate 82(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeSampler
+               8:             TypeFloat 32
+               9:             TypeImage 8(float) 2D sampled format:Unknown
+              11:             TypeVector 8(float) 4
+     17(FxaaTex):             TypeStruct 6 9
+              26:             TypeSampledImage 9
+              28:             TypeVector 8(float) 2
+              29:    8(float) Constant 1050253722
+              30:    8(float) Constant 1053609165
+              31:   28(fvec2) ConstantComposite 29 30
+              32:    8(float) Constant 0
+              37:             TypePointer UniformConstant 6
+38(g_tInputTexture_sampler):     37(ptr) Variable UniformConstant
+              41:             TypePointer UniformConstant 9
+42(g_tInputTexture):     41(ptr) Variable UniformConstant
+              81:             TypePointer Output 11(fvec4)
+82(@entryPointOutput):     81(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              96:           6 Load 38(g_tInputTexture_sampler)
+              97:           9 Load 42(g_tInputTexture)
+             123:          26 SampledImage 97 96
+             124:   11(fvec4) ImageSampleExplicitLod 123 31 Lod 32
+                              Store 82(@entryPointOutput) 124
+                              Return
+                              FunctionEnd
diff --git a/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out b/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out
new file mode 100644
index 0000000..0b05615
--- /dev/null
+++ b/Test/baseLegalResults/hlsl.flattenOpaqueInitMix.vert.out
@@ -0,0 +1,49 @@
+hlsl.flattenOpaqueInitMix.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 100
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Vertex 4  "main" 68
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 34  "FxaaTex"
+                              MemberName 34(FxaaTex) 0  "smpl"
+                              MemberName 34(FxaaTex) 1  "tex"
+                              MemberName 34(FxaaTex) 2  "f"
+                              Name 38  "g_tInputTexture_sampler"
+                              Name 41  "g_tInputTexture"
+                              Name 68  "@entryPointOutput"
+                              Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
+                              Decorate 41(g_tInputTexture) DescriptorSet 0
+                              Decorate 68(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeSampler
+               8:             TypeFloat 32
+               9:             TypeImage 8(float) 2D sampled format:Unknown
+              12:             TypeVector 8(float) 4
+              24:             TypeSampledImage 9
+              28:             TypeVector 8(float) 2
+              30:    8(float) Constant 0
+     34(FxaaTex):             TypeStruct 6 9 8(float)
+              37:             TypePointer UniformConstant 6
+38(g_tInputTexture_sampler):     37(ptr) Variable UniformConstant
+              40:             TypePointer UniformConstant 9
+41(g_tInputTexture):     40(ptr) Variable UniformConstant
+              43:    8(float) Constant 1056964608
+              67:             TypePointer Output 12(fvec4)
+68(@entryPointOutput):     67(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              79:           6 Load 38(g_tInputTexture_sampler)
+              80:           9 Load 41(g_tInputTexture)
+              95:          24 SampledImage 80 79
+              98:   28(fvec2) CompositeConstruct 43 43
+              99:   12(fvec4) ImageSampleExplicitLod 95 98 Lod 30
+                              Store 68(@entryPointOutput) 99
+                              Return
+                              FunctionEnd
diff --git a/Test/baseLegalResults/hlsl.flattenSubset.frag.out b/Test/baseLegalResults/hlsl.flattenSubset.frag.out
new file mode 100755
index 0000000..20aedec
--- /dev/null
+++ b/Test/baseLegalResults/hlsl.flattenSubset.frag.out
@@ -0,0 +1,48 @@
+hlsl.flattenSubset.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 85
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 54 57
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 17  "samp"
+                              Name 41  "tex"
+                              Name 54  "vpos"
+                              Name 57  "@entryPointOutput"
+                              Decorate 17(samp) DescriptorSet 0
+                              Decorate 41(tex) DescriptorSet 0
+                              Decorate 54(vpos) Location 0
+                              Decorate 57(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+              13:             TypeSampler
+              16:             TypePointer UniformConstant 13
+        17(samp):     16(ptr) Variable UniformConstant
+              39:             TypeImage 6(float) 2D sampled format:Unknown
+              40:             TypePointer UniformConstant 39
+         41(tex):     40(ptr) Variable UniformConstant
+              44:             TypeSampledImage 39
+              46:             TypeVector 6(float) 2
+              47:    6(float) Constant 1056964608
+              48:   46(fvec2) ConstantComposite 47 47
+              53:             TypePointer Input 7(fvec4)
+        54(vpos):     53(ptr) Variable Input
+              56:             TypePointer Output 7(fvec4)
+57(@entryPointOutput):     56(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              74:          13 Load 17(samp)
+              81:          39 Load 41(tex)
+              83:          44 SampledImage 81 74
+              84:    7(fvec4) ImageSampleImplicitLod 83 48
+                              Store 57(@entryPointOutput) 84
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/100samplerExternal.frag.out b/Test/baseResults/100samplerExternal.frag.out
new file mode 100644
index 0000000..8b689c7
--- /dev/null
+++ b/Test/baseResults/100samplerExternal.frag.out
@@ -0,0 +1,172 @@
+100samplerExternal.frag
+ERROR: 0:20: 'textureSize' : no matching overloaded function found 
+ERROR: 0:21: 'texture' : no matching overloaded function found 
+ERROR: 0:22: 'texture' : no matching overloaded function found 
+ERROR: 0:23: 'textureProj' : no matching overloaded function found 
+ERROR: 0:24: 'textureProj' : no matching overloaded function found 
+ERROR: 0:25: 'textureProj' : no matching overloaded function found 
+ERROR: 0:26: 'textureProj' : no matching overloaded function found 
+ERROR: 0:27: 'texelFetch' : no matching overloaded function found 
+ERROR: 0:29: 'texture3D' : no matching overloaded function found 
+ERROR: 0:30: 'texture2DProjLod' : no matching overloaded function found 
+ERROR: 0:31: 'texture' : no matching overloaded function found 
+ERROR: 0:32: 'textureProjLod' : no matching overloaded function found 
+ERROR: 0:38: 'samplerExternalOES' : required extension not requested: GL_OES_EGL_image_external
+ERROR: 0:41: '' :  syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
+ERROR: 14 compilation errors.  No code generated.
+
+
+Shader version: 100
+Requested GL_OES_EGL_image_external
+Requested GL_OES_EGL_image_external_essl3
+ERROR: node is still EOpNull!
+0:10  Function Definition: main( ( global void)
+0:10    Function Parameters: 
+0:12    Sequence
+0:12      texture ( global lowp 4-component vector of float)
+0:12        'sExt' ( uniform lowp samplerExternalOES)
+0:12        Constant:
+0:12          0.200000
+0:12          0.200000
+0:13      texture ( global mediump 4-component vector of float)
+0:13        'mediumExt' ( uniform mediump samplerExternalOES)
+0:13        Constant:
+0:13          0.200000
+0:13          0.200000
+0:14      texture ( global highp 4-component vector of float)
+0:14        'highExt' ( uniform highp samplerExternalOES)
+0:14        Constant:
+0:14          0.200000
+0:14          0.200000
+0:15      textureProj ( global lowp 4-component vector of float)
+0:15        'sExt' ( uniform lowp samplerExternalOES)
+0:15        Constant:
+0:15          0.300000
+0:15          0.300000
+0:15          0.300000
+0:16      textureProj ( global lowp 4-component vector of float)
+0:16        'sExt' ( uniform lowp samplerExternalOES)
+0:16        Constant:
+0:16          0.300000
+0:16          0.300000
+0:16          0.300000
+0:16          0.300000
+0:18      Sequence
+0:18        move second child to first child ( temp mediump int)
+0:18          'lod' ( temp mediump int)
+0:18          Constant:
+0:18            0 (const int)
+0:19      Sequence
+0:19        move second child to first child ( temp highp float)
+0:19          'bias' ( temp highp float)
+0:19          Constant:
+0:19            0.010000
+0:20      Constant:
+0:20        0.000000
+0:21      Constant:
+0:21        0.000000
+0:22      Constant:
+0:22        0.000000
+0:23      Constant:
+0:23        0.000000
+0:24      Constant:
+0:24        0.000000
+0:25      Constant:
+0:25        0.000000
+0:26      Constant:
+0:26        0.000000
+0:27      Constant:
+0:27        0.000000
+0:29      Constant:
+0:29        0.000000
+0:30      Constant:
+0:30        0.000000
+0:31      Constant:
+0:31        0.000000
+0:32      Constant:
+0:32        0.000000
+0:?   Linker Objects
+0:?     'sExt' ( uniform lowp samplerExternalOES)
+0:?     'mediumExt' ( uniform mediump samplerExternalOES)
+0:?     'highExt' ( uniform highp samplerExternalOES)
+0:?     'badExt' ( uniform mediump samplerExternalOES)
+
+
+Linked fragment stage:
+
+
+Shader version: 100
+Requested GL_OES_EGL_image_external
+Requested GL_OES_EGL_image_external_essl3
+ERROR: node is still EOpNull!
+0:10  Function Definition: main( ( global void)
+0:10    Function Parameters: 
+0:12    Sequence
+0:12      texture ( global lowp 4-component vector of float)
+0:12        'sExt' ( uniform lowp samplerExternalOES)
+0:12        Constant:
+0:12          0.200000
+0:12          0.200000
+0:13      texture ( global mediump 4-component vector of float)
+0:13        'mediumExt' ( uniform mediump samplerExternalOES)
+0:13        Constant:
+0:13          0.200000
+0:13          0.200000
+0:14      texture ( global highp 4-component vector of float)
+0:14        'highExt' ( uniform highp samplerExternalOES)
+0:14        Constant:
+0:14          0.200000
+0:14          0.200000
+0:15      textureProj ( global lowp 4-component vector of float)
+0:15        'sExt' ( uniform lowp samplerExternalOES)
+0:15        Constant:
+0:15          0.300000
+0:15          0.300000
+0:15          0.300000
+0:16      textureProj ( global lowp 4-component vector of float)
+0:16        'sExt' ( uniform lowp samplerExternalOES)
+0:16        Constant:
+0:16          0.300000
+0:16          0.300000
+0:16          0.300000
+0:16          0.300000
+0:18      Sequence
+0:18        move second child to first child ( temp mediump int)
+0:18          'lod' ( temp mediump int)
+0:18          Constant:
+0:18            0 (const int)
+0:19      Sequence
+0:19        move second child to first child ( temp highp float)
+0:19          'bias' ( temp highp float)
+0:19          Constant:
+0:19            0.010000
+0:20      Constant:
+0:20        0.000000
+0:21      Constant:
+0:21        0.000000
+0:22      Constant:
+0:22        0.000000
+0:23      Constant:
+0:23        0.000000
+0:24      Constant:
+0:24        0.000000
+0:25      Constant:
+0:25        0.000000
+0:26      Constant:
+0:26        0.000000
+0:27      Constant:
+0:27        0.000000
+0:29      Constant:
+0:29        0.000000
+0:30      Constant:
+0:30        0.000000
+0:31      Constant:
+0:31        0.000000
+0:32      Constant:
+0:32        0.000000
+0:?   Linker Objects
+0:?     'sExt' ( uniform lowp samplerExternalOES)
+0:?     'mediumExt' ( uniform mediump samplerExternalOES)
+0:?     'highExt' ( uniform highp samplerExternalOES)
+0:?     'badExt' ( uniform mediump samplerExternalOES)
+
diff --git a/Test/baseResults/150.tesc.out b/Test/baseResults/150.tesc.out
index 5cc9e80..25e44ed 100644
--- a/Test/baseResults/150.tesc.out
+++ b/Test/baseResults/150.tesc.out
@@ -754,7 +754,7 @@
 ERROR: 0:29: ' const 2-element array of 4-component vector of float' : cannot construct with these arguments 
 ERROR: 0:29: '=' :  cannot convert from ' const float' to ' global 2-element array of 4-component vector of float'
 ERROR: 0:30: 'initializer list' : wrong number of matrix columns:  temp 4X2 matrix of float
-ERROR: 0:40: 'constructor' :  cannot convert parameter 1 from ' temp float' to ' temp structure{ global float s,  global float t}'
+ERROR: 0:40: 'constructor' :  cannot convert parameter 1 from ' const structure{ global 4-component vector of float a,  global 4-component vector of float b}' to ' temp structure{ global float s,  global float t}'
 ERROR: 0:70: 'initializer list' : wrong number of structure members 
 ERROR: 13 compilation errors.  No code generated.
 
diff --git a/Test/baseResults/300samplerExternal.frag.out b/Test/baseResults/300samplerExternal.frag.out
new file mode 100644
index 0000000..9074552
--- /dev/null
+++ b/Test/baseResults/300samplerExternal.frag.out
@@ -0,0 +1,197 @@
+300samplerExternal.frag
+ERROR: 0:12: 'texture2D' : no matching overloaded function found 
+ERROR: 0:13: 'texture2D' : no matching overloaded function found 
+ERROR: 0:14: 'texture2D' : no matching overloaded function found 
+ERROR: 0:15: 'texture2DProj' : no matching overloaded function found 
+ERROR: 0:16: 'texture2DProj' : no matching overloaded function found 
+ERROR: 0:29: 'texture3D' : no matching overloaded function found 
+ERROR: 0:30: 'texture2DProjLod' : no matching overloaded function found 
+ERROR: 0:31: 'texture' : no matching overloaded function found 
+ERROR: 0:32: 'textureProjLod' : no matching overloaded function found 
+ERROR: 0:38: 'samplerExternalOES' : required extension not requested: GL_OES_EGL_image_external_essl3
+ERROR: 0:41: '' :  syntax error, unexpected IDENTIFIER, expecting LEFT_BRACE or COMMA or SEMICOLON
+ERROR: 11 compilation errors.  No code generated.
+
+
+Shader version: 300
+Requested GL_OES_EGL_image_external
+Requested GL_OES_EGL_image_external_essl3
+ERROR: node is still EOpNull!
+0:10  Function Definition: main( ( global void)
+0:10    Function Parameters: 
+0:12    Sequence
+0:12      Constant:
+0:12        0.000000
+0:13      Constant:
+0:13        0.000000
+0:14      Constant:
+0:14        0.000000
+0:15      Constant:
+0:15        0.000000
+0:16      Constant:
+0:16        0.000000
+0:18      Sequence
+0:18        move second child to first child ( temp mediump int)
+0:18          'lod' ( temp mediump int)
+0:18          Constant:
+0:18            0 (const int)
+0:19      Sequence
+0:19        move second child to first child ( temp highp float)
+0:19          'bias' ( temp highp float)
+0:19          Constant:
+0:19            0.010000
+0:20      textureSize ( global highp 2-component vector of int, operation at mediump)
+0:20        'sExt' ( uniform lowp samplerExternalOES)
+0:20        'lod' ( temp mediump int)
+0:21      texture ( global lowp 4-component vector of float)
+0:21        'sExt' ( uniform lowp samplerExternalOES)
+0:21        Constant:
+0:21          0.200000
+0:21          0.200000
+0:22      texture ( global lowp 4-component vector of float, operation at highp)
+0:22        'sExt' ( uniform lowp samplerExternalOES)
+0:22        Constant:
+0:22          0.200000
+0:22          0.200000
+0:22        'bias' ( temp highp float)
+0:23      textureProj ( global lowp 4-component vector of float)
+0:23        'sExt' ( uniform lowp samplerExternalOES)
+0:23        Constant:
+0:23          0.200000
+0:23          0.200000
+0:23          0.200000
+0:24      textureProj ( global lowp 4-component vector of float, operation at highp)
+0:24        'sExt' ( uniform lowp samplerExternalOES)
+0:24        Constant:
+0:24          0.200000
+0:24          0.200000
+0:24          0.200000
+0:24        'bias' ( temp highp float)
+0:25      textureProj ( global lowp 4-component vector of float)
+0:25        'sExt' ( uniform lowp samplerExternalOES)
+0:25        Constant:
+0:25          0.200000
+0:25          0.200000
+0:25          0.200000
+0:25          0.200000
+0:26      textureProj ( global lowp 4-component vector of float, operation at highp)
+0:26        'sExt' ( uniform lowp samplerExternalOES)
+0:26        Constant:
+0:26          0.200000
+0:26          0.200000
+0:26          0.200000
+0:26          0.200000
+0:26        'bias' ( temp highp float)
+0:27      textureFetch ( global lowp 4-component vector of float, operation at mediump)
+0:27        'sExt' ( uniform lowp samplerExternalOES)
+0:27        Constant:
+0:27          4 (const int)
+0:27          4 (const int)
+0:27        'lod' ( temp mediump int)
+0:29      Constant:
+0:29        0.000000
+0:30      Constant:
+0:30        0.000000
+0:31      Constant:
+0:31        0.000000
+0:32      Constant:
+0:32        0.000000
+0:?   Linker Objects
+0:?     'sExt' ( uniform lowp samplerExternalOES)
+0:?     'mediumExt' ( uniform mediump samplerExternalOES)
+0:?     'highExt' ( uniform highp samplerExternalOES)
+0:?     'badExt' ( uniform mediump samplerExternalOES)
+
+
+Linked fragment stage:
+
+
+Shader version: 300
+Requested GL_OES_EGL_image_external
+Requested GL_OES_EGL_image_external_essl3
+ERROR: node is still EOpNull!
+0:10  Function Definition: main( ( global void)
+0:10    Function Parameters: 
+0:12    Sequence
+0:12      Constant:
+0:12        0.000000
+0:13      Constant:
+0:13        0.000000
+0:14      Constant:
+0:14        0.000000
+0:15      Constant:
+0:15        0.000000
+0:16      Constant:
+0:16        0.000000
+0:18      Sequence
+0:18        move second child to first child ( temp mediump int)
+0:18          'lod' ( temp mediump int)
+0:18          Constant:
+0:18            0 (const int)
+0:19      Sequence
+0:19        move second child to first child ( temp highp float)
+0:19          'bias' ( temp highp float)
+0:19          Constant:
+0:19            0.010000
+0:20      textureSize ( global highp 2-component vector of int, operation at mediump)
+0:20        'sExt' ( uniform lowp samplerExternalOES)
+0:20        'lod' ( temp mediump int)
+0:21      texture ( global lowp 4-component vector of float)
+0:21        'sExt' ( uniform lowp samplerExternalOES)
+0:21        Constant:
+0:21          0.200000
+0:21          0.200000
+0:22      texture ( global lowp 4-component vector of float, operation at highp)
+0:22        'sExt' ( uniform lowp samplerExternalOES)
+0:22        Constant:
+0:22          0.200000
+0:22          0.200000
+0:22        'bias' ( temp highp float)
+0:23      textureProj ( global lowp 4-component vector of float)
+0:23        'sExt' ( uniform lowp samplerExternalOES)
+0:23        Constant:
+0:23          0.200000
+0:23          0.200000
+0:23          0.200000
+0:24      textureProj ( global lowp 4-component vector of float, operation at highp)
+0:24        'sExt' ( uniform lowp samplerExternalOES)
+0:24        Constant:
+0:24          0.200000
+0:24          0.200000
+0:24          0.200000
+0:24        'bias' ( temp highp float)
+0:25      textureProj ( global lowp 4-component vector of float)
+0:25        'sExt' ( uniform lowp samplerExternalOES)
+0:25        Constant:
+0:25          0.200000
+0:25          0.200000
+0:25          0.200000
+0:25          0.200000
+0:26      textureProj ( global lowp 4-component vector of float, operation at highp)
+0:26        'sExt' ( uniform lowp samplerExternalOES)
+0:26        Constant:
+0:26          0.200000
+0:26          0.200000
+0:26          0.200000
+0:26          0.200000
+0:26        'bias' ( temp highp float)
+0:27      textureFetch ( global lowp 4-component vector of float, operation at mediump)
+0:27        'sExt' ( uniform lowp samplerExternalOES)
+0:27        Constant:
+0:27          4 (const int)
+0:27          4 (const int)
+0:27        'lod' ( temp mediump int)
+0:29      Constant:
+0:29        0.000000
+0:30      Constant:
+0:30        0.000000
+0:31      Constant:
+0:31        0.000000
+0:32      Constant:
+0:32        0.000000
+0:?   Linker Objects
+0:?     'sExt' ( uniform lowp samplerExternalOES)
+0:?     'mediumExt' ( uniform mediump samplerExternalOES)
+0:?     'highExt' ( uniform highp samplerExternalOES)
+0:?     'badExt' ( uniform mediump samplerExternalOES)
+
diff --git a/Test/baseResults/420.tese.out b/Test/baseResults/420.tese.out
index 66d41e5..f14e1c0 100644
--- a/Test/baseResults/420.tese.out
+++ b/Test/baseResults/420.tese.out
@@ -10,7 +10,7 @@
 ERROR: 0:29: ' const 2-element array of 4-component vector of float' : cannot construct with these arguments 
 ERROR: 0:29: '=' :  cannot convert from ' const float' to ' global 2-element array of 4-component vector of float'
 ERROR: 0:30: 'initializer list' : wrong number of matrix columns:  temp 4X2 matrix of float
-ERROR: 0:40: 'constructor' :  cannot convert parameter 1 from ' temp float' to ' temp structure{ global float s,  global float t}'
+ERROR: 0:40: 'constructor' :  cannot convert parameter 1 from ' const structure{ global 4-component vector of float a,  global 4-component vector of float b}' to ' temp structure{ global float s,  global float t}'
 ERROR: 0:70: 'initializer list' : wrong number of structure members 
 ERROR: 13 compilation errors.  No code generated.
 
diff --git a/Test/baseResults/hlsl.aliasOpaque.frag.out b/Test/baseResults/hlsl.aliasOpaque.frag.out
index f08765e..694d404 100755
--- a/Test/baseResults/hlsl.aliasOpaque.frag.out
+++ b/Test/baseResults/hlsl.aliasOpaque.frag.out
@@ -1,4 +1,5 @@
 hlsl.aliasOpaque.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
 Shader version: 500
 gl_FragCoord origin is upper left
 0:? Sequence
@@ -21,18 +22,24 @@
 0:17  Function Definition: @main( ( temp 4-component vector of float)
 0:17    Function Parameters: 
 0:?     Sequence
-0:19      'gss2' ( uniform sampler)
-0:20      'gss' ( uniform sampler)
-0:21      'gtex' ( uniform texture2D)
+0:19      move second child to first child ( temp sampler)
+0:?         'os.ss' ( temp sampler)
+0:19        'gss2' ( uniform sampler)
+0:20      move second child to first child ( temp sampler)
+0:?         'os.ss' ( temp sampler)
+0:20        'gss' ( uniform sampler)
+0:21      move second child to first child ( temp texture2D)
+0:?         'os.tex' ( temp texture2D)
+0:21        'gtex' ( uniform texture2D)
 0:22      move second child to first child ( temp float)
 0:?         'os.a' ( temp float)
 0:22        Constant:
 0:22          3.000000
 0:28      Branch: Return with expression
 0:28        Function Call: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float)
-0:?           'gss' ( uniform sampler)
+0:?           'os.ss' ( temp sampler)
 0:?           'os.a' ( temp float)
-0:?           'gtex' ( uniform texture2D)
+0:?           'os.tex' ( temp texture2D)
 0:17  Function Definition: main( ( temp void)
 0:17    Function Parameters: 
 0:?     Sequence
@@ -71,18 +78,24 @@
 0:17  Function Definition: @main( ( temp 4-component vector of float)
 0:17    Function Parameters: 
 0:?     Sequence
-0:19      'gss2' ( uniform sampler)
-0:20      'gss' ( uniform sampler)
-0:21      'gtex' ( uniform texture2D)
+0:19      move second child to first child ( temp sampler)
+0:?         'os.ss' ( temp sampler)
+0:19        'gss2' ( uniform sampler)
+0:20      move second child to first child ( temp sampler)
+0:?         'os.ss' ( temp sampler)
+0:20        'gss' ( uniform sampler)
+0:21      move second child to first child ( temp texture2D)
+0:?         'os.tex' ( temp texture2D)
+0:21        'gtex' ( uniform texture2D)
 0:22      move second child to first child ( temp float)
 0:?         'os.a' ( temp float)
 0:22        Constant:
 0:22          3.000000
 0:28      Branch: Return with expression
 0:28        Function Call: osCall(struct-OS-p1-f1-t211; ( temp 4-component vector of float)
-0:?           'gss' ( uniform sampler)
+0:?           'os.ss' ( temp sampler)
 0:?           'os.a' ( temp float)
-0:?           'gtex' ( uniform texture2D)
+0:?           'os.tex' ( temp texture2D)
 0:17  Function Definition: main( ( temp void)
 0:17    Function Parameters: 
 0:?     Sequence
@@ -97,12 +110,12 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 48
+// Id's are bound by 59
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 46
+                              EntryPoint Fragment 4  "main" 57
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -111,24 +124,28 @@
                               Name 15  "s.a"
                               Name 16  "s.tex"
                               Name 20  "@main("
-                              Name 35  "gss2"
-                              Name 36  "gss"
-                              Name 37  "gtex"
-                              Name 38  "os.a"
-                              Name 40  "param"
-                              Name 46  "@entryPointOutput"
-                              Decorate 35(gss2) DescriptorSet 0
-                              Decorate 36(gss) DescriptorSet 0
-                              Decorate 37(gtex) DescriptorSet 0
-                              Decorate 46(@entryPointOutput) Location 0
+                              Name 35  "os.ss"
+                              Name 37  "gss2"
+                              Name 39  "gss"
+                              Name 41  "os.tex"
+                              Name 43  "gtex"
+                              Name 45  "os.a"
+                              Name 47  "param"
+                              Name 49  "param"
+                              Name 51  "param"
+                              Name 57  "@entryPointOutput"
+                              Decorate 37(gss2) DescriptorSet 0
+                              Decorate 39(gss) DescriptorSet 0
+                              Decorate 43(gtex) DescriptorSet 0
+                              Decorate 57(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeSampler
-               7:             TypePointer UniformConstant 6
+               7:             TypePointer Function 6
                8:             TypeFloat 32
                9:             TypePointer Function 8(float)
               10:             TypeImage 8(float) 2D sampled format:Unknown
-              11:             TypePointer UniformConstant 10
+              11:             TypePointer Function 10
               12:             TypeVector 8(float) 4
               13:             TypeFunction 12(fvec4) 7(ptr) 9(ptr) 11(ptr)
               19:             TypeFunction 12(fvec4)
@@ -137,16 +154,18 @@
               28:    8(float) Constant 1045220557
               29:    8(float) Constant 1050253722
               30:   27(fvec2) ConstantComposite 28 29
-        35(gss2):      7(ptr) Variable UniformConstant
-         36(gss):      7(ptr) Variable UniformConstant
-        37(gtex):     11(ptr) Variable UniformConstant
-              39:    8(float) Constant 1077936128
-              45:             TypePointer Output 12(fvec4)
-46(@entryPointOutput):     45(ptr) Variable Output
+              36:             TypePointer UniformConstant 6
+        37(gss2):     36(ptr) Variable UniformConstant
+         39(gss):     36(ptr) Variable UniformConstant
+              42:             TypePointer UniformConstant 10
+        43(gtex):     42(ptr) Variable UniformConstant
+              46:    8(float) Constant 1077936128
+              56:             TypePointer Output 12(fvec4)
+57(@entryPointOutput):     56(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-              47:   12(fvec4) FunctionCall 20(@main()
-                              Store 46(@entryPointOutput) 47
+              58:   12(fvec4) FunctionCall 20(@main()
+                              Store 57(@entryPointOutput) 58
                               Return
                               FunctionEnd
 17(osCall(struct-OS-p1-f1-t211;):   12(fvec4) Function None 13
@@ -164,11 +183,25 @@
                               FunctionEnd
       20(@main():   12(fvec4) Function None 19
               21:             Label
-        38(os.a):      9(ptr) Variable Function
-       40(param):      9(ptr) Variable Function
-                              Store 38(os.a) 39
-              41:    8(float) Load 38(os.a)
-                              Store 40(param) 41
-              42:   12(fvec4) FunctionCall 17(osCall(struct-OS-p1-f1-t211;) 36(gss) 40(param) 37(gtex)
-                              ReturnValue 42
+       35(os.ss):      7(ptr) Variable Function
+      41(os.tex):     11(ptr) Variable Function
+        45(os.a):      9(ptr) Variable Function
+       47(param):      7(ptr) Variable Function
+       49(param):      9(ptr) Variable Function
+       51(param):     11(ptr) Variable Function
+              38:           6 Load 37(gss2)
+                              Store 35(os.ss) 38
+              40:           6 Load 39(gss)
+                              Store 35(os.ss) 40
+              44:          10 Load 43(gtex)
+                              Store 41(os.tex) 44
+                              Store 45(os.a) 46
+              48:           6 Load 35(os.ss)
+                              Store 47(param) 48
+              50:    8(float) Load 45(os.a)
+                              Store 49(param) 50
+              52:          10 Load 41(os.tex)
+                              Store 51(param) 52
+              53:   12(fvec4) FunctionCall 17(osCall(struct-OS-p1-f1-t211;) 47(param) 49(param) 51(param)
+                              ReturnValue 53
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.array.flatten.frag.out b/Test/baseResults/hlsl.array.flatten.frag.out
index b2ff9aa..e32eb15 100644
--- a/Test/baseResults/hlsl.array.flatten.frag.out
+++ b/Test/baseResults/hlsl.array.flatten.frag.out
@@ -1,4 +1,5 @@
 hlsl.array.flatten.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
 Shader version: 500
 gl_FragCoord origin is upper left
 0:? Sequence
@@ -345,13 +346,13 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 137
+// Id's are bound by 143
 
                               Capability Shader
                               Capability Sampled1D
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 128
+                              EntryPoint Fragment 4  "main" 134
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -366,60 +367,62 @@
                               Name 34  "not_flattened_a"
                               Name 42  "g_tex[1]"
                               Name 45  "g_samp[1]"
-                              Name 61  "local_sampler_array"
-                              Name 63  "g_samp[0]"
-                              Name 68  "g_samp[2]"
-                              Name 71  "local_texture_array"
-                              Name 72  "g_tex[0]"
-                              Name 77  "g_tex[2]"
-                              Name 83  "local_float_array"
-                              Name 89  "$Global"
-                              MemberName 89($Global) 0  "g_mats"
-                              MemberName 89($Global) 1  "g_mats_explicit"
-                              MemberName 89($Global) 2  "g_floats"
-                              Name 91  ""
-                              Name 105  "aggShadow"
-                              Name 112  "aggShadow"
-                              Name 123  "ps_output"
-                              Name 124  "param"
-                              Name 128  "ps_output.color"
-                              Name 131  "g_tex_explicit[0]"
-                              Name 132  "g_tex_explicit[1]"
-                              Name 133  "g_tex_explicit[2]"
-                              Name 134  "g_samp_explicit[0]"
-                              Name 135  "g_samp_explicit[1]"
-                              Name 136  "g_samp_explicit[2]"
+                              Name 63  "local_sampler_array"
+                              Name 65  "g_samp[0]"
+                              Name 70  "g_samp[2]"
+                              Name 73  "local_texture_array"
+                              Name 74  "g_tex[0]"
+                              Name 79  "g_tex[2]"
+                              Name 85  "local_float_array"
+                              Name 91  "$Global"
+                              MemberName 91($Global) 0  "g_mats"
+                              MemberName 91($Global) 1  "g_mats_explicit"
+                              MemberName 91($Global) 2  "g_floats"
+                              Name 93  ""
+                              Name 107  "aggShadow"
+                              Name 114  "aggShadow"
+                              Name 121  "param"
+                              Name 123  "param"
+                              Name 129  "ps_output"
+                              Name 130  "param"
+                              Name 134  "ps_output.color"
+                              Name 137  "g_tex_explicit[0]"
+                              Name 138  "g_tex_explicit[1]"
+                              Name 139  "g_tex_explicit[2]"
+                              Name 140  "g_samp_explicit[0]"
+                              Name 141  "g_samp_explicit[1]"
+                              Name 142  "g_samp_explicit[2]"
                               Decorate 42(g_tex[1]) DescriptorSet 0
                               Decorate 45(g_samp[1]) DescriptorSet 0
-                              Decorate 63(g_samp[0]) DescriptorSet 0
-                              Decorate 68(g_samp[2]) DescriptorSet 0
-                              Decorate 72(g_tex[0]) DescriptorSet 0
-                              Decorate 77(g_tex[2]) DescriptorSet 0
-                              Decorate 86 ArrayStride 48
-                              Decorate 87 ArrayStride 48
-                              Decorate 88 ArrayStride 16
-                              MemberDecorate 89($Global) 0 RowMajor
-                              MemberDecorate 89($Global) 0 Offset 0
-                              MemberDecorate 89($Global) 0 MatrixStride 16
-                              MemberDecorate 89($Global) 1 RowMajor
-                              MemberDecorate 89($Global) 1 Offset 192
-                              MemberDecorate 89($Global) 1 MatrixStride 16
-                              MemberDecorate 89($Global) 2 Offset 384
-                              Decorate 89($Global) Block
-                              Decorate 91 DescriptorSet 0
-                              Decorate 128(ps_output.color) Location 0
-                              Decorate 131(g_tex_explicit[0]) DescriptorSet 0
-                              Decorate 131(g_tex_explicit[0]) Binding 1
-                              Decorate 132(g_tex_explicit[1]) DescriptorSet 0
-                              Decorate 132(g_tex_explicit[1]) Binding 2
-                              Decorate 133(g_tex_explicit[2]) DescriptorSet 0
-                              Decorate 133(g_tex_explicit[2]) Binding 3
-                              Decorate 134(g_samp_explicit[0]) DescriptorSet 0
-                              Decorate 134(g_samp_explicit[0]) Binding 5
-                              Decorate 135(g_samp_explicit[1]) DescriptorSet 0
-                              Decorate 135(g_samp_explicit[1]) Binding 6
-                              Decorate 136(g_samp_explicit[2]) DescriptorSet 0
-                              Decorate 136(g_samp_explicit[2]) Binding 7
+                              Decorate 65(g_samp[0]) DescriptorSet 0
+                              Decorate 70(g_samp[2]) DescriptorSet 0
+                              Decorate 74(g_tex[0]) DescriptorSet 0
+                              Decorate 79(g_tex[2]) DescriptorSet 0
+                              Decorate 88 ArrayStride 48
+                              Decorate 89 ArrayStride 48
+                              Decorate 90 ArrayStride 16
+                              MemberDecorate 91($Global) 0 RowMajor
+                              MemberDecorate 91($Global) 0 Offset 0
+                              MemberDecorate 91($Global) 0 MatrixStride 16
+                              MemberDecorate 91($Global) 1 RowMajor
+                              MemberDecorate 91($Global) 1 Offset 192
+                              MemberDecorate 91($Global) 1 MatrixStride 16
+                              MemberDecorate 91($Global) 2 Offset 384
+                              Decorate 91($Global) Block
+                              Decorate 93 DescriptorSet 0
+                              Decorate 134(ps_output.color) Location 0
+                              Decorate 137(g_tex_explicit[0]) DescriptorSet 0
+                              Decorate 137(g_tex_explicit[0]) Binding 1
+                              Decorate 138(g_tex_explicit[1]) DescriptorSet 0
+                              Decorate 138(g_tex_explicit[1]) Binding 2
+                              Decorate 139(g_tex_explicit[2]) DescriptorSet 0
+                              Decorate 139(g_tex_explicit[2]) Binding 3
+                              Decorate 140(g_samp_explicit[0]) DescriptorSet 0
+                              Decorate 140(g_samp_explicit[0]) Binding 5
+                              Decorate 141(g_samp_explicit[1]) DescriptorSet 0
+                              Decorate 141(g_samp_explicit[1]) Binding 6
+                              Decorate 142(g_samp_explicit[2]) DescriptorSet 0
+                              Decorate 142(g_samp_explicit[2]) Binding 7
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -429,10 +432,10 @@
               12:             TypeInt 32 0
               13:     12(int) Constant 3
               14:             TypeArray 11 13
-              15:             TypePointer UniformConstant 14
+              15:             TypePointer Function 14
               16:             TypeSampler
               17:             TypeArray 16 13
-              18:             TypePointer UniformConstant 17
+              18:             TypePointer Function 17
               19:             TypeFunction 7(fvec4) 15(ptr) 18(ptr)
    24(PS_OUTPUT):             TypeStruct 7(fvec4)
               25:             TypePointer Function 24(PS_OUTPUT)
@@ -454,48 +457,46 @@
    45(g_samp[1]):     44(ptr) Variable UniformConstant
               47:             TypeSampledImage 11
               49:    6(float) Constant 1045220557
-61(local_sampler_array):     18(ptr) Variable UniformConstant
-              62:     30(int) Constant 0
-   63(g_samp[0]):     44(ptr) Variable UniformConstant
-   68(g_samp[2]):     44(ptr) Variable UniformConstant
-71(local_texture_array):     15(ptr) Variable UniformConstant
-    72(g_tex[0]):     41(ptr) Variable UniformConstant
-    77(g_tex[2]):     41(ptr) Variable UniformConstant
-              80:     12(int) Constant 4
-              81:             TypeArray 6(float) 80
-              82:             TypePointer Function 81
-              84:             TypeVector 6(float) 3
-              85:             TypeMatrix 84(fvec3) 3
-              86:             TypeArray 85 80
-              87:             TypeArray 85 80
-              88:             TypeArray 6(float) 80
-     89($Global):             TypeStruct 86 87 88
-              90:             TypePointer Uniform 89($Global)
-              91:     90(ptr) Variable Uniform
-              92:             TypePointer Uniform 88
-              96:             TypePointer Function 6(float)
-  105(aggShadow):     15(ptr) Variable UniformConstant
-  112(aggShadow):     18(ptr) Variable UniformConstant
-             121:             TypePointer Function 7(fvec4)
-             127:             TypePointer Output 7(fvec4)
-128(ps_output.color):    127(ptr) Variable Output
-131(g_tex_explicit[0]):     41(ptr) Variable UniformConstant
-132(g_tex_explicit[1]):     41(ptr) Variable UniformConstant
-133(g_tex_explicit[2]):     41(ptr) Variable UniformConstant
-134(g_samp_explicit[0]):     44(ptr) Variable UniformConstant
-135(g_samp_explicit[1]):     44(ptr) Variable UniformConstant
-136(g_samp_explicit[2]):     44(ptr) Variable UniformConstant
+              53:             TypePointer Function 11
+              56:             TypePointer Function 16
+              64:     30(int) Constant 0
+   65(g_samp[0]):     44(ptr) Variable UniformConstant
+   70(g_samp[2]):     44(ptr) Variable UniformConstant
+    74(g_tex[0]):     41(ptr) Variable UniformConstant
+    79(g_tex[2]):     41(ptr) Variable UniformConstant
+              82:     12(int) Constant 4
+              83:             TypeArray 6(float) 82
+              84:             TypePointer Function 83
+              86:             TypeVector 6(float) 3
+              87:             TypeMatrix 86(fvec3) 3
+              88:             TypeArray 87 82
+              89:             TypeArray 87 82
+              90:             TypeArray 6(float) 82
+     91($Global):             TypeStruct 88 89 90
+              92:             TypePointer Uniform 91($Global)
+              93:     92(ptr) Variable Uniform
+              94:             TypePointer Uniform 90
+              98:             TypePointer Function 6(float)
+             127:             TypePointer Function 7(fvec4)
+             133:             TypePointer Output 7(fvec4)
+134(ps_output.color):    133(ptr) Variable Output
+137(g_tex_explicit[0]):     41(ptr) Variable UniformConstant
+138(g_tex_explicit[1]):     41(ptr) Variable UniformConstant
+139(g_tex_explicit[2]):     41(ptr) Variable UniformConstant
+140(g_samp_explicit[0]):     44(ptr) Variable UniformConstant
+141(g_samp_explicit[1]):     44(ptr) Variable UniformConstant
+142(g_samp_explicit[2]):     44(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
-  123(ps_output):     25(ptr) Variable Function
-      124(param):     25(ptr) Variable Function
+  129(ps_output):     25(ptr) Variable Function
+      130(param):     25(ptr) Variable Function
                               Store 34(not_flattened_a) 40
-             125:           2 FunctionCall 28(@main(struct-PS_OUTPUT-vf41;) 124(param)
-             126:24(PS_OUTPUT) Load 124(param)
-                              Store 123(ps_output) 126
-             129:    121(ptr) AccessChain 123(ps_output) 62
-             130:    7(fvec4) Load 129
-                              Store 128(ps_output.color) 130
+             131:           2 FunctionCall 28(@main(struct-PS_OUTPUT-vf41;) 130(param)
+             132:24(PS_OUTPUT) Load 130(param)
+                              Store 129(ps_output) 132
+             135:    127(ptr) AccessChain 129(ps_output) 64
+             136:    7(fvec4) Load 135
+                              Store 134(ps_output.color) 136
                               Return
                               FunctionEnd
      9(TestFn1():    7(fvec4) Function None 8
@@ -510,72 +511,82 @@
        20(l_tex):     15(ptr) FunctionParameter
       21(l_samp):     18(ptr) FunctionParameter
               23:             Label
-              53:     41(ptr) AccessChain 20(l_tex) 36
-              54:          11 Load 53
-              55:     44(ptr) AccessChain 21(l_samp) 36
-              56:          16 Load 55
-              57:          47 SampledImage 54 56
-              58:    7(fvec4) ImageSampleImplicitLod 57 49
-                              ReturnValue 58
+              54:     53(ptr) AccessChain 20(l_tex) 36
+              55:          11 Load 54
+              57:     56(ptr) AccessChain 21(l_samp) 36
+              58:          16 Load 57
+              59:          47 SampledImage 55 58
+              60:    7(fvec4) ImageSampleImplicitLod 59 49
+                              ReturnValue 60
                               FunctionEnd
 28(@main(struct-PS_OUTPUT-vf41;):           2 Function None 26
    27(ps_output):     25(ptr) FunctionParameter
               29:             Label
-83(local_float_array):     82(ptr) Variable Function
-              64:          16 Load 63(g_samp[0])
-              65:     44(ptr) AccessChain 61(local_sampler_array) 62
-                              Store 65 64
-              66:          16 Load 45(g_samp[1])
-              67:     44(ptr) AccessChain 61(local_sampler_array) 35
+63(local_sampler_array):     18(ptr) Variable Function
+73(local_texture_array):     15(ptr) Variable Function
+85(local_float_array):     84(ptr) Variable Function
+  107(aggShadow):     15(ptr) Variable Function
+  114(aggShadow):     18(ptr) Variable Function
+      121(param):     15(ptr) Variable Function
+      123(param):     18(ptr) Variable Function
+              66:          16 Load 65(g_samp[0])
+              67:     56(ptr) AccessChain 63(local_sampler_array) 64
                               Store 67 66
-              69:          16 Load 68(g_samp[2])
-              70:     44(ptr) AccessChain 61(local_sampler_array) 36
-                              Store 70 69
-              73:          11 Load 72(g_tex[0])
-              74:     41(ptr) AccessChain 71(local_texture_array) 62
-                              Store 74 73
-              75:          11 Load 42(g_tex[1])
-              76:     41(ptr) AccessChain 71(local_texture_array) 35
+              68:          16 Load 45(g_samp[1])
+              69:     56(ptr) AccessChain 63(local_sampler_array) 35
+                              Store 69 68
+              71:          16 Load 70(g_samp[2])
+              72:     56(ptr) AccessChain 63(local_sampler_array) 36
+                              Store 72 71
+              75:          11 Load 74(g_tex[0])
+              76:     53(ptr) AccessChain 73(local_texture_array) 64
                               Store 76 75
-              78:          11 Load 77(g_tex[2])
-              79:     41(ptr) AccessChain 71(local_texture_array) 36
-                              Store 79 78
-              93:     92(ptr) AccessChain 91 36
-              94:          88 Load 93
-              95:    6(float) CompositeExtract 94 0
-              97:     96(ptr) AccessChain 83(local_float_array) 62
-                              Store 97 95
-              98:    6(float) CompositeExtract 94 1
-              99:     96(ptr) AccessChain 83(local_float_array) 35
-                              Store 99 98
-             100:    6(float) CompositeExtract 94 2
-             101:     96(ptr) AccessChain 83(local_float_array) 36
+              77:          11 Load 42(g_tex[1])
+              78:     53(ptr) AccessChain 73(local_texture_array) 35
+                              Store 78 77
+              80:          11 Load 79(g_tex[2])
+              81:     53(ptr) AccessChain 73(local_texture_array) 36
+                              Store 81 80
+              95:     94(ptr) AccessChain 93 36
+              96:          90 Load 95
+              97:    6(float) CompositeExtract 96 0
+              99:     98(ptr) AccessChain 85(local_float_array) 64
+                              Store 99 97
+             100:    6(float) CompositeExtract 96 1
+             101:     98(ptr) AccessChain 85(local_float_array) 35
                               Store 101 100
-             102:    6(float) CompositeExtract 94 3
-             103:     96(ptr) AccessChain 83(local_float_array) 37
+             102:    6(float) CompositeExtract 96 2
+             103:     98(ptr) AccessChain 85(local_float_array) 36
                               Store 103 102
-             104:    7(fvec4) FunctionCall 9(TestFn1()
-             106:          11 Load 72(g_tex[0])
-             107:     41(ptr) AccessChain 105(aggShadow) 62
-                              Store 107 106
-             108:          11 Load 42(g_tex[1])
-             109:     41(ptr) AccessChain 105(aggShadow) 35
+             104:    6(float) CompositeExtract 96 3
+             105:     98(ptr) AccessChain 85(local_float_array) 37
+                              Store 105 104
+             106:    7(fvec4) FunctionCall 9(TestFn1()
+             108:          11 Load 74(g_tex[0])
+             109:     53(ptr) AccessChain 107(aggShadow) 64
                               Store 109 108
-             110:          11 Load 77(g_tex[2])
-             111:     41(ptr) AccessChain 105(aggShadow) 36
+             110:          11 Load 42(g_tex[1])
+             111:     53(ptr) AccessChain 107(aggShadow) 35
                               Store 111 110
-             113:          16 Load 63(g_samp[0])
-             114:     44(ptr) AccessChain 112(aggShadow) 62
-                              Store 114 113
-             115:          16 Load 45(g_samp[1])
-             116:     44(ptr) AccessChain 112(aggShadow) 35
+             112:          11 Load 79(g_tex[2])
+             113:     53(ptr) AccessChain 107(aggShadow) 36
+                              Store 113 112
+             115:          16 Load 65(g_samp[0])
+             116:     56(ptr) AccessChain 114(aggShadow) 64
                               Store 116 115
-             117:          16 Load 68(g_samp[2])
-             118:     44(ptr) AccessChain 112(aggShadow) 36
+             117:          16 Load 45(g_samp[1])
+             118:     56(ptr) AccessChain 114(aggShadow) 35
                               Store 118 117
-             119:    7(fvec4) FunctionCall 22(TestFn2(t11[3];p1[3];) 105(aggShadow) 112(aggShadow)
-             120:    7(fvec4) FAdd 104 119
-             122:    121(ptr) AccessChain 27(ps_output) 62
-                              Store 122 120
+             119:          16 Load 70(g_samp[2])
+             120:     56(ptr) AccessChain 114(aggShadow) 36
+                              Store 120 119
+             122:          14 Load 107(aggShadow)
+                              Store 121(param) 122
+             124:          17 Load 114(aggShadow)
+                              Store 123(param) 124
+             125:    7(fvec4) FunctionCall 22(TestFn2(t11[3];p1[3];) 121(param) 123(param)
+             126:    7(fvec4) FAdd 106 125
+             128:    127(ptr) AccessChain 27(ps_output) 64
+                              Store 128 126
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.array.frag.out b/Test/baseResults/hlsl.array.frag.out
index c877cc8..dc48f6f 100755
--- a/Test/baseResults/hlsl.array.frag.out
+++ b/Test/baseResults/hlsl.array.frag.out
@@ -2,72 +2,142 @@
 Shader version: 500
 gl_FragCoord origin is upper left
 0:? Sequence
-0:8  Function Definition: @PixelShaderFunction(i1;vf4[3]; ( temp 4-component vector of float)
-0:8    Function Parameters: 
-0:8      'i' ( in int)
-0:8      'input' ( in 3-element array of 4-component vector of float)
+0:7  Sequence
+0:7    move second child to first child ( temp 4-component vector of float)
+0:7      'C' ( global 4-component vector of float)
+0:?       Constant:
+0:?         1.000000
+0:?         2.000000
+0:?         3.000000
+0:?         4.000000
+0:11  Sequence
+0:11    move second child to first child ( temp 2-element array of 4-component vector of float)
+0:11      'c2' ( global 2-element array of 4-component vector of float)
+0:11      Construct vec4 ( temp 2-element array of 4-component vector of float)
+0:11        'C' ( global 4-component vector of float)
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:?           3.000000
+0:?           4.000000
+0:14  Function Definition: @PixelShaderFunction(i1;vf4[3]; ( temp 4-component vector of float)
+0:14    Function Parameters: 
+0:14      'i' ( in int)
+0:14      'input' ( in 3-element array of 4-component vector of float)
 0:?     Sequence
-0:10      Branch: Return with expression
-0:10        add ( temp 4-component vector of float)
-0:10          add ( temp 4-component vector of float)
-0:10            add ( temp 4-component vector of float)
-0:10              add ( temp 4-component vector of float)
-0:10                add ( temp 4-component vector of float)
-0:10                  add ( temp 4-component vector of float)
-0:10                    direct index ( temp 4-component vector of float)
-0:10                      a: direct index for structure ( uniform 4-element array of 4-component vector of float)
-0:10                        'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s})
-0:10                        Constant:
-0:10                          0 (const uint)
-0:10                      Constant:
-0:10                        1 (const int)
-0:10                    indirect index ( temp 4-component vector of float)
-0:10                      a: direct index for structure ( uniform 4-element array of 4-component vector of float)
-0:10                        'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s})
-0:10                        Constant:
-0:10                          0 (const uint)
-0:10                      'i' ( in int)
-0:10                  direct index ( temp 4-component vector of float)
-0:10                    'input' ( in 3-element array of 4-component vector of float)
-0:10                    Constant:
-0:10                      2 (const int)
-0:10                indirect index ( temp 4-component vector of float)
-0:10                  'input' ( in 3-element array of 4-component vector of float)
-0:10                  'i' ( in int)
-0:10              direct index ( temp 4-component vector of float)
-0:10                'b' ( temp 10-element array of 4-component vector of float)
-0:10                Constant:
-0:10                  5 (const int)
-0:10            indirect index ( temp 4-component vector of float)
-0:10              'b' ( temp 10-element array of 4-component vector of float)
-0:10              'i' ( in int)
-0:10          indirect index ( temp 4-component vector of float)
-0:10            m: direct index for structure ( temp 7-element array of 4-component vector of float)
-0:10              indirect index ( temp structure{ temp 7-element array of 4-component vector of float m})
-0:10                s: direct index for structure ( uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m})
-0:10                  'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s})
-0:10                  Constant:
-0:10                    1 (const uint)
-0:10                'i' ( in int)
-0:10              Constant:
-0:10                0 (const int)
-0:10            'i' ( in int)
-0:8  Function Definition: PixelShaderFunction( ( temp void)
-0:8    Function Parameters: 
+0:15      Sequence
+0:15        move second child to first child ( temp 10-element array of 4-component vector of float)
+0:15          'b' ( temp 10-element array of 4-component vector of float)
+0:15          Construct vec4 ( temp 10-element array of 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:16      Sequence
+0:16        move second child to first child ( temp 4-component vector of float)
+0:16          'tmp' ( temp 4-component vector of float)
+0:16          add ( temp 4-component vector of float)
+0:16            add ( temp 4-component vector of float)
+0:16              add ( temp 4-component vector of float)
+0:16                add ( temp 4-component vector of float)
+0:16                  'C' ( global 4-component vector of float)
+0:16                  direct index ( temp 4-component vector of float)
+0:16                    a1: direct index for structure ( uniform 1-element array of 4-component vector of float)
+0:16                      'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:16                      Constant:
+0:16                        2 (const uint)
+0:16                    Constant:
+0:16                      0 (const int)
+0:16                Constant:
+0:16                  1.000000
+0:16                  2.000000
+0:16                  3.000000
+0:16                  4.000000
+0:16              indirect index ( temp 4-component vector of float)
+0:16                a2: direct index for structure ( uniform 2-element array of 4-component vector of float)
+0:16                  'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:16                  Constant:
+0:16                    3 (const uint)
+0:16                'i' ( in int)
+0:16            indirect index ( temp 4-component vector of float)
+0:16              'c2' ( global 2-element array of 4-component vector of float)
+0:16              'i' ( in int)
+0:17      Branch: Return with expression
+0:17        add ( temp 4-component vector of float)
+0:17          add ( temp 4-component vector of float)
+0:17            add ( temp 4-component vector of float)
+0:17              add ( temp 4-component vector of float)
+0:17                add ( temp 4-component vector of float)
+0:17                  add ( temp 4-component vector of float)
+0:17                    add ( temp 4-component vector of float)
+0:17                      direct index ( temp 4-component vector of float)
+0:17                        a: direct index for structure ( uniform 4-element array of 4-component vector of float)
+0:17                          'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:17                          Constant:
+0:17                            0 (const uint)
+0:17                        Constant:
+0:17                          1 (const int)
+0:17                      indirect index ( temp 4-component vector of float)
+0:17                        a: direct index for structure ( uniform 4-element array of 4-component vector of float)
+0:17                          'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:17                          Constant:
+0:17                            0 (const uint)
+0:17                        'i' ( in int)
+0:17                    direct index ( temp 4-component vector of float)
+0:17                      'input' ( in 3-element array of 4-component vector of float)
+0:17                      Constant:
+0:17                        2 (const int)
+0:17                  indirect index ( temp 4-component vector of float)
+0:17                    'input' ( in 3-element array of 4-component vector of float)
+0:17                    'i' ( in int)
+0:17                direct index ( temp 4-component vector of float)
+0:17                  'b' ( temp 10-element array of 4-component vector of float)
+0:17                  Constant:
+0:17                    5 (const int)
+0:17              indirect index ( temp 4-component vector of float)
+0:17                'b' ( temp 10-element array of 4-component vector of float)
+0:17                'i' ( in int)
+0:17            indirect index ( temp 4-component vector of float)
+0:17              m: direct index for structure ( temp 7-element array of 4-component vector of float)
+0:17                indirect index ( temp structure{ temp 7-element array of 4-component vector of float m})
+0:17                  s: direct index for structure ( uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m})
+0:17                    'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:17                    Constant:
+0:17                      1 (const uint)
+0:17                  'i' ( in int)
+0:17                Constant:
+0:17                  0 (const int)
+0:17              'i' ( in int)
+0:17          'tmp' ( temp 4-component vector of float)
+0:14  Function Definition: PixelShaderFunction( ( temp void)
+0:14    Function Parameters: 
 0:?     Sequence
-0:8      move second child to first child ( temp int)
+0:14      move second child to first child ( temp int)
 0:?         'i' ( temp int)
 0:?         'i' (layout( location=0) flat in int)
-0:8      move second child to first child ( temp 3-element array of 4-component vector of float)
+0:14      move second child to first child ( temp 3-element array of 4-component vector of float)
 0:?         'input' ( temp 3-element array of 4-component vector of float)
 0:?         'input' (layout( location=1) in 3-element array of 4-component vector of float)
-0:8      move second child to first child ( temp 4-component vector of float)
+0:14      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:8        Function Call: @PixelShaderFunction(i1;vf4[3]; ( temp 4-component vector of float)
+0:14        Function Call: @PixelShaderFunction(i1;vf4[3]; ( temp 4-component vector of float)
 0:?           'i' ( temp int)
 0:?           'input' ( temp 3-element array of 4-component vector of float)
 0:?   Linker Objects
-0:?     'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s})
+0:?     'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:?     'C' ( global 4-component vector of float)
+0:?     'c1' ( const 1-element array of 4-component vector of float)
+0:?       1.000000
+0:?       2.000000
+0:?       3.000000
+0:?       4.000000
+0:?     'c2' ( global 2-element array of 4-component vector of float)
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'i' (layout( location=0) flat in int)
 0:?     'input' (layout( location=1) in 3-element array of 4-component vector of float)
@@ -79,116 +149,195 @@
 Shader version: 500
 gl_FragCoord origin is upper left
 0:? Sequence
-0:8  Function Definition: @PixelShaderFunction(i1;vf4[3]; ( temp 4-component vector of float)
-0:8    Function Parameters: 
-0:8      'i' ( in int)
-0:8      'input' ( in 3-element array of 4-component vector of float)
+0:7  Sequence
+0:7    move second child to first child ( temp 4-component vector of float)
+0:7      'C' ( global 4-component vector of float)
+0:?       Constant:
+0:?         1.000000
+0:?         2.000000
+0:?         3.000000
+0:?         4.000000
+0:11  Sequence
+0:11    move second child to first child ( temp 2-element array of 4-component vector of float)
+0:11      'c2' ( global 2-element array of 4-component vector of float)
+0:11      Construct vec4 ( temp 2-element array of 4-component vector of float)
+0:11        'C' ( global 4-component vector of float)
+0:?         Constant:
+0:?           1.000000
+0:?           2.000000
+0:?           3.000000
+0:?           4.000000
+0:14  Function Definition: @PixelShaderFunction(i1;vf4[3]; ( temp 4-component vector of float)
+0:14    Function Parameters: 
+0:14      'i' ( in int)
+0:14      'input' ( in 3-element array of 4-component vector of float)
 0:?     Sequence
-0:10      Branch: Return with expression
-0:10        add ( temp 4-component vector of float)
-0:10          add ( temp 4-component vector of float)
-0:10            add ( temp 4-component vector of float)
-0:10              add ( temp 4-component vector of float)
-0:10                add ( temp 4-component vector of float)
-0:10                  add ( temp 4-component vector of float)
-0:10                    direct index ( temp 4-component vector of float)
-0:10                      a: direct index for structure ( uniform 4-element array of 4-component vector of float)
-0:10                        'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s})
-0:10                        Constant:
-0:10                          0 (const uint)
-0:10                      Constant:
-0:10                        1 (const int)
-0:10                    indirect index ( temp 4-component vector of float)
-0:10                      a: direct index for structure ( uniform 4-element array of 4-component vector of float)
-0:10                        'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s})
-0:10                        Constant:
-0:10                          0 (const uint)
-0:10                      'i' ( in int)
-0:10                  direct index ( temp 4-component vector of float)
-0:10                    'input' ( in 3-element array of 4-component vector of float)
-0:10                    Constant:
-0:10                      2 (const int)
-0:10                indirect index ( temp 4-component vector of float)
-0:10                  'input' ( in 3-element array of 4-component vector of float)
-0:10                  'i' ( in int)
-0:10              direct index ( temp 4-component vector of float)
-0:10                'b' ( temp 10-element array of 4-component vector of float)
-0:10                Constant:
-0:10                  5 (const int)
-0:10            indirect index ( temp 4-component vector of float)
-0:10              'b' ( temp 10-element array of 4-component vector of float)
-0:10              'i' ( in int)
-0:10          indirect index ( temp 4-component vector of float)
-0:10            m: direct index for structure ( temp 7-element array of 4-component vector of float)
-0:10              indirect index ( temp structure{ temp 7-element array of 4-component vector of float m})
-0:10                s: direct index for structure ( uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m})
-0:10                  'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s})
-0:10                  Constant:
-0:10                    1 (const uint)
-0:10                'i' ( in int)
-0:10              Constant:
-0:10                0 (const int)
-0:10            'i' ( in int)
-0:8  Function Definition: PixelShaderFunction( ( temp void)
-0:8    Function Parameters: 
+0:15      Sequence
+0:15        move second child to first child ( temp 10-element array of 4-component vector of float)
+0:15          'b' ( temp 10-element array of 4-component vector of float)
+0:15          Construct vec4 ( temp 10-element array of 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:15            'C' ( global 4-component vector of float)
+0:16      Sequence
+0:16        move second child to first child ( temp 4-component vector of float)
+0:16          'tmp' ( temp 4-component vector of float)
+0:16          add ( temp 4-component vector of float)
+0:16            add ( temp 4-component vector of float)
+0:16              add ( temp 4-component vector of float)
+0:16                add ( temp 4-component vector of float)
+0:16                  'C' ( global 4-component vector of float)
+0:16                  direct index ( temp 4-component vector of float)
+0:16                    a1: direct index for structure ( uniform 1-element array of 4-component vector of float)
+0:16                      'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:16                      Constant:
+0:16                        2 (const uint)
+0:16                    Constant:
+0:16                      0 (const int)
+0:16                Constant:
+0:16                  1.000000
+0:16                  2.000000
+0:16                  3.000000
+0:16                  4.000000
+0:16              indirect index ( temp 4-component vector of float)
+0:16                a2: direct index for structure ( uniform 2-element array of 4-component vector of float)
+0:16                  'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:16                  Constant:
+0:16                    3 (const uint)
+0:16                'i' ( in int)
+0:16            indirect index ( temp 4-component vector of float)
+0:16              'c2' ( global 2-element array of 4-component vector of float)
+0:16              'i' ( in int)
+0:17      Branch: Return with expression
+0:17        add ( temp 4-component vector of float)
+0:17          add ( temp 4-component vector of float)
+0:17            add ( temp 4-component vector of float)
+0:17              add ( temp 4-component vector of float)
+0:17                add ( temp 4-component vector of float)
+0:17                  add ( temp 4-component vector of float)
+0:17                    add ( temp 4-component vector of float)
+0:17                      direct index ( temp 4-component vector of float)
+0:17                        a: direct index for structure ( uniform 4-element array of 4-component vector of float)
+0:17                          'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:17                          Constant:
+0:17                            0 (const uint)
+0:17                        Constant:
+0:17                          1 (const int)
+0:17                      indirect index ( temp 4-component vector of float)
+0:17                        a: direct index for structure ( uniform 4-element array of 4-component vector of float)
+0:17                          'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:17                          Constant:
+0:17                            0 (const uint)
+0:17                        'i' ( in int)
+0:17                    direct index ( temp 4-component vector of float)
+0:17                      'input' ( in 3-element array of 4-component vector of float)
+0:17                      Constant:
+0:17                        2 (const int)
+0:17                  indirect index ( temp 4-component vector of float)
+0:17                    'input' ( in 3-element array of 4-component vector of float)
+0:17                    'i' ( in int)
+0:17                direct index ( temp 4-component vector of float)
+0:17                  'b' ( temp 10-element array of 4-component vector of float)
+0:17                  Constant:
+0:17                    5 (const int)
+0:17              indirect index ( temp 4-component vector of float)
+0:17                'b' ( temp 10-element array of 4-component vector of float)
+0:17                'i' ( in int)
+0:17            indirect index ( temp 4-component vector of float)
+0:17              m: direct index for structure ( temp 7-element array of 4-component vector of float)
+0:17                indirect index ( temp structure{ temp 7-element array of 4-component vector of float m})
+0:17                  s: direct index for structure ( uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m})
+0:17                    'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:17                    Constant:
+0:17                      1 (const uint)
+0:17                  'i' ( in int)
+0:17                Constant:
+0:17                  0 (const int)
+0:17              'i' ( in int)
+0:17          'tmp' ( temp 4-component vector of float)
+0:14  Function Definition: PixelShaderFunction( ( temp void)
+0:14    Function Parameters: 
 0:?     Sequence
-0:8      move second child to first child ( temp int)
+0:14      move second child to first child ( temp int)
 0:?         'i' ( temp int)
 0:?         'i' (layout( location=0) flat in int)
-0:8      move second child to first child ( temp 3-element array of 4-component vector of float)
+0:14      move second child to first child ( temp 3-element array of 4-component vector of float)
 0:?         'input' ( temp 3-element array of 4-component vector of float)
 0:?         'input' (layout( location=1) in 3-element array of 4-component vector of float)
-0:8      move second child to first child ( temp 4-component vector of float)
+0:14      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:8        Function Call: @PixelShaderFunction(i1;vf4[3]; ( temp 4-component vector of float)
+0:14        Function Call: @PixelShaderFunction(i1;vf4[3]; ( temp 4-component vector of float)
 0:?           'i' ( temp int)
 0:?           'input' ( temp 3-element array of 4-component vector of float)
 0:?   Linker Objects
-0:?     'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s})
+0:?     'anon@0' (layout( row_major std140) uniform block{ uniform 4-element array of 4-component vector of float a,  uniform 11-element array of structure{ temp 7-element array of 4-component vector of float m} s,  uniform 1-element array of 4-component vector of float a1,  uniform 2-element array of 4-component vector of float a2})
+0:?     'C' ( global 4-component vector of float)
+0:?     'c1' ( const 1-element array of 4-component vector of float)
+0:?       1.000000
+0:?       2.000000
+0:?       3.000000
+0:?       4.000000
+0:?     'c2' ( global 2-element array of 4-component vector of float)
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'i' (layout( location=0) flat in int)
 0:?     'input' (layout( location=1) in 3-element array of 4-component vector of float)
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 81
+// Id's are bound by 126
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "PixelShaderFunction" 68 72 75
+                              EntryPoint Fragment 4  "PixelShaderFunction" 112 116 119
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "PixelShaderFunction"
                               Name 17  "@PixelShaderFunction(i1;vf4[3];"
                               Name 15  "i"
                               Name 16  "input"
-                              Name 23  ""
-                              MemberName 23 0  "m"
-                              Name 26  "$Global"
-                              MemberName 26($Global) 0  "a"
-                              MemberName 26($Global) 1  "s"
-                              Name 28  ""
-                              Name 50  "b"
-                              Name 66  "i"
-                              Name 68  "i"
-                              Name 70  "input"
-                              Name 72  "input"
-                              Name 75  "@entryPointOutput"
-                              Name 76  "param"
-                              Name 78  "param"
-                              Decorate 20 ArrayStride 16
-                              Decorate 22 ArrayStride 16
-                              MemberDecorate 23 0 Offset 0
-                              Decorate 25 ArrayStride 112
-                              MemberDecorate 26($Global) 0 Offset 0
-                              MemberDecorate 26($Global) 1 Offset 64
-                              Decorate 26($Global) Block
-                              Decorate 28 DescriptorSet 0
-                              Decorate 68(i) Flat
-                              Decorate 68(i) Location 0
-                              Decorate 72(input) Location 1
-                              Decorate 75(@entryPointOutput) Location 0
+                              Name 20  "C"
+                              Name 29  "c2"
+                              Name 35  "b"
+                              Name 48  "tmp"
+                              Name 54  ""
+                              MemberName 54 0  "m"
+                              Name 60  "$Global"
+                              MemberName 60($Global) 0  "a"
+                              MemberName 60($Global) 1  "s"
+                              MemberName 60($Global) 2  "a1"
+                              MemberName 60($Global) 3  "a2"
+                              Name 62  ""
+                              Name 110  "i"
+                              Name 112  "i"
+                              Name 114  "input"
+                              Name 116  "input"
+                              Name 119  "@entryPointOutput"
+                              Name 120  "param"
+                              Name 122  "param"
+                              Decorate 51 ArrayStride 16
+                              Decorate 53 ArrayStride 16
+                              MemberDecorate 54 0 Offset 0
+                              Decorate 56 ArrayStride 112
+                              Decorate 58 ArrayStride 16
+                              Decorate 59 ArrayStride 16
+                              MemberDecorate 60($Global) 0 Offset 0
+                              MemberDecorate 60($Global) 1 Offset 64
+                              MemberDecorate 60($Global) 2 Offset 1296
+                              MemberDecorate 60($Global) 3 Offset 1312
+                              Decorate 60($Global) Block
+                              Decorate 62 DescriptorSet 0
+                              Decorate 112(i) Flat
+                              Decorate 112(i) Location 0
+                              Decorate 116(input) Location 1
+                              Decorate 119(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
@@ -200,78 +349,127 @@
               12:             TypeArray 9(fvec4) 11
               13:             TypePointer Function 12
               14:             TypeFunction 9(fvec4) 7(ptr) 13(ptr)
-              19:     10(int) Constant 4
-              20:             TypeArray 9(fvec4) 19
-              21:     10(int) Constant 7
-              22:             TypeArray 9(fvec4) 21
-              23:             TypeStruct 22
-              24:     10(int) Constant 11
-              25:             TypeArray 23(struct) 24
-     26($Global):             TypeStruct 20 25
-              27:             TypePointer Uniform 26($Global)
-              28:     27(ptr) Variable Uniform
-              29:      6(int) Constant 0
-              30:      6(int) Constant 1
-              31:             TypePointer Uniform 9(fvec4)
-              38:      6(int) Constant 2
-              39:             TypePointer Function 9(fvec4)
-              47:     10(int) Constant 10
-              48:             TypeArray 9(fvec4) 47
-              49:             TypePointer Function 48
-              51:      6(int) Constant 5
-              67:             TypePointer Input 6(int)
-           68(i):     67(ptr) Variable Input
-              71:             TypePointer Input 12
-       72(input):     71(ptr) Variable Input
-              74:             TypePointer Output 9(fvec4)
-75(@entryPointOutput):     74(ptr) Variable Output
+              19:             TypePointer Private 9(fvec4)
+           20(C):     19(ptr) Variable Private
+              21:    8(float) Constant 1065353216
+              22:    8(float) Constant 1073741824
+              23:    8(float) Constant 1077936128
+              24:    8(float) Constant 1082130432
+              25:    9(fvec4) ConstantComposite 21 22 23 24
+              26:     10(int) Constant 2
+              27:             TypeArray 9(fvec4) 26
+              28:             TypePointer Private 27
+          29(c2):     28(ptr) Variable Private
+              32:     10(int) Constant 10
+              33:             TypeArray 9(fvec4) 32
+              34:             TypePointer Function 33
+              47:             TypePointer Function 9(fvec4)
+              50:     10(int) Constant 4
+              51:             TypeArray 9(fvec4) 50
+              52:     10(int) Constant 7
+              53:             TypeArray 9(fvec4) 52
+              54:             TypeStruct 53
+              55:     10(int) Constant 11
+              56:             TypeArray 54(struct) 55
+              57:     10(int) Constant 1
+              58:             TypeArray 9(fvec4) 57
+              59:             TypeArray 9(fvec4) 26
+     60($Global):             TypeStruct 51 56 58 59
+              61:             TypePointer Uniform 60($Global)
+              62:     61(ptr) Variable Uniform
+              63:      6(int) Constant 2
+              64:      6(int) Constant 0
+              65:             TypePointer Uniform 9(fvec4)
+              70:      6(int) Constant 3
+              79:      6(int) Constant 1
+              93:      6(int) Constant 5
+             111:             TypePointer Input 6(int)
+          112(i):    111(ptr) Variable Input
+             115:             TypePointer Input 12
+      116(input):    115(ptr) Variable Input
+             118:             TypePointer Output 9(fvec4)
+119(@entryPointOutput):    118(ptr) Variable Output
+             125:          58 ConstantComposite 25
 4(PixelShaderFunction):           2 Function None 3
                5:             Label
-           66(i):      7(ptr) Variable Function
-       70(input):     13(ptr) Variable Function
-       76(param):      7(ptr) Variable Function
-       78(param):     13(ptr) Variable Function
-              69:      6(int) Load 68(i)
-                              Store 66(i) 69
-              73:          12 Load 72(input)
-                              Store 70(input) 73
-              77:      6(int) Load 66(i)
-                              Store 76(param) 77
-              79:          12 Load 70(input)
-                              Store 78(param) 79
-              80:    9(fvec4) FunctionCall 17(@PixelShaderFunction(i1;vf4[3];) 76(param) 78(param)
-                              Store 75(@entryPointOutput) 80
+          110(i):      7(ptr) Variable Function
+      114(input):     13(ptr) Variable Function
+      120(param):      7(ptr) Variable Function
+      122(param):     13(ptr) Variable Function
+                              Store 20(C) 25
+              30:    9(fvec4) Load 20(C)
+              31:          27 CompositeConstruct 30 25
+                              Store 29(c2) 31
+             113:      6(int) Load 112(i)
+                              Store 110(i) 113
+             117:          12 Load 116(input)
+                              Store 114(input) 117
+             121:      6(int) Load 110(i)
+                              Store 120(param) 121
+             123:          12 Load 114(input)
+                              Store 122(param) 123
+             124:    9(fvec4) FunctionCall 17(@PixelShaderFunction(i1;vf4[3];) 120(param) 122(param)
+                              Store 119(@entryPointOutput) 124
                               Return
                               FunctionEnd
 17(@PixelShaderFunction(i1;vf4[3];):    9(fvec4) Function None 14
            15(i):      7(ptr) FunctionParameter
        16(input):     13(ptr) FunctionParameter
               18:             Label
-           50(b):     49(ptr) Variable Function
-              32:     31(ptr) AccessChain 28 29 30
-              33:    9(fvec4) Load 32
-              34:      6(int) Load 15(i)
-              35:     31(ptr) AccessChain 28 29 34
-              36:    9(fvec4) Load 35
-              37:    9(fvec4) FAdd 33 36
-              40:     39(ptr) AccessChain 16(input) 38
-              41:    9(fvec4) Load 40
-              42:    9(fvec4) FAdd 37 41
-              43:      6(int) Load 15(i)
-              44:     39(ptr) AccessChain 16(input) 43
-              45:    9(fvec4) Load 44
-              46:    9(fvec4) FAdd 42 45
-              52:     39(ptr) AccessChain 50(b) 51
-              53:    9(fvec4) Load 52
-              54:    9(fvec4) FAdd 46 53
-              55:      6(int) Load 15(i)
-              56:     39(ptr) AccessChain 50(b) 55
-              57:    9(fvec4) Load 56
-              58:    9(fvec4) FAdd 54 57
-              59:      6(int) Load 15(i)
-              60:      6(int) Load 15(i)
-              61:     31(ptr) AccessChain 28 30 59 29 60
-              62:    9(fvec4) Load 61
-              63:    9(fvec4) FAdd 58 62
-                              ReturnValue 63
+           35(b):     34(ptr) Variable Function
+         48(tmp):     47(ptr) Variable Function
+              36:    9(fvec4) Load 20(C)
+              37:    9(fvec4) Load 20(C)
+              38:    9(fvec4) Load 20(C)
+              39:    9(fvec4) Load 20(C)
+              40:    9(fvec4) Load 20(C)
+              41:    9(fvec4) Load 20(C)
+              42:    9(fvec4) Load 20(C)
+              43:    9(fvec4) Load 20(C)
+              44:    9(fvec4) Load 20(C)
+              45:    9(fvec4) Load 20(C)
+              46:          33 CompositeConstruct 36 37 38 39 40 41 42 43 44 45
+                              Store 35(b) 46
+              49:    9(fvec4) Load 20(C)
+              66:     65(ptr) AccessChain 62 63 64
+              67:    9(fvec4) Load 66
+              68:    9(fvec4) FAdd 49 67
+              69:    9(fvec4) FAdd 68 25
+              71:      6(int) Load 15(i)
+              72:     65(ptr) AccessChain 62 70 71
+              73:    9(fvec4) Load 72
+              74:    9(fvec4) FAdd 69 73
+              75:      6(int) Load 15(i)
+              76:     19(ptr) AccessChain 29(c2) 75
+              77:    9(fvec4) Load 76
+              78:    9(fvec4) FAdd 74 77
+                              Store 48(tmp) 78
+              80:     65(ptr) AccessChain 62 64 79
+              81:    9(fvec4) Load 80
+              82:      6(int) Load 15(i)
+              83:     65(ptr) AccessChain 62 64 82
+              84:    9(fvec4) Load 83
+              85:    9(fvec4) FAdd 81 84
+              86:     47(ptr) AccessChain 16(input) 63
+              87:    9(fvec4) Load 86
+              88:    9(fvec4) FAdd 85 87
+              89:      6(int) Load 15(i)
+              90:     47(ptr) AccessChain 16(input) 89
+              91:    9(fvec4) Load 90
+              92:    9(fvec4) FAdd 88 91
+              94:     47(ptr) AccessChain 35(b) 93
+              95:    9(fvec4) Load 94
+              96:    9(fvec4) FAdd 92 95
+              97:      6(int) Load 15(i)
+              98:     47(ptr) AccessChain 35(b) 97
+              99:    9(fvec4) Load 98
+             100:    9(fvec4) FAdd 96 99
+             101:      6(int) Load 15(i)
+             102:      6(int) Load 15(i)
+             103:     65(ptr) AccessChain 62 79 101 64 102
+             104:    9(fvec4) Load 103
+             105:    9(fvec4) FAdd 100 104
+             106:    9(fvec4) Load 48(tmp)
+             107:    9(fvec4) FAdd 105 106
+                              ReturnValue 107
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.attributeC11.frag.out b/Test/baseResults/hlsl.attributeC11.frag.out
new file mode 100755
index 0000000..02b0ede
--- /dev/null
+++ b/Test/baseResults/hlsl.attributeC11.frag.out
@@ -0,0 +1,176 @@
+hlsl.attributeC11.frag
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:16  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:16    Function Parameters: 
+0:16      'input' ( in 4-component vector of float)
+0:?     Sequence
+0:17      Branch: Return with expression
+0:17        add ( temp 4-component vector of float)
+0:17          'input' ( in 4-component vector of float)
+0:17          textureFetch ( temp 4-component vector of float)
+0:17            'attach' ( uniform texture2D)
+0:17            vector swizzle ( temp int)
+0:17              Constant:
+0:17                0 (const int)
+0:17                0 (const int)
+0:17              Sequence
+0:17                Constant:
+0:17                  0 (const int)
+0:17            direct index ( temp int)
+0:17              Constant:
+0:17                0 (const int)
+0:17                0 (const int)
+0:17              Constant:
+0:17                1 (const int)
+0:16  Function Definition: main( ( temp void)
+0:16    Function Parameters: 
+0:?     Sequence
+0:16      move second child to first child ( temp 4-component vector of float)
+0:?         'input' ( temp 4-component vector of float)
+0:?         'input' (layout( location=8) in 4-component vector of float)
+0:16      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=7) out 4-component vector of float)
+0:16        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'input' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'buffer1' (layout( set=0 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data})
+0:?     'buffer3' (layout( set=2 binding=3 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data})
+0:?     'attach' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=7) out 4-component vector of float)
+0:?     'input' (layout( location=8) in 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:16  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:16    Function Parameters: 
+0:16      'input' ( in 4-component vector of float)
+0:?     Sequence
+0:17      Branch: Return with expression
+0:17        add ( temp 4-component vector of float)
+0:17          'input' ( in 4-component vector of float)
+0:17          textureFetch ( temp 4-component vector of float)
+0:17            'attach' ( uniform texture2D)
+0:17            vector swizzle ( temp int)
+0:17              Constant:
+0:17                0 (const int)
+0:17                0 (const int)
+0:17              Sequence
+0:17                Constant:
+0:17                  0 (const int)
+0:17            direct index ( temp int)
+0:17              Constant:
+0:17                0 (const int)
+0:17                0 (const int)
+0:17              Constant:
+0:17                1 (const int)
+0:16  Function Definition: main( ( temp void)
+0:16    Function Parameters: 
+0:?     Sequence
+0:16      move second child to first child ( temp 4-component vector of float)
+0:?         'input' ( temp 4-component vector of float)
+0:?         'input' (layout( location=8) in 4-component vector of float)
+0:16      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=7) out 4-component vector of float)
+0:16        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'input' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'buffer1' (layout( set=0 binding=1 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data})
+0:?     'buffer3' (layout( set=2 binding=3 row_major std430) readonly buffer block{layout( row_major std430) buffer implicitly-sized array of structure{ temp 2-component vector of float f} @data})
+0:?     'attach' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=7) out 4-component vector of float)
+0:?     'input' (layout( location=8) in 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 47
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 33 36
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 11  "@main(vf4;"
+                              Name 10  "input"
+                              Name 16  "attach"
+                              Name 31  "input"
+                              Name 33  "input"
+                              Name 36  "@entryPointOutput"
+                              Name 37  "param"
+                              Name 41  "S"
+                              MemberName 41(S) 0  "f"
+                              Name 43  "buffer1"
+                              MemberName 43(buffer1) 0  "@data"
+                              Name 45  "buffer1"
+                              Name 46  "buffer3"
+                              Decorate 16(attach) DescriptorSet 0
+                              Decorate 16(attach) InputAttachmentIndex 4
+                              Decorate 33(input) Location 8
+                              Decorate 36(@entryPointOutput) Location 7
+                              MemberDecorate 41(S) 0 Offset 0
+                              Decorate 42 ArrayStride 8
+                              MemberDecorate 43(buffer1) 0 NonWritable
+                              MemberDecorate 43(buffer1) 0 Offset 0
+                              Decorate 43(buffer1) BufferBlock
+                              Decorate 45(buffer1) DescriptorSet 0
+                              Decorate 45(buffer1) Binding 1
+                              Decorate 46(buffer3) DescriptorSet 2
+                              Decorate 46(buffer3) Binding 3
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypePointer Function 7(fvec4)
+               9:             TypeFunction 7(fvec4) 8(ptr)
+              14:             TypeImage 6(float) 2D sampled format:Unknown
+              15:             TypePointer UniformConstant 14
+      16(attach):     15(ptr) Variable UniformConstant
+              18:             TypeInt 32 1
+              19:             TypeVector 18(int) 2
+              20:     18(int) Constant 0
+              21:   19(ivec2) ConstantComposite 20 20
+              22:             TypeInt 32 0
+              23:     22(int) Constant 0
+              25:     22(int) Constant 1
+              32:             TypePointer Input 7(fvec4)
+       33(input):     32(ptr) Variable Input
+              35:             TypePointer Output 7(fvec4)
+36(@entryPointOutput):     35(ptr) Variable Output
+              40:             TypeVector 6(float) 2
+           41(S):             TypeStruct 40(fvec2)
+              42:             TypeRuntimeArray 41(S)
+     43(buffer1):             TypeStruct 42
+              44:             TypePointer Uniform 43(buffer1)
+     45(buffer1):     44(ptr) Variable Uniform
+     46(buffer3):     44(ptr) Variable Uniform
+         4(main):           2 Function None 3
+               5:             Label
+       31(input):      8(ptr) Variable Function
+       37(param):      8(ptr) Variable Function
+              34:    7(fvec4) Load 33(input)
+                              Store 31(input) 34
+              38:    7(fvec4) Load 31(input)
+                              Store 37(param) 38
+              39:    7(fvec4) FunctionCall 11(@main(vf4;) 37(param)
+                              Store 36(@entryPointOutput) 39
+                              Return
+                              FunctionEnd
+  11(@main(vf4;):    7(fvec4) Function None 9
+       10(input):      8(ptr) FunctionParameter
+              12:             Label
+              13:    7(fvec4) Load 10(input)
+              17:          14 Load 16(attach)
+              24:     18(int) CompositeExtract 21 0
+              26:     18(int) CompositeExtract 21 1
+              27:    7(fvec4) ImageFetch 17 24 Lod 26
+              28:    7(fvec4) FAdd 13 27
+                              ReturnValue 28
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.constantbuffer.frag.out b/Test/baseResults/hlsl.constantbuffer.frag.out
index c88414f..58e9ed8 100644
--- a/Test/baseResults/hlsl.constantbuffer.frag.out
+++ b/Test/baseResults/hlsl.constantbuffer.frag.out
@@ -45,7 +45,7 @@
 0:24                direct index (layout( row_major std140) temp 4-element array of block{layout( row_major std140) uniform bool x, layout( row_major std140) uniform float y})
 0:24                  'cb3' (layout( row_major std140) uniform 2-element array of 4-element array of block{layout( row_major std140) uniform bool x, layout( row_major std140) uniform float y})
 0:24                  Constant:
-0:24                    2 (const int)
+0:24                    1 (const int)
 0:24                Constant:
 0:24                  3 (const int)
 0:24              Constant:
@@ -113,7 +113,7 @@
 0:24                direct index (layout( row_major std140) temp 4-element array of block{layout( row_major std140) uniform bool x, layout( row_major std140) uniform float y})
 0:24                  'cb3' (layout( row_major std140) uniform 2-element array of 4-element array of block{layout( row_major std140) uniform bool x, layout( row_major std140) uniform float y})
 0:24                  Constant:
-0:24                    2 (const int)
+0:24                    1 (const int)
 0:24                Constant:
 0:24                  3 (const int)
 0:24              Constant:
@@ -231,7 +231,7 @@
               54:    7(fvec4)   FAdd 45 53
                                 ReturnValue 54
               56:               Label
-              58:     41(ptr)   AccessChain 18(cb3) 21 57 20
+              58:     41(ptr)   AccessChain 18(cb3) 20 57 20
               59:    6(float)   Load 58
               60:    7(fvec4)   CompositeConstruct 59 59 59 59
                                 ReturnValue 60
diff --git a/Test/baseResults/hlsl.emptystructreturn.frag.out b/Test/baseResults/hlsl.emptystructreturn.frag.out
index dd40682..ee20b7d 100644
--- a/Test/baseResults/hlsl.emptystructreturn.frag.out
+++ b/Test/baseResults/hlsl.emptystructreturn.frag.out
@@ -56,7 +56,7 @@
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 20 23
+                              EntryPoint Fragment 4  "main"
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
diff --git a/Test/baseResults/hlsl.emptystructreturn.vert.out b/Test/baseResults/hlsl.emptystructreturn.vert.out
index 5cfdd70..7ff09dd 100644
--- a/Test/baseResults/hlsl.emptystructreturn.vert.out
+++ b/Test/baseResults/hlsl.emptystructreturn.vert.out
@@ -54,7 +54,7 @@
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 20 23
+                              EntryPoint Vertex 4  "main"
                               Source HLSL 500
                               Name 4  "main"
                               Name 6  "vs_in"
diff --git a/Test/baseResults/hlsl.flattenOpaque.frag.out b/Test/baseResults/hlsl.flattenOpaque.frag.out
index f8055c0..8eafba8 100755
--- a/Test/baseResults/hlsl.flattenOpaque.frag.out
+++ b/Test/baseResults/hlsl.flattenOpaque.frag.out
@@ -179,12 +179,12 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 85
+// Id's are bound by 99
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 83
+                              EntryPoint Fragment 4  "main" 97
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -201,22 +201,28 @@
                               Name 30  "s.tex"
                               Name 31  "f2"
                               Name 35  "@main("
-                              Name 37  "tex"
-                              Name 68  "s.s2D"
-                              Name 70  "param"
-                              Name 73  "s2.s2D"
-                              Name 74  "s2.tex"
-                              Name 77  "param"
-                              Name 83  "@entryPointOutput"
-                              Decorate 37(tex) DescriptorSet 0
-                              Decorate 68(s.s2D) DescriptorSet 0
-                              Decorate 73(s2.s2D) DescriptorSet 0
-                              Decorate 74(s2.tex) DescriptorSet 0
-                              Decorate 83(@entryPointOutput) Location 0
+                              Name 38  "tex"
+                              Name 70  "s.s2D"
+                              Name 71  "param"
+                              Name 74  "param"
+                              Name 76  "param"
+                              Name 79  "s2.s2D"
+                              Name 80  "s2.tex"
+                              Name 81  "param"
+                              Name 83  "param"
+                              Name 87  "param"
+                              Name 89  "param"
+                              Name 91  "param"
+                              Name 97  "@entryPointOutput"
+                              Decorate 38(tex) DescriptorSet 0
+                              Decorate 70(s.s2D) DescriptorSet 0
+                              Decorate 79(s2.s2D) DescriptorSet 0
+                              Decorate 80(s2.tex) DescriptorSet 0
+                              Decorate 97(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeSampler
-               7:             TypePointer UniformConstant 6
+               7:             TypePointer Function 6
                8:             TypeFloat 32
                9:             TypeVector 8(float) 4
               10:             TypeFunction 9(fvec4) 7(ptr)
@@ -224,80 +230,100 @@
               15:             TypePointer Function 14(fvec2)
               16:             TypeFunction 9(fvec4) 7(ptr) 15(ptr)
               21:             TypeImage 8(float) 2D sampled format:Unknown
-              22:             TypePointer UniformConstant 21
+              22:             TypePointer Function 21
               23:             TypeFunction 9(fvec4) 7(ptr) 22(ptr)
               28:             TypeFunction 9(fvec4) 7(ptr) 22(ptr) 15(ptr)
               34:             TypeFunction 9(fvec4)
-         37(tex):     22(ptr) Variable UniformConstant
-              40:             TypeSampledImage 21
-              42:    8(float) Constant 1045220557
-              43:    8(float) Constant 1050253722
-              44:   14(fvec2) ConstantComposite 42 43
-       68(s.s2D):      7(ptr) Variable UniformConstant
-      73(s2.s2D):      7(ptr) Variable UniformConstant
-      74(s2.tex):     22(ptr) Variable UniformConstant
-              82:             TypePointer Output 9(fvec4)
-83(@entryPointOutput):     82(ptr) Variable Output
+              37:             TypePointer UniformConstant 21
+         38(tex):     37(ptr) Variable UniformConstant
+              41:             TypeSampledImage 21
+              43:    8(float) Constant 1045220557
+              44:    8(float) Constant 1050253722
+              45:   14(fvec2) ConstantComposite 43 44
+              69:             TypePointer UniformConstant 6
+       70(s.s2D):     69(ptr) Variable UniformConstant
+      79(s2.s2D):     69(ptr) Variable UniformConstant
+      80(s2.tex):     37(ptr) Variable UniformConstant
+              96:             TypePointer Output 9(fvec4)
+97(@entryPointOutput):     96(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-              84:    9(fvec4) FunctionCall 35(@main()
-                              Store 83(@entryPointOutput) 84
+              98:    9(fvec4) FunctionCall 35(@main()
+                              Store 97(@entryPointOutput) 98
                               Return
                               FunctionEnd
 12(osCall1(struct-os-p11;):    9(fvec4) Function None 10
        11(s.s2D):      7(ptr) FunctionParameter
               13:             Label
-              38:          21 Load 37(tex)
-              39:           6 Load 11(s.s2D)
-              41:          40 SampledImage 38 39
-              45:    9(fvec4) ImageSampleImplicitLod 41 44
-                              ReturnValue 45
+              39:          21 Load 38(tex)
+              40:           6 Load 11(s.s2D)
+              42:          41 SampledImage 39 40
+              46:    9(fvec4) ImageSampleImplicitLod 42 45
+                              ReturnValue 46
                               FunctionEnd
 19(osCall2(struct-os-p11;vf2;):    9(fvec4) Function None 16
        17(s.s2D):      7(ptr) FunctionParameter
           18(f2):     15(ptr) FunctionParameter
               20:             Label
-              48:          21 Load 37(tex)
-              49:           6 Load 17(s.s2D)
-              50:          40 SampledImage 48 49
-              51:   14(fvec2) Load 18(f2)
-              52:    9(fvec4) ImageSampleImplicitLod 50 51
-                              ReturnValue 52
+              49:          21 Load 38(tex)
+              50:           6 Load 17(s.s2D)
+              51:          41 SampledImage 49 50
+              52:   14(fvec2) Load 18(f2)
+              53:    9(fvec4) ImageSampleImplicitLod 51 52
+                              ReturnValue 53
                               FunctionEnd
 26(os2Call1(struct-os2-p1-t211;):    9(fvec4) Function None 23
        24(s.s2D):      7(ptr) FunctionParameter
        25(s.tex):     22(ptr) FunctionParameter
               27:             Label
-              55:          21 Load 25(s.tex)
-              56:           6 Load 24(s.s2D)
-              57:          40 SampledImage 55 56
-              58:    9(fvec4) ImageSampleImplicitLod 57 44
-                              ReturnValue 58
+              56:          21 Load 25(s.tex)
+              57:           6 Load 24(s.s2D)
+              58:          41 SampledImage 56 57
+              59:    9(fvec4) ImageSampleImplicitLod 58 45
+                              ReturnValue 59
                               FunctionEnd
 32(os2Call2(struct-os2-p1-t211;vf2;):    9(fvec4) Function None 28
        29(s.s2D):      7(ptr) FunctionParameter
        30(s.tex):     22(ptr) FunctionParameter
           31(f2):     15(ptr) FunctionParameter
               33:             Label
-              61:          21 Load 30(s.tex)
-              62:           6 Load 29(s.s2D)
-              63:          40 SampledImage 61 62
-              64:   14(fvec2) Load 31(f2)
-              65:    9(fvec4) ImageSampleImplicitLod 63 64
-                              ReturnValue 65
+              62:          21 Load 30(s.tex)
+              63:           6 Load 29(s.s2D)
+              64:          41 SampledImage 62 63
+              65:   14(fvec2) Load 31(f2)
+              66:    9(fvec4) ImageSampleImplicitLod 64 65
+                              ReturnValue 66
                               FunctionEnd
       35(@main():    9(fvec4) Function None 34
               36:             Label
-       70(param):     15(ptr) Variable Function
-       77(param):     15(ptr) Variable Function
-              69:    9(fvec4) FunctionCall 12(osCall1(struct-os-p11;) 68(s.s2D)
-                              Store 70(param) 44
-              71:    9(fvec4) FunctionCall 19(osCall2(struct-os-p11;vf2;) 68(s.s2D) 70(param)
-              72:    9(fvec4) FAdd 69 71
-              75:    9(fvec4) FunctionCall 26(os2Call1(struct-os2-p1-t211;) 73(s2.s2D) 74(s2.tex)
-              76:    9(fvec4) FAdd 72 75
-                              Store 77(param) 44
-              78:    9(fvec4) FunctionCall 32(os2Call2(struct-os2-p1-t211;vf2;) 73(s2.s2D) 74(s2.tex) 77(param)
-              79:    9(fvec4) FAdd 76 78
-                              ReturnValue 79
+       71(param):      7(ptr) Variable Function
+       74(param):      7(ptr) Variable Function
+       76(param):     15(ptr) Variable Function
+       81(param):      7(ptr) Variable Function
+       83(param):     22(ptr) Variable Function
+       87(param):      7(ptr) Variable Function
+       89(param):     22(ptr) Variable Function
+       91(param):     15(ptr) Variable Function
+              72:           6 Load 70(s.s2D)
+                              Store 71(param) 72
+              73:    9(fvec4) FunctionCall 12(osCall1(struct-os-p11;) 71(param)
+              75:           6 Load 70(s.s2D)
+                              Store 74(param) 75
+                              Store 76(param) 45
+              77:    9(fvec4) FunctionCall 19(osCall2(struct-os-p11;vf2;) 74(param) 76(param)
+              78:    9(fvec4) FAdd 73 77
+              82:           6 Load 79(s2.s2D)
+                              Store 81(param) 82
+              84:          21 Load 80(s2.tex)
+                              Store 83(param) 84
+              85:    9(fvec4) FunctionCall 26(os2Call1(struct-os2-p1-t211;) 81(param) 83(param)
+              86:    9(fvec4) FAdd 78 85
+              88:           6 Load 79(s2.s2D)
+                              Store 87(param) 88
+              90:          21 Load 80(s2.tex)
+                              Store 89(param) 90
+                              Store 91(param) 45
+              92:    9(fvec4) FunctionCall 32(os2Call2(struct-os2-p1-t211;vf2;) 87(param) 89(param) 91(param)
+              93:    9(fvec4) FAdd 86 92
+                              ReturnValue 93
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.flattenOpaqueInit.vert.out b/Test/baseResults/hlsl.flattenOpaqueInit.vert.out
index f2ada9f..b82cfff 100755
--- a/Test/baseResults/hlsl.flattenOpaqueInit.vert.out
+++ b/Test/baseResults/hlsl.flattenOpaqueInit.vert.out
@@ -1,6 +1,5 @@
 hlsl.flattenOpaqueInit.vert
-WARNING: 0:20: '=' : cannot do member-wise aliasing for opaque members with this initializer 
-
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
 Shader version: 500
 0:? Sequence
 0:5  Function Definition: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
@@ -19,13 +18,36 @@
 0:10  Function Definition: fillOpaque( ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:10    Function Parameters: 
 0:?     Sequence
-0:12      'g_tInputTexture_sampler' ( uniform sampler)
-0:13      'g_tInputTexture' ( uniform texture2D)
+0:12      move second child to first child ( temp sampler)
+0:?         't.smpl' ( temp sampler)
+0:12        'g_tInputTexture_sampler' ( uniform sampler)
+0:13      move second child to first child ( temp texture2D)
+0:?         't.tex' ( temp texture2D)
+0:13        'g_tInputTexture' ( uniform texture2D)
 0:14      Branch: Return with expression
 0:14        't' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:18  Function Definition: @main( ( temp 4-component vector of float)
 0:18    Function Parameters: 
 0:?     Sequence
+0:19      Sequence
+0:19        Sequence
+0:19          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19            'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19            Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19              'g_tInputTexture_sampler' ( uniform sampler)
+0:19              'g_tInputTexture' ( uniform texture2D)
+0:19          move second child to first child ( temp sampler)
+0:?             'tex1.smpl' ( temp sampler)
+0:19            smpl: direct index for structure ( temp sampler)
+0:19              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19              Constant:
+0:19                0 (const int)
+0:19          move second child to first child ( temp texture2D)
+0:?             'tex1.tex' ( temp texture2D)
+0:19            tex: direct index for structure ( temp texture2D)
+0:19              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19              Constant:
+0:19                1 (const int)
 0:20      Sequence
 0:20        Sequence
 0:20          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
@@ -43,10 +65,18 @@
 0:20              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:20              Constant:
 0:20                1 (const int)
-0:21      Branch: Return with expression
-0:21        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
-0:?           'g_tInputTexture_sampler' ( uniform sampler)
-0:?           'g_tInputTexture' ( uniform texture2D)
+0:21      Sequence
+0:21        Sequence
+0:21          move second child to first child ( temp sampler)
+0:?             'tex3.smpl' ( temp sampler)
+0:?             'tex1.smpl' ( temp sampler)
+0:21          move second child to first child ( temp texture2D)
+0:?             'tex3.tex' ( temp texture2D)
+0:?             'tex1.tex' ( temp texture2D)
+0:22      Branch: Return with expression
+0:22        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
+0:?           'tex3.smpl' ( temp sampler)
+0:?           'tex3.tex' ( temp texture2D)
 0:18  Function Definition: main( ( temp void)
 0:18    Function Parameters: 
 0:?     Sequence
@@ -80,13 +110,36 @@
 0:10  Function Definition: fillOpaque( ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:10    Function Parameters: 
 0:?     Sequence
-0:12      'g_tInputTexture_sampler' ( uniform sampler)
-0:13      'g_tInputTexture' ( uniform texture2D)
+0:12      move second child to first child ( temp sampler)
+0:?         't.smpl' ( temp sampler)
+0:12        'g_tInputTexture_sampler' ( uniform sampler)
+0:13      move second child to first child ( temp texture2D)
+0:?         't.tex' ( temp texture2D)
+0:13        'g_tInputTexture' ( uniform texture2D)
 0:14      Branch: Return with expression
 0:14        't' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:18  Function Definition: @main( ( temp 4-component vector of float)
 0:18    Function Parameters: 
 0:?     Sequence
+0:19      Sequence
+0:19        Sequence
+0:19          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19            'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19            Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19              'g_tInputTexture_sampler' ( uniform sampler)
+0:19              'g_tInputTexture' ( uniform texture2D)
+0:19          move second child to first child ( temp sampler)
+0:?             'tex1.smpl' ( temp sampler)
+0:19            smpl: direct index for structure ( temp sampler)
+0:19              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19              Constant:
+0:19                0 (const int)
+0:19          move second child to first child ( temp texture2D)
+0:?             'tex1.tex' ( temp texture2D)
+0:19            tex: direct index for structure ( temp texture2D)
+0:19              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
+0:19              Constant:
+0:19                1 (const int)
 0:20      Sequence
 0:20        Sequence
 0:20          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex})
@@ -104,10 +157,18 @@
 0:20              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex})
 0:20              Constant:
 0:20                1 (const int)
-0:21      Branch: Return with expression
-0:21        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
-0:?           'g_tInputTexture_sampler' ( uniform sampler)
-0:?           'g_tInputTexture' ( uniform texture2D)
+0:21      Sequence
+0:21        Sequence
+0:21          move second child to first child ( temp sampler)
+0:?             'tex3.smpl' ( temp sampler)
+0:?             'tex1.smpl' ( temp sampler)
+0:21          move second child to first child ( temp texture2D)
+0:?             'tex3.tex' ( temp texture2D)
+0:?             'tex1.tex' ( temp texture2D)
+0:22      Branch: Return with expression
+0:22        Function Call: lookUp(struct-FxaaTex-p1-t211; ( temp 4-component vector of float)
+0:?           'tex3.smpl' ( temp sampler)
+0:?           'tex3.tex' ( temp texture2D)
 0:18  Function Definition: main( ( temp void)
 0:18    Function Parameters: 
 0:?     Sequence
@@ -121,12 +182,12 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 60
+// Id's are bound by 84
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 58
+                              EntryPoint Vertex 4  "main" 82
                               Source HLSL 500
                               Name 4  "main"
                               Name 15  "lookUp(struct-FxaaTex-p1-t211;"
@@ -137,23 +198,32 @@
                               MemberName 17(FxaaTex) 1  "tex"
                               Name 19  "fillOpaque("
                               Name 22  "@main("
-                              Name 36  "g_tInputTexture_sampler"
-                              Name 37  "g_tInputTexture"
-                              Name 39  "t"
-                              Name 43  "flattenTemp"
-                              Name 45  "tex2.smpl"
-                              Name 50  "tex2.tex"
-                              Name 58  "@entryPointOutput"
-                              Decorate 36(g_tInputTexture_sampler) DescriptorSet 0
-                              Decorate 37(g_tInputTexture) DescriptorSet 0
-                              Decorate 58(@entryPointOutput) Location 0
+                              Name 36  "t.smpl"
+                              Name 38  "g_tInputTexture_sampler"
+                              Name 40  "t.tex"
+                              Name 42  "g_tInputTexture"
+                              Name 45  "t"
+                              Name 49  "flattenTemp"
+                              Name 53  "tex1.smpl"
+                              Name 58  "tex1.tex"
+                              Name 62  "flattenTemp"
+                              Name 64  "tex2.smpl"
+                              Name 67  "tex2.tex"
+                              Name 70  "tex3.smpl"
+                              Name 72  "tex3.tex"
+                              Name 74  "param"
+                              Name 76  "param"
+                              Name 82  "@entryPointOutput"
+                              Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
+                              Decorate 42(g_tInputTexture) DescriptorSet 0
+                              Decorate 82(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeSampler
-               7:             TypePointer UniformConstant 6
+               7:             TypePointer Function 6
                8:             TypeFloat 32
                9:             TypeImage 8(float) 2D sampled format:Unknown
-              10:             TypePointer UniformConstant 9
+              10:             TypePointer Function 9
               11:             TypeVector 8(float) 4
               12:             TypeFunction 11(fvec4) 7(ptr) 10(ptr)
      17(FxaaTex):             TypeStruct 6 9
@@ -165,22 +235,20 @@
               30:    8(float) Constant 1053609165
               31:   28(fvec2) ConstantComposite 29 30
               32:    8(float) Constant 0
-36(g_tInputTexture_sampler):      7(ptr) Variable UniformConstant
-37(g_tInputTexture):     10(ptr) Variable UniformConstant
-              38:             TypePointer UniformConstant 17(FxaaTex)
-           39(t):     38(ptr) Variable UniformConstant
- 43(flattenTemp):     38(ptr) Variable UniformConstant
-   45(tex2.smpl):      7(ptr) Variable UniformConstant
-              46:             TypeInt 32 1
-              47:     46(int) Constant 0
-    50(tex2.tex):     10(ptr) Variable UniformConstant
-              51:     46(int) Constant 1
-              57:             TypePointer Output 11(fvec4)
-58(@entryPointOutput):     57(ptr) Variable Output
+              37:             TypePointer UniformConstant 6
+38(g_tInputTexture_sampler):     37(ptr) Variable UniformConstant
+              41:             TypePointer UniformConstant 9
+42(g_tInputTexture):     41(ptr) Variable UniformConstant
+              44:             TypePointer Function 17(FxaaTex)
+              54:             TypeInt 32 1
+              55:     54(int) Constant 0
+              59:     54(int) Constant 1
+              81:             TypePointer Output 11(fvec4)
+82(@entryPointOutput):     81(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-              59:   11(fvec4) FunctionCall 22(@main()
-                              Store 58(@entryPointOutput) 59
+              83:   11(fvec4) FunctionCall 22(@main()
+                              Store 82(@entryPointOutput) 83
                               Return
                               FunctionEnd
 15(lookUp(struct-FxaaTex-p1-t211;):   11(fvec4) Function None 12
@@ -195,19 +263,54 @@
                               FunctionEnd
  19(fillOpaque(): 17(FxaaTex) Function None 18
               20:             Label
-              40: 17(FxaaTex) Load 39(t)
-                              ReturnValue 40
+      36(t.smpl):      7(ptr) Variable Function
+       40(t.tex):     10(ptr) Variable Function
+           45(t):     44(ptr) Variable Function
+              39:           6 Load 38(g_tInputTexture_sampler)
+                              Store 36(t.smpl) 39
+              43:           9 Load 42(g_tInputTexture)
+                              Store 40(t.tex) 43
+              46: 17(FxaaTex) Load 45(t)
+                              ReturnValue 46
                               FunctionEnd
       22(@main():   11(fvec4) Function None 21
               23:             Label
-              44: 17(FxaaTex) FunctionCall 19(fillOpaque()
-                              Store 43(flattenTemp) 44
-              48:      7(ptr) AccessChain 43(flattenTemp) 47
-              49:           6 Load 48
-                              Store 45(tex2.smpl) 49
-              52:     10(ptr) AccessChain 43(flattenTemp) 51
-              53:           9 Load 52
-                              Store 50(tex2.tex) 53
-              54:   11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 36(g_tInputTexture_sampler) 37(g_tInputTexture)
-                              ReturnValue 54
+ 49(flattenTemp):     44(ptr) Variable Function
+   53(tex1.smpl):      7(ptr) Variable Function
+    58(tex1.tex):     10(ptr) Variable Function
+ 62(flattenTemp):     44(ptr) Variable Function
+   64(tex2.smpl):      7(ptr) Variable Function
+    67(tex2.tex):     10(ptr) Variable Function
+   70(tex3.smpl):      7(ptr) Variable Function
+    72(tex3.tex):     10(ptr) Variable Function
+       74(param):      7(ptr) Variable Function
+       76(param):     10(ptr) Variable Function
+              50:           6 Load 38(g_tInputTexture_sampler)
+              51:           9 Load 42(g_tInputTexture)
+              52: 17(FxaaTex) CompositeConstruct 50 51
+                              Store 49(flattenTemp) 52
+              56:      7(ptr) AccessChain 49(flattenTemp) 55
+              57:           6 Load 56
+                              Store 53(tex1.smpl) 57
+              60:     10(ptr) AccessChain 49(flattenTemp) 59
+              61:           9 Load 60
+                              Store 58(tex1.tex) 61
+              63: 17(FxaaTex) FunctionCall 19(fillOpaque()
+                              Store 62(flattenTemp) 63
+              65:      7(ptr) AccessChain 62(flattenTemp) 55
+              66:           6 Load 65
+                              Store 64(tex2.smpl) 66
+              68:     10(ptr) AccessChain 62(flattenTemp) 59
+              69:           9 Load 68
+                              Store 67(tex2.tex) 69
+              71:           6 Load 53(tex1.smpl)
+                              Store 70(tex3.smpl) 71
+              73:           9 Load 58(tex1.tex)
+                              Store 72(tex3.tex) 73
+              75:           6 Load 70(tex3.smpl)
+                              Store 74(param) 75
+              77:           9 Load 72(tex3.tex)
+                              Store 76(param) 77
+              78:   11(fvec4) FunctionCall 15(lookUp(struct-FxaaTex-p1-t211;) 74(param) 76(param)
+                              ReturnValue 78
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.flattenOpaqueInitMix.vert.out b/Test/baseResults/hlsl.flattenOpaqueInitMix.vert.out
index 82ebf23..2de3483 100755
--- a/Test/baseResults/hlsl.flattenOpaqueInitMix.vert.out
+++ b/Test/baseResults/hlsl.flattenOpaqueInitMix.vert.out
@@ -1,4 +1,5 @@
 hlsl.flattenOpaqueInitMix.vert
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
 Shader version: 500
 0:? Sequence
 0:5  Function Definition: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float)
@@ -19,15 +20,36 @@
 0:10    Function Parameters: 
 0:?     Sequence
 0:11      Sequence
-0:?         Sequence
+0:11        Sequence
+0:11          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11            'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11            Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11              'g_tInputTexture_sampler' ( uniform sampler)
+0:11              'g_tInputTexture' ( uniform texture2D)
+0:11              Constant:
+0:11                0.500000
+0:11          move second child to first child ( temp sampler)
+0:?             'tex.smpl' ( temp sampler)
+0:11            smpl: direct index for structure ( temp sampler)
+0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11              Constant:
+0:11                0 (const int)
+0:11          move second child to first child ( temp texture2D)
+0:?             'tex.tex' ( temp texture2D)
+0:11            tex: direct index for structure ( temp texture2D)
+0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11              Constant:
+0:11                1 (const int)
 0:11          move second child to first child ( temp float)
 0:?             'tex.f' ( temp float)
-0:11            Constant:
-0:11              0.500000
+0:11            f: direct index for structure ( temp float)
+0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11              Constant:
+0:11                2 (const int)
 0:12      Branch: Return with expression
 0:12        Function Call: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float)
-0:?           'g_tInputTexture_sampler' ( uniform sampler)
-0:?           'g_tInputTexture' ( uniform texture2D)
+0:?           'tex.smpl' ( temp sampler)
+0:?           'tex.tex' ( temp texture2D)
 0:?           'tex.f' ( temp float)
 0:10  Function Definition: main( ( temp void)
 0:10    Function Parameters: 
@@ -64,15 +86,36 @@
 0:10    Function Parameters: 
 0:?     Sequence
 0:11      Sequence
-0:?         Sequence
+0:11        Sequence
+0:11          move second child to first child ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11            'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11            Construct structure ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11              'g_tInputTexture_sampler' ( uniform sampler)
+0:11              'g_tInputTexture' ( uniform texture2D)
+0:11              Constant:
+0:11                0.500000
+0:11          move second child to first child ( temp sampler)
+0:?             'tex.smpl' ( temp sampler)
+0:11            smpl: direct index for structure ( temp sampler)
+0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11              Constant:
+0:11                0 (const int)
+0:11          move second child to first child ( temp texture2D)
+0:?             'tex.tex' ( temp texture2D)
+0:11            tex: direct index for structure ( temp texture2D)
+0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11              Constant:
+0:11                1 (const int)
 0:11          move second child to first child ( temp float)
 0:?             'tex.f' ( temp float)
-0:11            Constant:
-0:11              0.500000
+0:11            f: direct index for structure ( temp float)
+0:11              'flattenTemp' ( temp structure{ temp sampler smpl,  temp texture2D tex,  temp float f})
+0:11              Constant:
+0:11                2 (const int)
 0:12      Branch: Return with expression
 0:12        Function Call: lookUp(struct-FxaaTex-p1-t21-f11; ( temp 4-component vector of float)
-0:?           'g_tInputTexture_sampler' ( uniform sampler)
-0:?           'g_tInputTexture' ( uniform texture2D)
+0:?           'tex.smpl' ( temp sampler)
+0:?           'tex.tex' ( temp texture2D)
 0:?           'tex.f' ( temp float)
 0:10  Function Definition: main( ( temp void)
 0:10    Function Parameters: 
@@ -87,12 +130,12 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 46
+// Id's are bound by 70
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 44
+                              EntryPoint Vertex 4  "main" 68
                               Source HLSL 500
                               Name 4  "main"
                               Name 17  "lookUp(struct-FxaaTex-p1-t21-f11;"
@@ -100,21 +143,30 @@
                               Name 15  "tex.tex"
                               Name 16  "tex.f"
                               Name 20  "@main("
-                              Name 34  "tex.f"
-                              Name 36  "g_tInputTexture_sampler"
-                              Name 37  "g_tInputTexture"
-                              Name 38  "param"
-                              Name 44  "@entryPointOutput"
-                              Decorate 36(g_tInputTexture_sampler) DescriptorSet 0
-                              Decorate 37(g_tInputTexture) DescriptorSet 0
-                              Decorate 44(@entryPointOutput) Location 0
+                              Name 34  "FxaaTex"
+                              MemberName 34(FxaaTex) 0  "smpl"
+                              MemberName 34(FxaaTex) 1  "tex"
+                              MemberName 34(FxaaTex) 2  "f"
+                              Name 36  "flattenTemp"
+                              Name 38  "g_tInputTexture_sampler"
+                              Name 41  "g_tInputTexture"
+                              Name 45  "tex.smpl"
+                              Name 50  "tex.tex"
+                              Name 54  "tex.f"
+                              Name 58  "param"
+                              Name 60  "param"
+                              Name 62  "param"
+                              Name 68  "@entryPointOutput"
+                              Decorate 38(g_tInputTexture_sampler) DescriptorSet 0
+                              Decorate 41(g_tInputTexture) DescriptorSet 0
+                              Decorate 68(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeSampler
-               7:             TypePointer UniformConstant 6
+               7:             TypePointer Function 6
                8:             TypeFloat 32
                9:             TypeImage 8(float) 2D sampled format:Unknown
-              10:             TypePointer UniformConstant 9
+              10:             TypePointer Function 9
               11:             TypePointer Function 8(float)
               12:             TypeVector 8(float) 4
               13:             TypeFunction 12(fvec4) 7(ptr) 10(ptr) 11(ptr)
@@ -122,15 +174,23 @@
               24:             TypeSampledImage 9
               28:             TypeVector 8(float) 2
               30:    8(float) Constant 0
-              35:    8(float) Constant 1056964608
-36(g_tInputTexture_sampler):      7(ptr) Variable UniformConstant
-37(g_tInputTexture):     10(ptr) Variable UniformConstant
-              43:             TypePointer Output 12(fvec4)
-44(@entryPointOutput):     43(ptr) Variable Output
+     34(FxaaTex):             TypeStruct 6 9 8(float)
+              35:             TypePointer Function 34(FxaaTex)
+              37:             TypePointer UniformConstant 6
+38(g_tInputTexture_sampler):     37(ptr) Variable UniformConstant
+              40:             TypePointer UniformConstant 9
+41(g_tInputTexture):     40(ptr) Variable UniformConstant
+              43:    8(float) Constant 1056964608
+              46:             TypeInt 32 1
+              47:     46(int) Constant 0
+              51:     46(int) Constant 1
+              55:     46(int) Constant 2
+              67:             TypePointer Output 12(fvec4)
+68(@entryPointOutput):     67(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-              45:   12(fvec4) FunctionCall 20(@main()
-                              Store 44(@entryPointOutput) 45
+              69:   12(fvec4) FunctionCall 20(@main()
+                              Store 68(@entryPointOutput) 69
                               Return
                               FunctionEnd
 17(lookUp(struct-FxaaTex-p1-t21-f11;):   12(fvec4) Function None 13
@@ -149,11 +209,32 @@
                               FunctionEnd
       20(@main():   12(fvec4) Function None 19
               21:             Label
-       34(tex.f):     11(ptr) Variable Function
-       38(param):     11(ptr) Variable Function
-                              Store 34(tex.f) 35
-              39:    8(float) Load 34(tex.f)
-                              Store 38(param) 39
-              40:   12(fvec4) FunctionCall 17(lookUp(struct-FxaaTex-p1-t21-f11;) 36(g_tInputTexture_sampler) 37(g_tInputTexture) 38(param)
-                              ReturnValue 40
+ 36(flattenTemp):     35(ptr) Variable Function
+    45(tex.smpl):      7(ptr) Variable Function
+     50(tex.tex):     10(ptr) Variable Function
+       54(tex.f):     11(ptr) Variable Function
+       58(param):      7(ptr) Variable Function
+       60(param):     10(ptr) Variable Function
+       62(param):     11(ptr) Variable Function
+              39:           6 Load 38(g_tInputTexture_sampler)
+              42:           9 Load 41(g_tInputTexture)
+              44: 34(FxaaTex) CompositeConstruct 39 42 43
+                              Store 36(flattenTemp) 44
+              48:      7(ptr) AccessChain 36(flattenTemp) 47
+              49:           6 Load 48
+                              Store 45(tex.smpl) 49
+              52:     10(ptr) AccessChain 36(flattenTemp) 51
+              53:           9 Load 52
+                              Store 50(tex.tex) 53
+              56:     11(ptr) AccessChain 36(flattenTemp) 55
+              57:    8(float) Load 56
+                              Store 54(tex.f) 57
+              59:           6 Load 45(tex.smpl)
+                              Store 58(param) 59
+              61:           9 Load 50(tex.tex)
+                              Store 60(param) 61
+              63:    8(float) Load 54(tex.f)
+                              Store 62(param) 63
+              64:   12(fvec4) FunctionCall 17(lookUp(struct-FxaaTex-p1-t21-f11;) 58(param) 60(param) 62(param)
+                              ReturnValue 64
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.flattenSubset.frag.out b/Test/baseResults/hlsl.flattenSubset.frag.out
new file mode 100755
index 0000000..f6d867f
--- /dev/null
+++ b/Test/baseResults/hlsl.flattenSubset.frag.out
@@ -0,0 +1,218 @@
+hlsl.flattenSubset.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:30  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:30    Function Parameters: 
+0:30      'vpos' ( in 4-component vector of float)
+0:?     Sequence
+0:33      move second child to first child ( temp sampler)
+0:?         's1.s0.ss' ( temp sampler)
+0:33        'samp' ( uniform sampler)
+0:34      Sequence
+0:34        move second child to first child ( temp float)
+0:?           's2.resources.b' ( temp float)
+0:?           's1.b' ( temp float)
+0:34        move second child to first child ( temp sampler)
+0:?           's2.resources.samplerState' ( temp sampler)
+0:?           's1.samplerState' ( temp sampler)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.s0.x' ( temp int)
+0:?           's1.s0.x' ( temp int)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.s0.y' ( temp int)
+0:?           's1.s0.y' ( temp int)
+0:34        move second child to first child ( temp sampler)
+0:?           's2.resources.s0.ss' ( temp sampler)
+0:?           's1.s0.ss' ( temp sampler)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.a' ( temp int)
+0:?           's1.a' ( temp int)
+0:35      Branch: Return with expression
+0:35        texture ( temp 4-component vector of float)
+0:35          Construct combined texture-sampler ( temp sampler2D)
+0:35            'tex' ( uniform texture2D)
+0:?             's2.resources.s0.ss' ( temp sampler)
+0:35          Constant:
+0:35            0.500000
+0:35            0.500000
+0:30  Function Definition: main( ( temp void)
+0:30    Function Parameters: 
+0:?     Sequence
+0:30      move second child to first child ( temp 4-component vector of float)
+0:?         'vpos' ( temp 4-component vector of float)
+0:?         'vpos' (layout( location=0) in 4-component vector of float)
+0:30      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:30        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'vpos' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'samp' ( uniform sampler)
+0:?     'tex' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'vpos' (layout( location=0) in 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:30  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:30    Function Parameters: 
+0:30      'vpos' ( in 4-component vector of float)
+0:?     Sequence
+0:33      move second child to first child ( temp sampler)
+0:?         's1.s0.ss' ( temp sampler)
+0:33        'samp' ( uniform sampler)
+0:34      Sequence
+0:34        move second child to first child ( temp float)
+0:?           's2.resources.b' ( temp float)
+0:?           's1.b' ( temp float)
+0:34        move second child to first child ( temp sampler)
+0:?           's2.resources.samplerState' ( temp sampler)
+0:?           's1.samplerState' ( temp sampler)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.s0.x' ( temp int)
+0:?           's1.s0.x' ( temp int)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.s0.y' ( temp int)
+0:?           's1.s0.y' ( temp int)
+0:34        move second child to first child ( temp sampler)
+0:?           's2.resources.s0.ss' ( temp sampler)
+0:?           's1.s0.ss' ( temp sampler)
+0:34        move second child to first child ( temp int)
+0:?           's2.resources.a' ( temp int)
+0:?           's1.a' ( temp int)
+0:35      Branch: Return with expression
+0:35        texture ( temp 4-component vector of float)
+0:35          Construct combined texture-sampler ( temp sampler2D)
+0:35            'tex' ( uniform texture2D)
+0:?             's2.resources.s0.ss' ( temp sampler)
+0:35          Constant:
+0:35            0.500000
+0:35            0.500000
+0:30  Function Definition: main( ( temp void)
+0:30    Function Parameters: 
+0:?     Sequence
+0:30      move second child to first child ( temp 4-component vector of float)
+0:?         'vpos' ( temp 4-component vector of float)
+0:?         'vpos' (layout( location=0) in 4-component vector of float)
+0:30      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:30        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'vpos' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'samp' ( uniform sampler)
+0:?     'tex' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'vpos' (layout( location=0) in 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 61
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 54 57
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 11  "@main(vf4;"
+                              Name 10  "vpos"
+                              Name 15  "s1.s0.ss"
+                              Name 17  "samp"
+                              Name 20  "s2.resources.b"
+                              Name 21  "s1.b"
+                              Name 23  "s2.resources.samplerState"
+                              Name 24  "s1.samplerState"
+                              Name 28  "s2.resources.s0.x"
+                              Name 29  "s1.s0.x"
+                              Name 31  "s2.resources.s0.y"
+                              Name 32  "s1.s0.y"
+                              Name 34  "s2.resources.s0.ss"
+                              Name 36  "s2.resources.a"
+                              Name 37  "s1.a"
+                              Name 41  "tex"
+                              Name 52  "vpos"
+                              Name 54  "vpos"
+                              Name 57  "@entryPointOutput"
+                              Name 58  "param"
+                              Decorate 17(samp) DescriptorSet 0
+                              Decorate 41(tex) DescriptorSet 0
+                              Decorate 54(vpos) Location 0
+                              Decorate 57(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypePointer Function 7(fvec4)
+               9:             TypeFunction 7(fvec4) 8(ptr)
+              13:             TypeSampler
+              14:             TypePointer Function 13
+              16:             TypePointer UniformConstant 13
+        17(samp):     16(ptr) Variable UniformConstant
+              19:             TypePointer Function 6(float)
+              26:             TypeInt 32 1
+              27:             TypePointer Function 26(int)
+              39:             TypeImage 6(float) 2D sampled format:Unknown
+              40:             TypePointer UniformConstant 39
+         41(tex):     40(ptr) Variable UniformConstant
+              44:             TypeSampledImage 39
+              46:             TypeVector 6(float) 2
+              47:    6(float) Constant 1056964608
+              48:   46(fvec2) ConstantComposite 47 47
+              53:             TypePointer Input 7(fvec4)
+        54(vpos):     53(ptr) Variable Input
+              56:             TypePointer Output 7(fvec4)
+57(@entryPointOutput):     56(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+        52(vpos):      8(ptr) Variable Function
+       58(param):      8(ptr) Variable Function
+              55:    7(fvec4) Load 54(vpos)
+                              Store 52(vpos) 55
+              59:    7(fvec4) Load 52(vpos)
+                              Store 58(param) 59
+              60:    7(fvec4) FunctionCall 11(@main(vf4;) 58(param)
+                              Store 57(@entryPointOutput) 60
+                              Return
+                              FunctionEnd
+  11(@main(vf4;):    7(fvec4) Function None 9
+        10(vpos):      8(ptr) FunctionParameter
+              12:             Label
+    15(s1.s0.ss):     14(ptr) Variable Function
+20(s2.resources.b):     19(ptr) Variable Function
+        21(s1.b):     19(ptr) Variable Function
+23(s2.resources.samplerState):     14(ptr) Variable Function
+24(s1.samplerState):     14(ptr) Variable Function
+28(s2.resources.s0.x):     27(ptr) Variable Function
+     29(s1.s0.x):     27(ptr) Variable Function
+31(s2.resources.s0.y):     27(ptr) Variable Function
+     32(s1.s0.y):     27(ptr) Variable Function
+34(s2.resources.s0.ss):     14(ptr) Variable Function
+36(s2.resources.a):     27(ptr) Variable Function
+        37(s1.a):     27(ptr) Variable Function
+              18:          13 Load 17(samp)
+                              Store 15(s1.s0.ss) 18
+              22:    6(float) Load 21(s1.b)
+                              Store 20(s2.resources.b) 22
+              25:          13 Load 24(s1.samplerState)
+                              Store 23(s2.resources.samplerState) 25
+              30:     26(int) Load 29(s1.s0.x)
+                              Store 28(s2.resources.s0.x) 30
+              33:     26(int) Load 32(s1.s0.y)
+                              Store 31(s2.resources.s0.y) 33
+              35:          13 Load 15(s1.s0.ss)
+                              Store 34(s2.resources.s0.ss) 35
+              38:     26(int) Load 37(s1.a)
+                              Store 36(s2.resources.a) 38
+              42:          39 Load 41(tex)
+              43:          13 Load 34(s2.resources.s0.ss)
+              45:          44 SampledImage 42 43
+              49:    7(fvec4) ImageSampleImplicitLod 45 48
+                              ReturnValue 49
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.flattenSubset2.frag.out b/Test/baseResults/hlsl.flattenSubset2.frag.out
new file mode 100755
index 0000000..4983834
--- /dev/null
+++ b/Test/baseResults/hlsl.flattenSubset2.frag.out
@@ -0,0 +1,207 @@
+hlsl.flattenSubset2.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:8  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:8    Function Parameters: 
+0:8      'vpos' ( in 4-component vector of float)
+0:?     Sequence
+0:13      Sequence
+0:13        move second child to first child ( temp float)
+0:?           'a1.n.y' ( temp float)
+0:?           'a2.n.y' ( temp float)
+0:13        move second child to first child ( temp texture2D)
+0:?           'a1.n.texNested' ( temp texture2D)
+0:?           'a2.n.texNested' ( temp texture2D)
+0:14      Sequence
+0:14        move second child to first child ( temp float)
+0:?           'b.n.y' ( temp float)
+0:?           'a1.n.y' ( temp float)
+0:14        move second child to first child ( temp texture2D)
+0:?           'b.n.texNested' ( temp texture2D)
+0:?           'a1.n.texNested' ( temp texture2D)
+0:17      Sequence
+0:17        Sequence
+0:17          move second child to first child ( temp float)
+0:?             'n.y' ( temp float)
+0:?             'b.n.y' ( temp float)
+0:17          move second child to first child ( temp texture2D)
+0:?             'n.texNested' ( temp texture2D)
+0:?             'b.n.texNested' ( temp texture2D)
+0:20      move second child to first child ( temp texture2D)
+0:?         'a2.n.texNested' ( temp texture2D)
+0:20        'someTex' ( uniform texture2D)
+0:21      move second child to first child ( temp float)
+0:?         'a1.n.y' ( temp float)
+0:21        Constant:
+0:21          1.000000
+0:23      Branch: Return with expression
+0:?         Constant:
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:8  Function Definition: main( ( temp void)
+0:8    Function Parameters: 
+0:?     Sequence
+0:8      move second child to first child ( temp 4-component vector of float)
+0:?         'vpos' ( temp 4-component vector of float)
+0:?         'vpos' (layout( location=0) in 4-component vector of float)
+0:8      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:8        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'vpos' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'someTex' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'vpos' (layout( location=0) in 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:8  Function Definition: @main(vf4; ( temp 4-component vector of float)
+0:8    Function Parameters: 
+0:8      'vpos' ( in 4-component vector of float)
+0:?     Sequence
+0:13      Sequence
+0:13        move second child to first child ( temp float)
+0:?           'a1.n.y' ( temp float)
+0:?           'a2.n.y' ( temp float)
+0:13        move second child to first child ( temp texture2D)
+0:?           'a1.n.texNested' ( temp texture2D)
+0:?           'a2.n.texNested' ( temp texture2D)
+0:14      Sequence
+0:14        move second child to first child ( temp float)
+0:?           'b.n.y' ( temp float)
+0:?           'a1.n.y' ( temp float)
+0:14        move second child to first child ( temp texture2D)
+0:?           'b.n.texNested' ( temp texture2D)
+0:?           'a1.n.texNested' ( temp texture2D)
+0:17      Sequence
+0:17        Sequence
+0:17          move second child to first child ( temp float)
+0:?             'n.y' ( temp float)
+0:?             'b.n.y' ( temp float)
+0:17          move second child to first child ( temp texture2D)
+0:?             'n.texNested' ( temp texture2D)
+0:?             'b.n.texNested' ( temp texture2D)
+0:20      move second child to first child ( temp texture2D)
+0:?         'a2.n.texNested' ( temp texture2D)
+0:20        'someTex' ( uniform texture2D)
+0:21      move second child to first child ( temp float)
+0:?         'a1.n.y' ( temp float)
+0:21        Constant:
+0:21          1.000000
+0:23      Branch: Return with expression
+0:?         Constant:
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:?           0.000000
+0:8  Function Definition: main( ( temp void)
+0:8    Function Parameters: 
+0:?     Sequence
+0:8      move second child to first child ( temp 4-component vector of float)
+0:?         'vpos' ( temp 4-component vector of float)
+0:?         'vpos' (layout( location=0) in 4-component vector of float)
+0:8      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:8        Function Call: @main(vf4; ( temp 4-component vector of float)
+0:?           'vpos' ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'someTex' ( uniform texture2D)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'vpos' (layout( location=0) in 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 47
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 40 43
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 11  "@main(vf4;"
+                              Name 10  "vpos"
+                              Name 14  "a1.n.y"
+                              Name 15  "a2.n.y"
+                              Name 19  "a1.n.texNested"
+                              Name 20  "a2.n.texNested"
+                              Name 22  "b.n.y"
+                              Name 24  "b.n.texNested"
+                              Name 26  "n.y"
+                              Name 28  "n.texNested"
+                              Name 31  "someTex"
+                              Name 38  "vpos"
+                              Name 40  "vpos"
+                              Name 43  "@entryPointOutput"
+                              Name 44  "param"
+                              Decorate 31(someTex) DescriptorSet 0
+                              Decorate 40(vpos) Location 0
+                              Decorate 43(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypePointer Function 7(fvec4)
+               9:             TypeFunction 7(fvec4) 8(ptr)
+              13:             TypePointer Function 6(float)
+              17:             TypeImage 6(float) 2D sampled format:Unknown
+              18:             TypePointer Function 17
+              30:             TypePointer UniformConstant 17
+     31(someTex):     30(ptr) Variable UniformConstant
+              33:    6(float) Constant 1065353216
+              34:    6(float) Constant 0
+              35:    7(fvec4) ConstantComposite 34 34 34 34
+              39:             TypePointer Input 7(fvec4)
+        40(vpos):     39(ptr) Variable Input
+              42:             TypePointer Output 7(fvec4)
+43(@entryPointOutput):     42(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+        38(vpos):      8(ptr) Variable Function
+       44(param):      8(ptr) Variable Function
+              41:    7(fvec4) Load 40(vpos)
+                              Store 38(vpos) 41
+              45:    7(fvec4) Load 38(vpos)
+                              Store 44(param) 45
+              46:    7(fvec4) FunctionCall 11(@main(vf4;) 44(param)
+                              Store 43(@entryPointOutput) 46
+                              Return
+                              FunctionEnd
+  11(@main(vf4;):    7(fvec4) Function None 9
+        10(vpos):      8(ptr) FunctionParameter
+              12:             Label
+      14(a1.n.y):     13(ptr) Variable Function
+      15(a2.n.y):     13(ptr) Variable Function
+19(a1.n.texNested):     18(ptr) Variable Function
+20(a2.n.texNested):     18(ptr) Variable Function
+       22(b.n.y):     13(ptr) Variable Function
+24(b.n.texNested):     18(ptr) Variable Function
+         26(n.y):     13(ptr) Variable Function
+ 28(n.texNested):     18(ptr) Variable Function
+              16:    6(float) Load 15(a2.n.y)
+                              Store 14(a1.n.y) 16
+              21:          17 Load 20(a2.n.texNested)
+                              Store 19(a1.n.texNested) 21
+              23:    6(float) Load 14(a1.n.y)
+                              Store 22(b.n.y) 23
+              25:          17 Load 19(a1.n.texNested)
+                              Store 24(b.n.texNested) 25
+              27:    6(float) Load 22(b.n.y)
+                              Store 26(n.y) 27
+              29:          17 Load 24(b.n.texNested)
+                              Store 28(n.texNested) 29
+              32:          17 Load 31(someTex)
+                              Store 20(a2.n.texNested) 32
+                              Store 14(a1.n.y) 33
+                              ReturnValue 35
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.gathercmpRGBA.offset.dx10.frag.out b/Test/baseResults/hlsl.gathercmpRGBA.offset.dx10.frag.out
index dd99cb1..7bfed63 100644
--- a/Test/baseResults/hlsl.gathercmpRGBA.offset.dx10.frag.out
+++ b/Test/baseResults/hlsl.gathercmpRGBA.offset.dx10.frag.out
@@ -10,7 +10,7 @@
 0:45          'txval001' ( temp 4-component vector of float)
 0:45          textureGatherOffset ( temp 4-component vector of float)
 0:45            Construct combined texture-sampler ( temp sampler2DShadow)
-0:45              'g_tTex2df4' ( uniform texture2D)
+0:45              'g_tTex2df4' ( uniform texture2DShadow)
 0:45              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:45            c2: direct index for structure ( uniform 2-component vector of float)
 0:45              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -26,7 +26,7 @@
 0:46          'txval011' ( temp 4-component vector of int)
 0:46          textureGatherOffset ( temp 4-component vector of int)
 0:46            Construct combined texture-sampler ( temp isampler2DShadow)
-0:46              'g_tTex2di4' ( uniform itexture2D)
+0:46              'g_tTex2di4' ( uniform itexture2DShadow)
 0:46              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:46            c2: direct index for structure ( uniform 2-component vector of float)
 0:46              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -42,7 +42,7 @@
 0:47          'txval021' ( temp 4-component vector of uint)
 0:47          textureGatherOffset ( temp 4-component vector of uint)
 0:47            Construct combined texture-sampler ( temp usampler2DShadow)
-0:47              'g_tTex2du4' ( uniform utexture2D)
+0:47              'g_tTex2du4' ( uniform utexture2DShadow)
 0:47              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:47            c2: direct index for structure ( uniform 2-component vector of float)
 0:47              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -58,7 +58,7 @@
 0:49          'txval004' ( temp 4-component vector of float)
 0:49          textureGatherOffsets ( temp 4-component vector of float)
 0:49            Construct combined texture-sampler ( temp sampler2DShadow)
-0:49              'g_tTex2df4' ( uniform texture2D)
+0:49              'g_tTex2df4' ( uniform texture2DShadow)
 0:49              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:49            c2: direct index for structure ( uniform 2-component vector of float)
 0:49              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -80,7 +80,7 @@
 0:50          'txval014' ( temp 4-component vector of int)
 0:50          textureGatherOffsets ( temp 4-component vector of int)
 0:50            Construct combined texture-sampler ( temp isampler2DShadow)
-0:50              'g_tTex2di4' ( uniform itexture2D)
+0:50              'g_tTex2di4' ( uniform itexture2DShadow)
 0:50              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:50            c2: direct index for structure ( uniform 2-component vector of float)
 0:50              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -102,7 +102,7 @@
 0:51          'txval024' ( temp 4-component vector of uint)
 0:51          textureGatherOffsets ( temp 4-component vector of uint)
 0:51            Construct combined texture-sampler ( temp usampler2DShadow)
-0:51              'g_tTex2du4' ( uniform utexture2D)
+0:51              'g_tTex2du4' ( uniform utexture2DShadow)
 0:51              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:51            c2: direct index for structure ( uniform 2-component vector of float)
 0:51              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -124,7 +124,7 @@
 0:53          'txval401' ( temp 4-component vector of float)
 0:53          textureGatherOffset ( temp 4-component vector of float)
 0:53            Construct combined texture-sampler ( temp sampler2DShadow)
-0:53              'g_tTex2df4' ( uniform texture2D)
+0:53              'g_tTex2df4' ( uniform texture2DShadow)
 0:53              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:53            c2: direct index for structure ( uniform 2-component vector of float)
 0:53              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -140,7 +140,7 @@
 0:54          'txval411' ( temp 4-component vector of int)
 0:54          textureGatherOffset ( temp 4-component vector of int)
 0:54            Construct combined texture-sampler ( temp isampler2DShadow)
-0:54              'g_tTex2di4' ( uniform itexture2D)
+0:54              'g_tTex2di4' ( uniform itexture2DShadow)
 0:54              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:54            c2: direct index for structure ( uniform 2-component vector of float)
 0:54              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -156,7 +156,7 @@
 0:55          'txval421' ( temp 4-component vector of uint)
 0:55          textureGatherOffset ( temp 4-component vector of uint)
 0:55            Construct combined texture-sampler ( temp usampler2DShadow)
-0:55              'g_tTex2du4' ( uniform utexture2D)
+0:55              'g_tTex2du4' ( uniform utexture2DShadow)
 0:55              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:55            c2: direct index for structure ( uniform 2-component vector of float)
 0:55              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -211,9 +211,9 @@
 0:?     'g_tTex1df4' (layout( binding=0) uniform texture1D)
 0:?     'g_tTex1di4' ( uniform itexture1D)
 0:?     'g_tTex1du4' ( uniform utexture1D)
-0:?     'g_tTex2df4' ( uniform texture2D)
-0:?     'g_tTex2di4' ( uniform itexture2D)
-0:?     'g_tTex2du4' ( uniform utexture2D)
+0:?     'g_tTex2df4' ( uniform texture2DShadow)
+0:?     'g_tTex2di4' ( uniform itexture2DShadow)
+0:?     'g_tTex2du4' ( uniform utexture2DShadow)
 0:?     'g_tTex3df4' ( uniform texture3D)
 0:?     'g_tTex3di4' ( uniform itexture3D)
 0:?     'g_tTex3du4' ( uniform utexture3D)
@@ -239,7 +239,7 @@
 0:45          'txval001' ( temp 4-component vector of float)
 0:45          textureGatherOffset ( temp 4-component vector of float)
 0:45            Construct combined texture-sampler ( temp sampler2DShadow)
-0:45              'g_tTex2df4' ( uniform texture2D)
+0:45              'g_tTex2df4' ( uniform texture2DShadow)
 0:45              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:45            c2: direct index for structure ( uniform 2-component vector of float)
 0:45              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -255,7 +255,7 @@
 0:46          'txval011' ( temp 4-component vector of int)
 0:46          textureGatherOffset ( temp 4-component vector of int)
 0:46            Construct combined texture-sampler ( temp isampler2DShadow)
-0:46              'g_tTex2di4' ( uniform itexture2D)
+0:46              'g_tTex2di4' ( uniform itexture2DShadow)
 0:46              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:46            c2: direct index for structure ( uniform 2-component vector of float)
 0:46              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -271,7 +271,7 @@
 0:47          'txval021' ( temp 4-component vector of uint)
 0:47          textureGatherOffset ( temp 4-component vector of uint)
 0:47            Construct combined texture-sampler ( temp usampler2DShadow)
-0:47              'g_tTex2du4' ( uniform utexture2D)
+0:47              'g_tTex2du4' ( uniform utexture2DShadow)
 0:47              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:47            c2: direct index for structure ( uniform 2-component vector of float)
 0:47              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -287,7 +287,7 @@
 0:49          'txval004' ( temp 4-component vector of float)
 0:49          textureGatherOffsets ( temp 4-component vector of float)
 0:49            Construct combined texture-sampler ( temp sampler2DShadow)
-0:49              'g_tTex2df4' ( uniform texture2D)
+0:49              'g_tTex2df4' ( uniform texture2DShadow)
 0:49              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:49            c2: direct index for structure ( uniform 2-component vector of float)
 0:49              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -309,7 +309,7 @@
 0:50          'txval014' ( temp 4-component vector of int)
 0:50          textureGatherOffsets ( temp 4-component vector of int)
 0:50            Construct combined texture-sampler ( temp isampler2DShadow)
-0:50              'g_tTex2di4' ( uniform itexture2D)
+0:50              'g_tTex2di4' ( uniform itexture2DShadow)
 0:50              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:50            c2: direct index for structure ( uniform 2-component vector of float)
 0:50              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -331,7 +331,7 @@
 0:51          'txval024' ( temp 4-component vector of uint)
 0:51          textureGatherOffsets ( temp 4-component vector of uint)
 0:51            Construct combined texture-sampler ( temp usampler2DShadow)
-0:51              'g_tTex2du4' ( uniform utexture2D)
+0:51              'g_tTex2du4' ( uniform utexture2DShadow)
 0:51              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:51            c2: direct index for structure ( uniform 2-component vector of float)
 0:51              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -353,7 +353,7 @@
 0:53          'txval401' ( temp 4-component vector of float)
 0:53          textureGatherOffset ( temp 4-component vector of float)
 0:53            Construct combined texture-sampler ( temp sampler2DShadow)
-0:53              'g_tTex2df4' ( uniform texture2D)
+0:53              'g_tTex2df4' ( uniform texture2DShadow)
 0:53              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:53            c2: direct index for structure ( uniform 2-component vector of float)
 0:53              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -369,7 +369,7 @@
 0:54          'txval411' ( temp 4-component vector of int)
 0:54          textureGatherOffset ( temp 4-component vector of int)
 0:54            Construct combined texture-sampler ( temp isampler2DShadow)
-0:54              'g_tTex2di4' ( uniform itexture2D)
+0:54              'g_tTex2di4' ( uniform itexture2DShadow)
 0:54              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:54            c2: direct index for structure ( uniform 2-component vector of float)
 0:54              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -385,7 +385,7 @@
 0:55          'txval421' ( temp 4-component vector of uint)
 0:55          textureGatherOffset ( temp 4-component vector of uint)
 0:55            Construct combined texture-sampler ( temp usampler2DShadow)
-0:55              'g_tTex2du4' ( uniform utexture2D)
+0:55              'g_tTex2du4' ( uniform utexture2DShadow)
 0:55              'g_sSampCmp' (layout( binding=0) uniform sampler)
 0:55            c2: direct index for structure ( uniform 2-component vector of float)
 0:55              'anon@0' (layout( row_major std140) uniform block{ uniform float c1,  uniform 2-component vector of float c2,  uniform 3-component vector of float c3,  uniform 4-component vector of float c4})
@@ -440,9 +440,9 @@
 0:?     'g_tTex1df4' (layout( binding=0) uniform texture1D)
 0:?     'g_tTex1di4' ( uniform itexture1D)
 0:?     'g_tTex1du4' ( uniform utexture1D)
-0:?     'g_tTex2df4' ( uniform texture2D)
-0:?     'g_tTex2di4' ( uniform itexture2D)
-0:?     'g_tTex2du4' ( uniform utexture2D)
+0:?     'g_tTex2df4' ( uniform texture2DShadow)
+0:?     'g_tTex2di4' ( uniform itexture2DShadow)
+0:?     'g_tTex2du4' ( uniform utexture2DShadow)
 0:?     'g_tTex3df4' ( uniform texture3D)
 0:?     'g_tTex3di4' ( uniform itexture3D)
 0:?     'g_tTex3du4' ( uniform utexture3D)
@@ -455,13 +455,13 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 167
+// Id's are bound by 164
 
                               Capability Shader
                               Capability Sampled1D
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 132 136
+                              EntryPoint Fragment 4  "main" 129 133
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -472,61 +472,61 @@
                               Name 13  "txval001"
                               Name 16  "g_tTex2df4"
                               Name 20  "g_sSampCmp"
-                              Name 27  "$Global"
-                              MemberName 27($Global) 0  "c1"
-                              MemberName 27($Global) 1  "c2"
-                              MemberName 27($Global) 2  "c3"
-                              MemberName 27($Global) 3  "c4"
-                              Name 29  ""
-                              Name 42  "txval011"
-                              Name 45  "g_tTex2di4"
-                              Name 59  "txval021"
-                              Name 62  "g_tTex2du4"
-                              Name 72  "txval004"
-                              Name 82  "txval014"
-                              Name 90  "txval024"
-                              Name 98  "txval401"
-                              Name 105  "txval411"
-                              Name 112  "txval421"
-                              Name 120  "psout"
-                              Name 129  "flattenTemp"
-                              Name 132  "@entryPointOutput.Color"
-                              Name 136  "@entryPointOutput.Depth"
-                              Name 141  "g_tTex1df4a"
-                              Name 142  "g_tTex1df4"
-                              Name 145  "g_tTex1di4"
-                              Name 148  "g_tTex1du4"
-                              Name 151  "g_tTex3df4"
-                              Name 154  "g_tTex3di4"
-                              Name 157  "g_tTex3du4"
-                              Name 160  "g_tTexcdf4"
-                              Name 163  "g_tTexcdi4"
-                              Name 166  "g_tTexcdu4"
+                              Name 26  "$Global"
+                              MemberName 26($Global) 0  "c1"
+                              MemberName 26($Global) 1  "c2"
+                              MemberName 26($Global) 2  "c3"
+                              MemberName 26($Global) 3  "c4"
+                              Name 28  ""
+                              Name 41  "txval011"
+                              Name 44  "g_tTex2di4"
+                              Name 57  "txval021"
+                              Name 60  "g_tTex2du4"
+                              Name 69  "txval004"
+                              Name 79  "txval014"
+                              Name 87  "txval024"
+                              Name 95  "txval401"
+                              Name 102  "txval411"
+                              Name 109  "txval421"
+                              Name 117  "psout"
+                              Name 126  "flattenTemp"
+                              Name 129  "@entryPointOutput.Color"
+                              Name 133  "@entryPointOutput.Depth"
+                              Name 138  "g_tTex1df4a"
+                              Name 139  "g_tTex1df4"
+                              Name 142  "g_tTex1di4"
+                              Name 145  "g_tTex1du4"
+                              Name 148  "g_tTex3df4"
+                              Name 151  "g_tTex3di4"
+                              Name 154  "g_tTex3du4"
+                              Name 157  "g_tTexcdf4"
+                              Name 160  "g_tTexcdi4"
+                              Name 163  "g_tTexcdu4"
                               Decorate 16(g_tTex2df4) DescriptorSet 0
                               Decorate 20(g_sSampCmp) DescriptorSet 0
                               Decorate 20(g_sSampCmp) Binding 0
-                              MemberDecorate 27($Global) 0 Offset 0
-                              MemberDecorate 27($Global) 1 Offset 8
-                              MemberDecorate 27($Global) 2 Offset 16
-                              MemberDecorate 27($Global) 3 Offset 32
-                              Decorate 27($Global) Block
-                              Decorate 29 DescriptorSet 0
-                              Decorate 45(g_tTex2di4) DescriptorSet 0
-                              Decorate 62(g_tTex2du4) DescriptorSet 0
-                              Decorate 132(@entryPointOutput.Color) Location 0
-                              Decorate 136(@entryPointOutput.Depth) BuiltIn FragDepth
-                              Decorate 141(g_tTex1df4a) DescriptorSet 0
-                              Decorate 141(g_tTex1df4a) Binding 1
-                              Decorate 142(g_tTex1df4) DescriptorSet 0
-                              Decorate 142(g_tTex1df4) Binding 0
-                              Decorate 145(g_tTex1di4) DescriptorSet 0
-                              Decorate 148(g_tTex1du4) DescriptorSet 0
-                              Decorate 151(g_tTex3df4) DescriptorSet 0
-                              Decorate 154(g_tTex3di4) DescriptorSet 0
-                              Decorate 157(g_tTex3du4) DescriptorSet 0
-                              Decorate 160(g_tTexcdf4) DescriptorSet 0
-                              Decorate 163(g_tTexcdi4) DescriptorSet 0
-                              Decorate 166(g_tTexcdu4) DescriptorSet 0
+                              MemberDecorate 26($Global) 0 Offset 0
+                              MemberDecorate 26($Global) 1 Offset 8
+                              MemberDecorate 26($Global) 2 Offset 16
+                              MemberDecorate 26($Global) 3 Offset 32
+                              Decorate 26($Global) Block
+                              Decorate 28 DescriptorSet 0
+                              Decorate 44(g_tTex2di4) DescriptorSet 0
+                              Decorate 60(g_tTex2du4) DescriptorSet 0
+                              Decorate 129(@entryPointOutput.Color) Location 0
+                              Decorate 133(@entryPointOutput.Depth) BuiltIn FragDepth
+                              Decorate 138(g_tTex1df4a) DescriptorSet 0
+                              Decorate 138(g_tTex1df4a) Binding 1
+                              Decorate 139(g_tTex1df4) DescriptorSet 0
+                              Decorate 139(g_tTex1df4) Binding 0
+                              Decorate 142(g_tTex1di4) DescriptorSet 0
+                              Decorate 145(g_tTex1du4) DescriptorSet 0
+                              Decorate 148(g_tTex3df4) DescriptorSet 0
+                              Decorate 151(g_tTex3di4) DescriptorSet 0
+                              Decorate 154(g_tTex3du4) DescriptorSet 0
+                              Decorate 157(g_tTexcdf4) DescriptorSet 0
+                              Decorate 160(g_tTexcdi4) DescriptorSet 0
+                              Decorate 163(g_tTexcdu4) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -534,177 +534,174 @@
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
                9:             TypeFunction 8(PS_OUTPUT)
               12:             TypePointer Function 7(fvec4)
-              14:             TypeImage 6(float) 2D sampled format:Unknown
+              14:             TypeImage 6(float) 2D depth sampled format:Unknown
               15:             TypePointer UniformConstant 14
   16(g_tTex2df4):     15(ptr) Variable UniformConstant
               18:             TypeSampler
               19:             TypePointer UniformConstant 18
   20(g_sSampCmp):     19(ptr) Variable UniformConstant
-              22:             TypeImage 6(float) 2D depth sampled format:Unknown
-              23:             TypeSampledImage 22
-              25:             TypeVector 6(float) 2
-              26:             TypeVector 6(float) 3
-     27($Global):             TypeStruct 6(float) 25(fvec2) 26(fvec3) 7(fvec4)
-              28:             TypePointer Uniform 27($Global)
-              29:     28(ptr) Variable Uniform
-              30:             TypeInt 32 1
-              31:     30(int) Constant 1
-              32:             TypePointer Uniform 25(fvec2)
-              35:    6(float) Constant 1061158912
-              36:             TypeVector 30(int) 2
-              37:     30(int) Constant 0
-              38:   36(ivec2) ConstantComposite 31 37
-              40:             TypeVector 30(int) 4
-              41:             TypePointer Function 40(ivec4)
-              43:             TypeImage 30(int) 2D sampled format:Unknown
-              44:             TypePointer UniformConstant 43
-  45(g_tTex2di4):     44(ptr) Variable UniformConstant
-              48:             TypeImage 30(int) 2D depth sampled format:Unknown
-              49:             TypeSampledImage 48
-              53:     30(int) Constant 4294967295
-              54:   36(ivec2) ConstantComposite 31 53
-              56:             TypeInt 32 0
-              57:             TypeVector 56(int) 4
-              58:             TypePointer Function 57(ivec4)
-              60:             TypeImage 56(int) 2D sampled format:Unknown
-              61:             TypePointer UniformConstant 60
-  62(g_tTex2du4):     61(ptr) Variable UniformConstant
-              65:             TypeImage 56(int) 2D depth sampled format:Unknown
-              66:             TypeSampledImage 65
-              70:   36(ivec2) ConstantComposite 31 31
-              78:     56(int) Constant 4
-              79:             TypeArray 36(ivec2) 78
-              80:          79 ConstantComposite 38 38 38 38
-              88:          79 ConstantComposite 54 54 54 54
-              96:          79 ConstantComposite 70 70 70 70
-             119:             TypePointer Function 8(PS_OUTPUT)
-             121:    6(float) Constant 1065353216
-             122:    7(fvec4) ConstantComposite 121 121 121 121
-             124:             TypePointer Function 6(float)
-             131:             TypePointer Output 7(fvec4)
-132(@entryPointOutput.Color):    131(ptr) Variable Output
-             135:             TypePointer Output 6(float)
-136(@entryPointOutput.Depth):    135(ptr) Variable Output
-             139:             TypeImage 6(float) 1D sampled format:Unknown
-             140:             TypePointer UniformConstant 139
-141(g_tTex1df4a):    140(ptr) Variable UniformConstant
- 142(g_tTex1df4):    140(ptr) Variable UniformConstant
-             143:             TypeImage 30(int) 1D sampled format:Unknown
+              22:             TypeSampledImage 14
+              24:             TypeVector 6(float) 2
+              25:             TypeVector 6(float) 3
+     26($Global):             TypeStruct 6(float) 24(fvec2) 25(fvec3) 7(fvec4)
+              27:             TypePointer Uniform 26($Global)
+              28:     27(ptr) Variable Uniform
+              29:             TypeInt 32 1
+              30:     29(int) Constant 1
+              31:             TypePointer Uniform 24(fvec2)
+              34:    6(float) Constant 1061158912
+              35:             TypeVector 29(int) 2
+              36:     29(int) Constant 0
+              37:   35(ivec2) ConstantComposite 30 36
+              39:             TypeVector 29(int) 4
+              40:             TypePointer Function 39(ivec4)
+              42:             TypeImage 29(int) 2D depth sampled format:Unknown
+              43:             TypePointer UniformConstant 42
+  44(g_tTex2di4):     43(ptr) Variable UniformConstant
+              47:             TypeSampledImage 42
+              51:     29(int) Constant 4294967295
+              52:   35(ivec2) ConstantComposite 30 51
+              54:             TypeInt 32 0
+              55:             TypeVector 54(int) 4
+              56:             TypePointer Function 55(ivec4)
+              58:             TypeImage 54(int) 2D depth sampled format:Unknown
+              59:             TypePointer UniformConstant 58
+  60(g_tTex2du4):     59(ptr) Variable UniformConstant
+              63:             TypeSampledImage 58
+              67:   35(ivec2) ConstantComposite 30 30
+              75:     54(int) Constant 4
+              76:             TypeArray 35(ivec2) 75
+              77:          76 ConstantComposite 37 37 37 37
+              85:          76 ConstantComposite 52 52 52 52
+              93:          76 ConstantComposite 67 67 67 67
+             116:             TypePointer Function 8(PS_OUTPUT)
+             118:    6(float) Constant 1065353216
+             119:    7(fvec4) ConstantComposite 118 118 118 118
+             121:             TypePointer Function 6(float)
+             128:             TypePointer Output 7(fvec4)
+129(@entryPointOutput.Color):    128(ptr) Variable Output
+             132:             TypePointer Output 6(float)
+133(@entryPointOutput.Depth):    132(ptr) Variable Output
+             136:             TypeImage 6(float) 1D sampled format:Unknown
+             137:             TypePointer UniformConstant 136
+138(g_tTex1df4a):    137(ptr) Variable UniformConstant
+ 139(g_tTex1df4):    137(ptr) Variable UniformConstant
+             140:             TypeImage 29(int) 1D sampled format:Unknown
+             141:             TypePointer UniformConstant 140
+ 142(g_tTex1di4):    141(ptr) Variable UniformConstant
+             143:             TypeImage 54(int) 1D sampled format:Unknown
              144:             TypePointer UniformConstant 143
- 145(g_tTex1di4):    144(ptr) Variable UniformConstant
-             146:             TypeImage 56(int) 1D sampled format:Unknown
+ 145(g_tTex1du4):    144(ptr) Variable UniformConstant
+             146:             TypeImage 6(float) 3D sampled format:Unknown
              147:             TypePointer UniformConstant 146
- 148(g_tTex1du4):    147(ptr) Variable UniformConstant
-             149:             TypeImage 6(float) 3D sampled format:Unknown
+ 148(g_tTex3df4):    147(ptr) Variable UniformConstant
+             149:             TypeImage 29(int) 3D sampled format:Unknown
              150:             TypePointer UniformConstant 149
- 151(g_tTex3df4):    150(ptr) Variable UniformConstant
-             152:             TypeImage 30(int) 3D sampled format:Unknown
+ 151(g_tTex3di4):    150(ptr) Variable UniformConstant
+             152:             TypeImage 54(int) 3D sampled format:Unknown
              153:             TypePointer UniformConstant 152
- 154(g_tTex3di4):    153(ptr) Variable UniformConstant
-             155:             TypeImage 56(int) 3D sampled format:Unknown
+ 154(g_tTex3du4):    153(ptr) Variable UniformConstant
+             155:             TypeImage 6(float) Cube sampled format:Unknown
              156:             TypePointer UniformConstant 155
- 157(g_tTex3du4):    156(ptr) Variable UniformConstant
-             158:             TypeImage 6(float) Cube sampled format:Unknown
+ 157(g_tTexcdf4):    156(ptr) Variable UniformConstant
+             158:             TypeImage 29(int) Cube sampled format:Unknown
              159:             TypePointer UniformConstant 158
- 160(g_tTexcdf4):    159(ptr) Variable UniformConstant
-             161:             TypeImage 30(int) Cube sampled format:Unknown
+ 160(g_tTexcdi4):    159(ptr) Variable UniformConstant
+             161:             TypeImage 54(int) Cube sampled format:Unknown
              162:             TypePointer UniformConstant 161
- 163(g_tTexcdi4):    162(ptr) Variable UniformConstant
-             164:             TypeImage 56(int) Cube sampled format:Unknown
-             165:             TypePointer UniformConstant 164
- 166(g_tTexcdu4):    165(ptr) Variable UniformConstant
+ 163(g_tTexcdu4):    162(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
-129(flattenTemp):    119(ptr) Variable Function
-             130:8(PS_OUTPUT) FunctionCall 10(@main()
-                              Store 129(flattenTemp) 130
-             133:     12(ptr) AccessChain 129(flattenTemp) 37
-             134:    7(fvec4) Load 133
-                              Store 132(@entryPointOutput.Color) 134
-             137:    124(ptr) AccessChain 129(flattenTemp) 31
-             138:    6(float) Load 137
-                              Store 136(@entryPointOutput.Depth) 138
+126(flattenTemp):    116(ptr) Variable Function
+             127:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 126(flattenTemp) 127
+             130:     12(ptr) AccessChain 126(flattenTemp) 36
+             131:    7(fvec4) Load 130
+                              Store 129(@entryPointOutput.Color) 131
+             134:    121(ptr) AccessChain 126(flattenTemp) 30
+             135:    6(float) Load 134
+                              Store 133(@entryPointOutput.Depth) 135
                               Return
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
     13(txval001):     12(ptr) Variable Function
-    42(txval011):     41(ptr) Variable Function
-    59(txval021):     58(ptr) Variable Function
-    72(txval004):     12(ptr) Variable Function
-    82(txval014):     41(ptr) Variable Function
-    90(txval024):     58(ptr) Variable Function
-    98(txval401):     12(ptr) Variable Function
-   105(txval411):     41(ptr) Variable Function
-   112(txval421):     58(ptr) Variable Function
-      120(psout):    119(ptr) Variable Function
+    41(txval011):     40(ptr) Variable Function
+    57(txval021):     56(ptr) Variable Function
+    69(txval004):     12(ptr) Variable Function
+    79(txval014):     40(ptr) Variable Function
+    87(txval024):     56(ptr) Variable Function
+    95(txval401):     12(ptr) Variable Function
+   102(txval411):     40(ptr) Variable Function
+   109(txval421):     56(ptr) Variable Function
+      117(psout):    116(ptr) Variable Function
               17:          14 Load 16(g_tTex2df4)
               21:          18 Load 20(g_sSampCmp)
-              24:          23 SampledImage 17 21
-              33:     32(ptr) AccessChain 29 31
-              34:   25(fvec2) Load 33
-              39:    7(fvec4) ImageDrefGather 24 34 35 ConstOffset 38
-                              Store 13(txval001) 39
-              46:          43 Load 45(g_tTex2di4)
-              47:          18 Load 20(g_sSampCmp)
-              50:          49 SampledImage 46 47
-              51:     32(ptr) AccessChain 29 31
-              52:   25(fvec2) Load 51
-              55:   40(ivec4) ImageDrefGather 50 52 35 ConstOffset 54
-                              Store 42(txval011) 55
-              63:          60 Load 62(g_tTex2du4)
-              64:          18 Load 20(g_sSampCmp)
-              67:          66 SampledImage 63 64
-              68:     32(ptr) AccessChain 29 31
-              69:   25(fvec2) Load 68
-              71:   57(ivec4) ImageDrefGather 67 69 35 ConstOffset 70
-                              Store 59(txval021) 71
-              73:          14 Load 16(g_tTex2df4)
-              74:          18 Load 20(g_sSampCmp)
-              75:          23 SampledImage 73 74
-              76:     32(ptr) AccessChain 29 31
-              77:   25(fvec2) Load 76
-              81:    7(fvec4) ImageDrefGather 75 77 35 ConstOffsets 80
-                              Store 72(txval004) 81
-              83:          43 Load 45(g_tTex2di4)
-              84:          18 Load 20(g_sSampCmp)
-              85:          49 SampledImage 83 84
-              86:     32(ptr) AccessChain 29 31
-              87:   25(fvec2) Load 86
-              89:   40(ivec4) ImageDrefGather 85 87 35 ConstOffsets 88
-                              Store 82(txval014) 89
-              91:          60 Load 62(g_tTex2du4)
-              92:          18 Load 20(g_sSampCmp)
-              93:          66 SampledImage 91 92
-              94:     32(ptr) AccessChain 29 31
-              95:   25(fvec2) Load 94
-              97:   57(ivec4) ImageDrefGather 93 95 35 ConstOffsets 96
-                              Store 90(txval024) 97
-              99:          14 Load 16(g_tTex2df4)
-             100:          18 Load 20(g_sSampCmp)
-             101:          23 SampledImage 99 100
-             102:     32(ptr) AccessChain 29 31
-             103:   25(fvec2) Load 102
-             104:    7(fvec4) ImageDrefGather 101 103 35 ConstOffset 38
-                              Store 98(txval401) 104
-             106:          43 Load 45(g_tTex2di4)
-             107:          18 Load 20(g_sSampCmp)
-             108:          49 SampledImage 106 107
-             109:     32(ptr) AccessChain 29 31
-             110:   25(fvec2) Load 109
-             111:   40(ivec4) ImageDrefGather 108 110 35 ConstOffset 54
-                              Store 105(txval411) 111
-             113:          60 Load 62(g_tTex2du4)
-             114:          18 Load 20(g_sSampCmp)
-             115:          66 SampledImage 113 114
-             116:     32(ptr) AccessChain 29 31
-             117:   25(fvec2) Load 116
-             118:   57(ivec4) ImageDrefGather 115 117 35 ConstOffset 70
-                              Store 112(txval421) 118
-             123:     12(ptr) AccessChain 120(psout) 37
-                              Store 123 122
-             125:    124(ptr) AccessChain 120(psout) 31
-                              Store 125 121
-             126:8(PS_OUTPUT) Load 120(psout)
-                              ReturnValue 126
+              23:          22 SampledImage 17 21
+              32:     31(ptr) AccessChain 28 30
+              33:   24(fvec2) Load 32
+              38:    7(fvec4) ImageDrefGather 23 33 34 ConstOffset 37
+                              Store 13(txval001) 38
+              45:          42 Load 44(g_tTex2di4)
+              46:          18 Load 20(g_sSampCmp)
+              48:          47 SampledImage 45 46
+              49:     31(ptr) AccessChain 28 30
+              50:   24(fvec2) Load 49
+              53:   39(ivec4) ImageDrefGather 48 50 34 ConstOffset 52
+                              Store 41(txval011) 53
+              61:          58 Load 60(g_tTex2du4)
+              62:          18 Load 20(g_sSampCmp)
+              64:          63 SampledImage 61 62
+              65:     31(ptr) AccessChain 28 30
+              66:   24(fvec2) Load 65
+              68:   55(ivec4) ImageDrefGather 64 66 34 ConstOffset 67
+                              Store 57(txval021) 68
+              70:          14 Load 16(g_tTex2df4)
+              71:          18 Load 20(g_sSampCmp)
+              72:          22 SampledImage 70 71
+              73:     31(ptr) AccessChain 28 30
+              74:   24(fvec2) Load 73
+              78:    7(fvec4) ImageDrefGather 72 74 34 ConstOffsets 77
+                              Store 69(txval004) 78
+              80:          42 Load 44(g_tTex2di4)
+              81:          18 Load 20(g_sSampCmp)
+              82:          47 SampledImage 80 81
+              83:     31(ptr) AccessChain 28 30
+              84:   24(fvec2) Load 83
+              86:   39(ivec4) ImageDrefGather 82 84 34 ConstOffsets 85
+                              Store 79(txval014) 86
+              88:          58 Load 60(g_tTex2du4)
+              89:          18 Load 20(g_sSampCmp)
+              90:          63 SampledImage 88 89
+              91:     31(ptr) AccessChain 28 30
+              92:   24(fvec2) Load 91
+              94:   55(ivec4) ImageDrefGather 90 92 34 ConstOffsets 93
+                              Store 87(txval024) 94
+              96:          14 Load 16(g_tTex2df4)
+              97:          18 Load 20(g_sSampCmp)
+              98:          22 SampledImage 96 97
+              99:     31(ptr) AccessChain 28 30
+             100:   24(fvec2) Load 99
+             101:    7(fvec4) ImageDrefGather 98 100 34 ConstOffset 37
+                              Store 95(txval401) 101
+             103:          42 Load 44(g_tTex2di4)
+             104:          18 Load 20(g_sSampCmp)
+             105:          47 SampledImage 103 104
+             106:     31(ptr) AccessChain 28 30
+             107:   24(fvec2) Load 106
+             108:   39(ivec4) ImageDrefGather 105 107 34 ConstOffset 52
+                              Store 102(txval411) 108
+             110:          58 Load 60(g_tTex2du4)
+             111:          18 Load 20(g_sSampCmp)
+             112:          63 SampledImage 110 111
+             113:     31(ptr) AccessChain 28 30
+             114:   24(fvec2) Load 113
+             115:   55(ivec4) ImageDrefGather 112 114 34 ConstOffset 67
+                              Store 109(txval421) 115
+             120:     12(ptr) AccessChain 117(psout) 36
+                              Store 120 119
+             122:    121(ptr) AccessChain 117(psout) 30
+                              Store 122 118
+             123:8(PS_OUTPUT) Load 117(psout)
+                              ReturnValue 123
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.hull.1.tesc.out b/Test/baseResults/hlsl.hull.1.tesc.out
index 080bdd2..57020ee 100644
--- a/Test/baseResults/hlsl.hull.1.tesc.out
+++ b/Test/baseResults/hlsl.hull.1.tesc.out
@@ -32,7 +32,7 @@
 0:?         'm_cpid' ( temp uint)
 0:?         'm_cpid' ( in uint InvocationID)
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:26        indirect index (layout( location=0) out structure{ temp 3-component vector of float cpoint})
 0:?           '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'm_cpid' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
@@ -146,7 +146,7 @@
 0:?         'm_cpid' ( temp uint)
 0:?         'm_cpid' ( in uint InvocationID)
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:26        indirect index (layout( location=0) out structure{ temp 3-component vector of float cpoint})
 0:?           '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'm_cpid' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[4];u1; ( temp structure{ temp 3-component vector of float cpoint})
diff --git a/Test/baseResults/hlsl.hull.2.tesc.out b/Test/baseResults/hlsl.hull.2.tesc.out
index fb869c6..8d0708d 100644
--- a/Test/baseResults/hlsl.hull.2.tesc.out
+++ b/Test/baseResults/hlsl.hull.2.tesc.out
@@ -28,7 +28,7 @@
 0:?         'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:26        indirect index (layout( location=0) out structure{ temp 3-component vector of float cpoint})
 0:?           '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'InvocationId' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
@@ -140,7 +140,7 @@
 0:?         'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:26        indirect index (layout( location=0) out structure{ temp 3-component vector of float cpoint})
 0:?           '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'InvocationId' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
diff --git a/Test/baseResults/hlsl.hull.3.tesc.out b/Test/baseResults/hlsl.hull.3.tesc.out
index 3da2f86..59eed0d 100755
--- a/Test/baseResults/hlsl.hull.3.tesc.out
+++ b/Test/baseResults/hlsl.hull.3.tesc.out
@@ -28,7 +28,7 @@
 0:?         'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:26        indirect index (layout( location=0) out structure{ temp 3-component vector of float cpoint})
 0:?           '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'InvocationId' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
@@ -140,7 +140,7 @@
 0:?         'ip' ( temp 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 4-element array of structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:26        indirect index (layout( location=0) out structure{ temp 3-component vector of float cpoint})
 0:?           '@entryPointOutput' (layout( location=0) out 4-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'InvocationId' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[4]; ( temp structure{ temp 3-component vector of float cpoint})
diff --git a/Test/baseResults/hlsl.hull.4.tesc.out b/Test/baseResults/hlsl.hull.4.tesc.out
new file mode 100644
index 0000000..139d7d4
--- /dev/null
+++ b/Test/baseResults/hlsl.hull.4.tesc.out
@@ -0,0 +1,681 @@
+hlsl.hull.4.tesc
+Shader version: 500
+vertices = 3
+vertex spacing = fractional_odd_spacing
+triangle order = cw
+0:? Sequence
+0:25  Function Definition: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:25    Function Parameters: 
+0:25      'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?     Sequence
+0:26      Sequence
+0:26        move second child to first child ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:26          'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:26          Constant:
+0:26            0.000000
+0:26            0.000000
+0:26            0.000000
+0:26            0.000000
+0:28      move second child to first child ( temp float)
+0:28        fInsideTessFactor: direct index for structure ( temp float)
+0:28          'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:28          Constant:
+0:28            1 (const int)
+0:28        add ( temp float)
+0:28          direct index ( temp float)
+0:28            m_Position: direct index for structure ( temp 4-component vector of float)
+0:28              direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                Constant:
+0:28                  0 (const int)
+0:28              Constant:
+0:28                0 (const int)
+0:28            Constant:
+0:28              3 (const int)
+0:28          direct index ( temp float)
+0:28            m_Normal: direct index for structure ( temp 4-component vector of float)
+0:28              direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                Constant:
+0:28                  0 (const int)
+0:28              Constant:
+0:28                1 (const int)
+0:28            Constant:
+0:28              3 (const int)
+0:30      Branch: Return with expression
+0:30        'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:39  Function Definition: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position})
+0:39    Function Parameters: 
+0:39      'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39      'cpid' ( in uint)
+0:?     Sequence
+0:40      Sequence
+0:40        move second child to first child ( temp structure{ temp 4-component vector of float m_Position})
+0:40          'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:40          Constant:
+0:40            0.000000
+0:40            0.000000
+0:40            0.000000
+0:40            0.000000
+0:41      move second child to first child ( temp 4-component vector of float)
+0:41        m_Position: direct index for structure ( temp 4-component vector of float)
+0:41          'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:41          Constant:
+0:41            0 (const int)
+0:41        Constant:
+0:41          0.000000
+0:41          0.000000
+0:41          0.000000
+0:41          0.000000
+0:42      Branch: Return with expression
+0:42        'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:39  Function Definition: main( ( temp void)
+0:39    Function Parameters: 
+0:?     Sequence
+0:39      Sequence
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Position: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                0 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39          direct index ( in 4-component vector of float Position)
+0:?             'I.m_Position' ( in 3-element array of 4-component vector of float Position)
+0:39            Constant:
+0:39              0 (const int)
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                0 (const int)
+0:39            Constant:
+0:39              1 (const int)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
+0:39              'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                0 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Position: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                1 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39          direct index ( in 4-component vector of float Position)
+0:?             'I.m_Position' ( in 3-element array of 4-component vector of float Position)
+0:39            Constant:
+0:39              1 (const int)
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                1 (const int)
+0:39            Constant:
+0:39              1 (const int)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
+0:39              'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                1 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Position: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                2 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39          direct index ( in 4-component vector of float Position)
+0:?             'I.m_Position' ( in 3-element array of 4-component vector of float Position)
+0:39            Constant:
+0:39              2 (const int)
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                2 (const int)
+0:39            Constant:
+0:39              1 (const int)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
+0:39              'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                2 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39      move second child to first child ( temp uint)
+0:?         'cpid' ( temp uint)
+0:?         'cpid' ( in uint InvocationID)
+0:39      Sequence
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          direct index ( out 4-component vector of float Position)
+0:?             '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
+0:39            Constant:
+0:39              0 (const int)
+0:39          m_Position: direct index for structure ( temp 4-component vector of float)
+0:39            Function Call: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'cpid' ( temp uint)
+0:39            Constant:
+0:39              0 (const int)
+0:?       Barrier ( temp void)
+0:?       Test condition and select ( temp void)
+0:?         Condition
+0:?         Compare Equal ( temp bool)
+0:?           'cpid' ( 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 fTessFactor,  temp float fInsideTessFactor})
+0:?             '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:?             Function Call: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?           Sequence
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               direct index ( temp float)
+0:?                 fTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+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.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?               direct index ( temp float)
+0:?                 fTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+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.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?               direct index ( temp float)
+0:?                 fTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+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.fInsideTessFactor' ( patch out 2-element array of float TessLevelInner)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               fInsideTessFactor: direct index for structure ( temp float)
+0:?                 '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:?                 Constant:
+0:?                   1 (const int)
+0:?   Linker Objects
+0:?     '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
+0:?     'I.m_Position' ( in 3-element array of 4-component vector of float Position)
+0:?     'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
+0:?     'cpid' ( in uint InvocationID)
+0:?     '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput.fInsideTessFactor' ( patch out 2-element array of float TessLevelInner)
+
+
+Linked tessellation control stage:
+
+
+Shader version: 500
+vertices = 3
+vertex spacing = fractional_odd_spacing
+triangle order = cw
+0:? Sequence
+0:25  Function Definition: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:25    Function Parameters: 
+0:25      'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?     Sequence
+0:26      Sequence
+0:26        move second child to first child ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:26          'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:26          Constant:
+0:26            0.000000
+0:26            0.000000
+0:26            0.000000
+0:26            0.000000
+0:28      move second child to first child ( temp float)
+0:28        fInsideTessFactor: direct index for structure ( temp float)
+0:28          'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:28          Constant:
+0:28            1 (const int)
+0:28        add ( temp float)
+0:28          direct index ( temp float)
+0:28            m_Position: direct index for structure ( temp 4-component vector of float)
+0:28              direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                Constant:
+0:28                  0 (const int)
+0:28              Constant:
+0:28                0 (const int)
+0:28            Constant:
+0:28              3 (const int)
+0:28          direct index ( temp float)
+0:28            m_Normal: direct index for structure ( temp 4-component vector of float)
+0:28              direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                Constant:
+0:28                  0 (const int)
+0:28              Constant:
+0:28                1 (const int)
+0:28            Constant:
+0:28              3 (const int)
+0:30      Branch: Return with expression
+0:30        'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:39  Function Definition: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position})
+0:39    Function Parameters: 
+0:39      'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39      'cpid' ( in uint)
+0:?     Sequence
+0:40      Sequence
+0:40        move second child to first child ( temp structure{ temp 4-component vector of float m_Position})
+0:40          'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:40          Constant:
+0:40            0.000000
+0:40            0.000000
+0:40            0.000000
+0:40            0.000000
+0:41      move second child to first child ( temp 4-component vector of float)
+0:41        m_Position: direct index for structure ( temp 4-component vector of float)
+0:41          'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:41          Constant:
+0:41            0 (const int)
+0:41        Constant:
+0:41          0.000000
+0:41          0.000000
+0:41          0.000000
+0:41          0.000000
+0:42      Branch: Return with expression
+0:42        'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:39  Function Definition: main( ( temp void)
+0:39    Function Parameters: 
+0:?     Sequence
+0:39      Sequence
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Position: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                0 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39          direct index ( in 4-component vector of float Position)
+0:?             'I.m_Position' ( in 3-element array of 4-component vector of float Position)
+0:39            Constant:
+0:39              0 (const int)
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                0 (const int)
+0:39            Constant:
+0:39              1 (const int)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
+0:39              'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                0 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Position: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                1 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39          direct index ( in 4-component vector of float Position)
+0:?             'I.m_Position' ( in 3-element array of 4-component vector of float Position)
+0:39            Constant:
+0:39              1 (const int)
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                1 (const int)
+0:39            Constant:
+0:39              1 (const int)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
+0:39              'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                1 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Position: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                2 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39          direct index ( in 4-component vector of float Position)
+0:?             'I.m_Position' ( in 3-element array of 4-component vector of float Position)
+0:39            Constant:
+0:39              2 (const int)
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                2 (const int)
+0:39            Constant:
+0:39              1 (const int)
+0:39          m_Normal: direct index for structure ( temp 4-component vector of float)
+0:39            direct index (layout( location=0) in structure{ temp 4-component vector of float m_Normal})
+0:39              'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
+0:39              Constant:
+0:39                2 (const int)
+0:39            Constant:
+0:39              0 (const int)
+0:39      move second child to first child ( temp uint)
+0:?         'cpid' ( temp uint)
+0:?         'cpid' ( in uint InvocationID)
+0:39      Sequence
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          direct index ( out 4-component vector of float Position)
+0:?             '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
+0:39            Constant:
+0:39              0 (const int)
+0:39          m_Position: direct index for structure ( temp 4-component vector of float)
+0:39            Function Call: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?               'cpid' ( temp uint)
+0:39            Constant:
+0:39              0 (const int)
+0:?       Barrier ( temp void)
+0:?       Test condition and select ( temp void)
+0:?         Condition
+0:?         Compare Equal ( temp bool)
+0:?           'cpid' ( 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 fTessFactor,  temp float fInsideTessFactor})
+0:?             '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:?             Function Call: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:?               'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?           Sequence
+0:?             move second child to first child ( temp float)
+0:?               direct index ( patch out float TessLevelOuter)
+0:?                 '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               direct index ( temp float)
+0:?                 fTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+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.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   1 (const int)
+0:?               direct index ( temp float)
+0:?                 fTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+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.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?                 Constant:
+0:?                   2 (const int)
+0:?               direct index ( temp float)
+0:?                 fTessFactor: direct index for structure ( temp 3-element array of float)
+0:?                   '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+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.fInsideTessFactor' ( patch out 2-element array of float TessLevelInner)
+0:?                 Constant:
+0:?                   0 (const int)
+0:?               fInsideTessFactor: direct index for structure ( temp float)
+0:?                 '@patchConstantResult' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:?                 Constant:
+0:?                   1 (const int)
+0:?   Linker Objects
+0:?     '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
+0:?     'I.m_Position' ( in 3-element array of 4-component vector of float Position)
+0:?     'I' (layout( location=0) in 3-element array of structure{ temp 4-component vector of float m_Normal})
+0:?     'cpid' ( in uint InvocationID)
+0:?     '@patchConstantOutput.fTessFactor' ( patch out 4-element array of float TessLevelOuter)
+0:?     '@patchConstantOutput.fInsideTessFactor' ( patch out 2-element array of float TessLevelInner)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 127
+
+                              Capability Tessellation
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint TessellationControl 4  "main" 56 64 83 86 110 123
+                              ExecutionMode 4 OutputVertices 3
+                              ExecutionMode 4 Triangles
+                              ExecutionMode 4 SpacingFractionalOdd
+                              ExecutionMode 4 VertexOrderCw
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 8  "HS_Input"
+                              MemberName 8(HS_Input) 0  "m_Position"
+                              MemberName 8(HS_Input) 1  "m_Normal"
+                              Name 14  "HS_Output"
+                              MemberName 14(HS_Output) 0  "fTessFactor"
+                              MemberName 14(HS_Output) 1  "fInsideTessFactor"
+                              Name 17  "HS_ConstFunc(struct-HS_Input-vf4-vf41[3];"
+                              Name 16  "I"
+                              Name 20  "HS_Main_Output"
+                              MemberName 20(HS_Main_Output) 0  "m_Position"
+                              Name 24  "@main(struct-HS_Input-vf4-vf41[3];u1;"
+                              Name 22  "I"
+                              Name 23  "cpid"
+                              Name 27  "O"
+                              Name 45  "output"
+                              Name 53  "I"
+                              Name 56  "I.m_Position"
+                              Name 61  "HS_Input"
+                              MemberName 61(HS_Input) 0  "m_Normal"
+                              Name 64  "I"
+                              Name 81  "cpid"
+                              Name 83  "cpid"
+                              Name 86  "@entryPointOutput.m_Position"
+                              Name 87  "param"
+                              Name 89  "param"
+                              Name 103  "@patchConstantResult"
+                              Name 104  "param"
+                              Name 110  "@patchConstantOutput.fTessFactor"
+                              Name 123  "@patchConstantOutput.fInsideTessFactor"
+                              Decorate 56(I.m_Position) BuiltIn Position
+                              Decorate 64(I) Location 0
+                              Decorate 83(cpid) BuiltIn InvocationId
+                              Decorate 86(@entryPointOutput.m_Position) BuiltIn Position
+                              Decorate 110(@patchConstantOutput.fTessFactor) Patch
+                              Decorate 110(@patchConstantOutput.fTessFactor) BuiltIn TessLevelOuter
+                              Decorate 123(@patchConstantOutput.fInsideTessFactor) Patch
+                              Decorate 123(@patchConstantOutput.fInsideTessFactor) BuiltIn TessLevelInner
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+     8(HS_Input):             TypeStruct 7(fvec4) 7(fvec4)
+               9:             TypeInt 32 0
+              10:      9(int) Constant 3
+              11:             TypeArray 8(HS_Input) 10
+              12:             TypePointer Function 11
+              13:             TypeArray 6(float) 10
+   14(HS_Output):             TypeStruct 13 6(float)
+              15:             TypeFunction 14(HS_Output) 12(ptr)
+              19:             TypePointer Function 9(int)
+20(HS_Main_Output):             TypeStruct 7(fvec4)
+              21:             TypeFunction 20(HS_Main_Output) 12(ptr) 19(ptr)
+              26:             TypePointer Function 14(HS_Output)
+              28:    6(float) Constant 0
+              29:          13 ConstantComposite 28 28 28
+              30:14(HS_Output) ConstantComposite 29 28
+              31:             TypeInt 32 1
+              32:     31(int) Constant 1
+              33:     31(int) Constant 0
+              34:             TypePointer Function 6(float)
+              44:             TypePointer Function 20(HS_Main_Output)
+              46:    7(fvec4) ConstantComposite 28 28 28 28
+              47:20(HS_Main_Output) ConstantComposite 46
+              48:             TypePointer Function 7(fvec4)
+              54:             TypeArray 7(fvec4) 10
+              55:             TypePointer Input 54
+56(I.m_Position):     55(ptr) Variable Input
+              57:             TypePointer Input 7(fvec4)
+    61(HS_Input):             TypeStruct 7(fvec4)
+              62:             TypeArray 61(HS_Input) 10
+              63:             TypePointer Input 62
+           64(I):     63(ptr) Variable Input
+              74:     31(int) Constant 2
+              82:             TypePointer Input 9(int)
+        83(cpid):     82(ptr) Variable Input
+              85:             TypePointer Output 54
+86(@entryPointOutput.m_Position):     85(ptr) Variable Output
+              93:             TypePointer Output 7(fvec4)
+              95:      9(int) Constant 2
+              96:      9(int) Constant 1
+              97:      9(int) Constant 0
+              99:             TypeBool
+             107:      9(int) Constant 4
+             108:             TypeArray 6(float) 107
+             109:             TypePointer Output 108
+110(@patchConstantOutput.fTessFactor):    109(ptr) Variable Output
+             113:             TypePointer Output 6(float)
+             121:             TypeArray 6(float) 95
+             122:             TypePointer Output 121
+123(@patchConstantOutput.fInsideTessFactor):    122(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+           53(I):     12(ptr) Variable Function
+        81(cpid):     19(ptr) Variable Function
+       87(param):     12(ptr) Variable Function
+       89(param):     19(ptr) Variable Function
+103(@patchConstantResult):     26(ptr) Variable Function
+      104(param):     12(ptr) Variable Function
+              58:     57(ptr) AccessChain 56(I.m_Position) 33
+              59:    7(fvec4) Load 58
+              60:     48(ptr) AccessChain 53(I) 33 33
+                              Store 60 59
+              65:     57(ptr) AccessChain 64(I) 33 33
+              66:    7(fvec4) Load 65
+              67:     48(ptr) AccessChain 53(I) 33 32
+                              Store 67 66
+              68:     57(ptr) AccessChain 56(I.m_Position) 32
+              69:    7(fvec4) Load 68
+              70:     48(ptr) AccessChain 53(I) 32 33
+                              Store 70 69
+              71:     57(ptr) AccessChain 64(I) 32 33
+              72:    7(fvec4) Load 71
+              73:     48(ptr) AccessChain 53(I) 32 32
+                              Store 73 72
+              75:     57(ptr) AccessChain 56(I.m_Position) 74
+              76:    7(fvec4) Load 75
+              77:     48(ptr) AccessChain 53(I) 74 33
+                              Store 77 76
+              78:     57(ptr) AccessChain 64(I) 74 33
+              79:    7(fvec4) Load 78
+              80:     48(ptr) AccessChain 53(I) 74 32
+                              Store 80 79
+              84:      9(int) Load 83(cpid)
+                              Store 81(cpid) 84
+              88:          11 Load 53(I)
+                              Store 87(param) 88
+              90:      9(int) Load 81(cpid)
+                              Store 89(param) 90
+              91:20(HS_Main_Output) FunctionCall 24(@main(struct-HS_Input-vf4-vf41[3];u1;) 87(param) 89(param)
+              92:    7(fvec4) CompositeExtract 91 0
+              94:     93(ptr) AccessChain 86(@entryPointOutput.m_Position) 33
+                              Store 94 92
+                              ControlBarrier 95 96 97
+              98:      9(int) Load 83(cpid)
+             100:    99(bool) IEqual 98 33
+                              SelectionMerge 102 None
+                              BranchConditional 100 101 102
+             101:               Label
+             105:          11   Load 53(I)
+                                Store 104(param) 105
+             106:14(HS_Output)   FunctionCall 17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];) 104(param)
+                                Store 103(@patchConstantResult) 106
+             111:     34(ptr)   AccessChain 103(@patchConstantResult) 33 33
+             112:    6(float)   Load 111
+             114:    113(ptr)   AccessChain 110(@patchConstantOutput.fTessFactor) 33
+                                Store 114 112
+             115:     34(ptr)   AccessChain 103(@patchConstantResult) 33 32
+             116:    6(float)   Load 115
+             117:    113(ptr)   AccessChain 110(@patchConstantOutput.fTessFactor) 32
+                                Store 117 116
+             118:     34(ptr)   AccessChain 103(@patchConstantResult) 33 74
+             119:    6(float)   Load 118
+             120:    113(ptr)   AccessChain 110(@patchConstantOutput.fTessFactor) 74
+                                Store 120 119
+             124:     34(ptr)   AccessChain 103(@patchConstantResult) 32
+             125:    6(float)   Load 124
+             126:    113(ptr)   AccessChain 123(@patchConstantOutput.fInsideTessFactor) 33
+                                Store 126 125
+                                Branch 102
+             102:             Label
+                              Return
+                              FunctionEnd
+17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];):14(HS_Output) Function None 15
+           16(I):     12(ptr) FunctionParameter
+              18:             Label
+           27(O):     26(ptr) Variable Function
+                              Store 27(O) 30
+              35:     34(ptr) AccessChain 16(I) 33 33 10
+              36:    6(float) Load 35
+              37:     34(ptr) AccessChain 16(I) 33 32 10
+              38:    6(float) Load 37
+              39:    6(float) FAdd 36 38
+              40:     34(ptr) AccessChain 27(O) 32
+                              Store 40 39
+              41:14(HS_Output) Load 27(O)
+                              ReturnValue 41
+                              FunctionEnd
+24(@main(struct-HS_Input-vf4-vf41[3];u1;):20(HS_Main_Output) Function None 21
+           22(I):     12(ptr) FunctionParameter
+        23(cpid):     19(ptr) FunctionParameter
+              25:             Label
+      45(output):     44(ptr) Variable Function
+                              Store 45(output) 47
+              49:     48(ptr) AccessChain 45(output) 33
+                              Store 49 46
+              50:20(HS_Main_Output) Load 45(output)
+                              ReturnValue 50
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.hull.5.tesc.out b/Test/baseResults/hlsl.hull.5.tesc.out
new file mode 100644
index 0000000..3a42b52
--- /dev/null
+++ b/Test/baseResults/hlsl.hull.5.tesc.out
@@ -0,0 +1,190 @@
+hlsl.hull.5.tesc
+ERROR: 0:0: '' : unimplemented: PCF input patch without entry point input patch parameter 
+ERROR: 1 compilation errors.  No code generated.
+
+
+Shader version: 500
+vertices = 3
+vertex spacing = fractional_odd_spacing
+triangle order = cw
+ERROR: node is still EOpNull!
+0:25  Function Definition: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:25    Function Parameters: 
+0:25      'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?     Sequence
+0:26      Sequence
+0:26        move second child to first child ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:26          'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:26          Constant:
+0:26            0.000000
+0:26            0.000000
+0:26            0.000000
+0:26            0.000000
+0:28      move second child to first child ( temp float)
+0:28        fInsideTessFactor: direct index for structure ( temp float)
+0:28          'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:28          Constant:
+0:28            1 (const int)
+0:28        add ( temp float)
+0:28          direct index ( temp float)
+0:28            m_Position: direct index for structure ( temp 4-component vector of float)
+0:28              direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                Constant:
+0:28                  0 (const int)
+0:28              Constant:
+0:28                0 (const int)
+0:28            Constant:
+0:28              3 (const int)
+0:28          direct index ( temp float)
+0:28            m_Normal: direct index for structure ( temp 4-component vector of float)
+0:28              direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                Constant:
+0:28                  0 (const int)
+0:28              Constant:
+0:28                1 (const int)
+0:28            Constant:
+0:28              3 (const int)
+0:30      Branch: Return with expression
+0:30        'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:39  Function Definition: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
+0:39    Function Parameters: 
+0:39      'cpid' ( in uint)
+0:?     Sequence
+0:40      Sequence
+0:40        move second child to first child ( temp structure{ temp 4-component vector of float m_Position})
+0:40          'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:40          Constant:
+0:40            0.000000
+0:40            0.000000
+0:40            0.000000
+0:40            0.000000
+0:41      move second child to first child ( temp 4-component vector of float)
+0:41        m_Position: direct index for structure ( temp 4-component vector of float)
+0:41          'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:41          Constant:
+0:41            0 (const int)
+0:41        Constant:
+0:41          0.000000
+0:41          0.000000
+0:41          0.000000
+0:41          0.000000
+0:42      Branch: Return with expression
+0:42        'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:39  Function Definition: main( ( temp void)
+0:39    Function Parameters: 
+0:?     Sequence
+0:39      move second child to first child ( temp uint)
+0:?         'cpid' ( temp uint)
+0:?         'cpid' ( in uint InvocationID)
+0:39      Sequence
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          direct index ( out 4-component vector of float Position)
+0:?             '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
+0:39            Constant:
+0:39              0 (const int)
+0:39          m_Position: direct index for structure ( temp 4-component vector of float)
+0:39            Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
+0:?               'cpid' ( temp uint)
+0:39            Constant:
+0:39              0 (const int)
+0:?   Linker Objects
+0:?     '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
+0:?     'cpid' ( in uint InvocationID)
+
+
+Linked tessellation control stage:
+
+
+Shader version: 500
+vertices = 3
+vertex spacing = fractional_odd_spacing
+triangle order = cw
+ERROR: node is still EOpNull!
+0:25  Function Definition: HS_ConstFunc(struct-HS_Input-vf4-vf41[3]; ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:25    Function Parameters: 
+0:25      'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:?     Sequence
+0:26      Sequence
+0:26        move second child to first child ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:26          'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:26          Constant:
+0:26            0.000000
+0:26            0.000000
+0:26            0.000000
+0:26            0.000000
+0:28      move second child to first child ( temp float)
+0:28        fInsideTessFactor: direct index for structure ( temp float)
+0:28          'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:28          Constant:
+0:28            1 (const int)
+0:28        add ( temp float)
+0:28          direct index ( temp float)
+0:28            m_Position: direct index for structure ( temp 4-component vector of float)
+0:28              direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                Constant:
+0:28                  0 (const int)
+0:28              Constant:
+0:28                0 (const int)
+0:28            Constant:
+0:28              3 (const int)
+0:28          direct index ( temp float)
+0:28            m_Normal: direct index for structure ( temp 4-component vector of float)
+0:28              direct index ( temp structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                'I' ( in 3-element array of structure{ temp 4-component vector of float m_Position,  temp 4-component vector of float m_Normal})
+0:28                Constant:
+0:28                  0 (const int)
+0:28              Constant:
+0:28                1 (const int)
+0:28            Constant:
+0:28              3 (const int)
+0:30      Branch: Return with expression
+0:30        'O' ( temp structure{ temp 3-element array of float fTessFactor,  temp float fInsideTessFactor})
+0:39  Function Definition: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
+0:39    Function Parameters: 
+0:39      'cpid' ( in uint)
+0:?     Sequence
+0:40      Sequence
+0:40        move second child to first child ( temp structure{ temp 4-component vector of float m_Position})
+0:40          'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:40          Constant:
+0:40            0.000000
+0:40            0.000000
+0:40            0.000000
+0:40            0.000000
+0:41      move second child to first child ( temp 4-component vector of float)
+0:41        m_Position: direct index for structure ( temp 4-component vector of float)
+0:41          'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:41          Constant:
+0:41            0 (const int)
+0:41        Constant:
+0:41          0.000000
+0:41          0.000000
+0:41          0.000000
+0:41          0.000000
+0:42      Branch: Return with expression
+0:42        'output' ( temp structure{ temp 4-component vector of float m_Position})
+0:39  Function Definition: main( ( temp void)
+0:39    Function Parameters: 
+0:?     Sequence
+0:39      move second child to first child ( temp uint)
+0:?         'cpid' ( temp uint)
+0:?         'cpid' ( in uint InvocationID)
+0:39      Sequence
+0:39        move second child to first child ( temp 4-component vector of float)
+0:39          direct index ( out 4-component vector of float Position)
+0:?             '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
+0:39            Constant:
+0:39              0 (const int)
+0:39          m_Position: direct index for structure ( temp 4-component vector of float)
+0:39            Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
+0:?               'cpid' ( temp uint)
+0:39            Constant:
+0:39              0 (const int)
+0:?   Linker Objects
+0:?     '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
+0:?     'cpid' ( in uint InvocationID)
+
+SPIR-V is not generated for failed compile or link
diff --git a/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out b/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out
index 1c62925..24e4aa7 100644
--- a/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out
+++ b/Test/baseResults/hlsl.hull.ctrlpt-1.tesc.out
@@ -29,7 +29,7 @@
 0:?         'cpid' ( temp uint)
 0:?         'cpid' ( in uint InvocationID)
 0:27      move second child to first child ( temp structure{ temp 3-component vector of float val})
-0:27        indirect index ( temp structure{ temp 3-component vector of float val})
+0:27        indirect index (layout( location=0) out structure{ temp 3-component vector of float val})
 0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
 0:?           'cpid' ( in uint InvocationID)
 0:27        Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
@@ -229,7 +229,7 @@
 0:?         'cpid' ( temp uint)
 0:?         'cpid' ( in uint InvocationID)
 0:27      move second child to first child ( temp structure{ temp 3-component vector of float val})
-0:27        indirect index ( temp structure{ temp 3-component vector of float val})
+0:27        indirect index (layout( location=0) out structure{ temp 3-component vector of float val})
 0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
 0:?           'cpid' ( in uint InvocationID)
 0:27        Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
diff --git a/Test/baseResults/hlsl.hull.ctrlpt-2.tesc.out b/Test/baseResults/hlsl.hull.ctrlpt-2.tesc.out
index e8537c7..89582b7 100644
--- a/Test/baseResults/hlsl.hull.ctrlpt-2.tesc.out
+++ b/Test/baseResults/hlsl.hull.ctrlpt-2.tesc.out
@@ -36,7 +36,7 @@
 0:?         'cpid' ( temp uint)
 0:?         'cpid' ( in uint InvocationID)
 0:28      move second child to first child ( temp structure{ temp 3-component vector of float val})
-0:28        indirect index ( temp structure{ temp 3-component vector of float val})
+0:28        indirect index (layout( location=0) out structure{ temp 3-component vector of float val})
 0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
 0:?           'cpid' ( in uint InvocationID)
 0:28        Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
@@ -82,7 +82,7 @@
 0:?             '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
 0:?             Function Call: PCF(struct-hs_out_t-vf31[3];struct-hs_in_t-vf31[3]; ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
 0:?               'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
-0:?               'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val})
+0:?               'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
 0:?           Sequence
 0:?             move second child to first child ( temp float)
 0:?               direct index ( patch out float TessLevelOuter)
@@ -245,7 +245,7 @@
 0:?         'cpid' ( temp uint)
 0:?         'cpid' ( in uint InvocationID)
 0:28      move second child to first child ( temp structure{ temp 3-component vector of float val})
-0:28        indirect index ( temp structure{ temp 3-component vector of float val})
+0:28        indirect index (layout( location=0) out structure{ temp 3-component vector of float val})
 0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float val})
 0:?           'cpid' ( in uint InvocationID)
 0:28        Function Call: @main(struct-hs_in_t-vf31[3];u1; ( temp structure{ temp 3-component vector of float val})
@@ -291,7 +291,7 @@
 0:?             '@patchConstantResult' ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
 0:?             Function Call: PCF(struct-hs_out_t-vf31[3];struct-hs_in_t-vf31[3]; ( temp structure{ temp 3-element array of float tfactor,  temp float flInFactor})
 0:?               'pcf_out' ( temp 3-element array of structure{ temp 3-component vector of float val})
-0:?               'i' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float val})
+0:?               'i' ( temp 3-element array of structure{ temp 3-component vector of float val})
 0:?           Sequence
 0:?             move second child to first child ( temp float)
 0:?               direct index ( patch out float TessLevelOuter)
@@ -568,7 +568,7 @@
               87:     30(ptr)   AccessChain 67(pcf_out) 81
                                 Store 87 86
               90:          20   Load 67(pcf_out)
-              91:          11   Load 42(i)
+              91:          11   Load 40(i)
               92:22(hs_pcf_t)   FunctionCall 26(PCF(struct-hs_out_t-vf31[3];struct-hs_in_t-vf31[3];) 90 91
                                 Store 89(@patchConstantResult) 92
               98:     97(ptr)   AccessChain 89(@patchConstantResult) 29 29
diff --git a/Test/baseResults/hlsl.hull.void.tesc.out b/Test/baseResults/hlsl.hull.void.tesc.out
index 5b3e7dc..68524d9 100644
--- a/Test/baseResults/hlsl.hull.void.tesc.out
+++ b/Test/baseResults/hlsl.hull.void.tesc.out
@@ -29,7 +29,7 @@
 0:?         'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:26        indirect index (layout( location=0) out structure{ temp 3-component vector of float cpoint})
 0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'InvocationId' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
@@ -85,7 +85,7 @@
 0:?         'ip' ( temp 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?         'ip' (layout( location=0) in 3-element array of structure{ temp 3-component vector of float cpoint})
 0:26      move second child to first child ( temp structure{ temp 3-component vector of float cpoint})
-0:26        indirect index ( temp structure{ temp 3-component vector of float cpoint})
+0:26        indirect index (layout( location=0) out structure{ temp 3-component vector of float cpoint})
 0:?           '@entryPointOutput' (layout( location=0) out 3-element array of structure{ temp 3-component vector of float cpoint})
 0:?           'InvocationId' ( in uint InvocationID)
 0:26        Function Call: @main(struct-VS_OUT-vf31[3]; ( temp structure{ temp 3-component vector of float cpoint})
diff --git a/Test/baseResults/hlsl.localStructuredBuffer.comp.out b/Test/baseResults/hlsl.localStructuredBuffer.comp.out
new file mode 100644
index 0000000..98257f4
--- /dev/null
+++ b/Test/baseResults/hlsl.localStructuredBuffer.comp.out
@@ -0,0 +1,64 @@
+hlsl.localStructuredBuffer.comp
+Shader version: 500
+local_size = (1, 1, 1)
+0:? Sequence
+0:2  Function Definition: @main( ( temp void)
+0:2    Function Parameters: 
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      Function Call: @main( ( temp void)
+0:?   Linker Objects
+0:?     'srt0' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+
+
+Linked compute stage:
+
+
+Shader version: 500
+local_size = (1, 1, 1)
+0:? Sequence
+0:2  Function Definition: @main( ( temp void)
+0:2    Function Parameters: 
+0:2  Function Definition: main( ( temp void)
+0:2    Function Parameters: 
+0:?     Sequence
+0:2      Function Call: @main( ( temp void)
+0:?   Linker Objects
+0:?     'srt0' (layout( row_major std430) buffer block{layout( row_major std430) buffer implicitly-sized array of uint @data})
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 14
+
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint GLCompute 4  "main"
+                              ExecutionMode 4 LocalSize 1 1 1
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 6  "@main("
+                              Name 11  "srt0"
+                              MemberName 11(srt0) 0  "@data"
+                              Name 13  "srt0"
+                              Decorate 10 ArrayStride 4
+                              MemberDecorate 11(srt0) 0 Offset 0
+                              Decorate 11(srt0) BufferBlock
+                              Decorate 13(srt0) DescriptorSet 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               9:             TypeInt 32 0
+              10:             TypeRuntimeArray 9(int)
+        11(srt0):             TypeStruct 10
+              12:             TypePointer Uniform 11(srt0)
+        13(srt0):     12(ptr) Variable Uniform
+         4(main):           2 Function None 3
+               5:             Label
+               8:           2 FunctionCall 6(@main()
+                              Return
+                              FunctionEnd
+       6(@main():           2 Function None 3
+               7:             Label
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.opaque-type-bug.frag.out b/Test/baseResults/hlsl.opaque-type-bug.frag.out
index 6bc4886..95b39b3 100644
--- a/Test/baseResults/hlsl.opaque-type-bug.frag.out
+++ b/Test/baseResults/hlsl.opaque-type-bug.frag.out
@@ -59,7 +59,7 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 26
+// Id's are bound by 27
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
@@ -68,44 +68,45 @@
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
-                              Name 14  "TexFunc(t21;vf3;"
-                              Name 12  "t2D"
-                              Name 13  "RGB"
-                              Name 16  "@main("
+                              Name 13  "TexFunc(t21;vf3;"
+                              Name 11  "t2D"
+                              Name 12  "RGB"
+                              Name 15  "@main("
                               Name 20  "MyTexture"
-                              Name 21  "final_RGB"
-                              Name 22  "param"
+                              Name 22  "final_RGB"
+                              Name 23  "param"
                               Decorate 20(MyTexture) DescriptorSet 0
                               Decorate 20(MyTexture) Binding 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
                7:             TypeImage 6(float) 2D sampled format:Unknown
-               8:             TypePointer UniformConstant 7
-               9:             TypeVector 6(float) 3
-              10:             TypePointer Function 9(fvec3)
-              11:             TypeFunction 2 8(ptr) 10(ptr)
-              18:    6(float) Constant 0
-              19:    9(fvec3) ConstantComposite 18 18 18
-   20(MyTexture):      8(ptr) Variable UniformConstant
+               8:             TypeVector 6(float) 3
+               9:             TypePointer Function 8(fvec3)
+              10:             TypeFunction 2 7 9(ptr)
+              17:    6(float) Constant 0
+              18:    8(fvec3) ConstantComposite 17 17 17
+              19:             TypePointer UniformConstant 7
+   20(MyTexture):     19(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
-              25:           2 FunctionCall 16(@main()
+              26:           2 FunctionCall 15(@main()
                               Return
                               FunctionEnd
-14(TexFunc(t21;vf3;):           2 Function None 11
-         12(t2D):      8(ptr) FunctionParameter
-         13(RGB):     10(ptr) FunctionParameter
-              15:             Label
-                              Store 13(RGB) 19
+13(TexFunc(t21;vf3;):           2 Function None 10
+         11(t2D):           7 FunctionParameter
+         12(RGB):      9(ptr) FunctionParameter
+              14:             Label
+                              Store 12(RGB) 18
                               Return
                               FunctionEnd
-      16(@main():           2 Function None 3
-              17:             Label
-   21(final_RGB):     10(ptr) Variable Function
-       22(param):     10(ptr) Variable Function
-              23:           2 FunctionCall 14(TexFunc(t21;vf3;) 20(MyTexture) 22(param)
-              24:    9(fvec3) Load 22(param)
-                              Store 21(final_RGB) 24
+      15(@main():           2 Function None 3
+              16:             Label
+   22(final_RGB):      9(ptr) Variable Function
+       23(param):      9(ptr) Variable Function
+              21:           7 Load 20(MyTexture)
+              24:           2 FunctionCall 13(TexFunc(t21;vf3;) 21 23(param)
+              25:    8(fvec3) Load 23(param)
+                              Store 22(final_RGB) 25
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.samplecmp.array.dx10.frag.out b/Test/baseResults/hlsl.samplecmp.array.dx10.frag.out
index 5f8d516..5a61639 100644
--- a/Test/baseResults/hlsl.samplecmp.array.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplecmp.array.dx10.frag.out
@@ -10,7 +10,7 @@
 0:42          'r10' ( temp float)
 0:42          texture ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DArrayShadow)
-0:42              'g_tTex1df4a' ( uniform texture1DArray)
+0:42              'g_tTex1df4a' ( uniform texture1DArrayShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -23,7 +23,7 @@
 0:43          'r12' ( temp float)
 0:43          texture ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DArrayShadow)
-0:43              'g_tTex1di4a' ( uniform itexture1DArray)
+0:43              'g_tTex1di4a' ( uniform itexture1DArrayShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -36,7 +36,7 @@
 0:44          'r14' ( temp float)
 0:44          texture ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DArrayShadow)
-0:44              'g_tTex1du4a' ( uniform utexture1DArray)
+0:44              'g_tTex1du4a' ( uniform utexture1DArrayShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -49,7 +49,7 @@
 0:47          'r30' ( temp float)
 0:47          texture ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DArrayShadow)
-0:47              'g_tTex2df4a' ( uniform texture2DArray)
+0:47              'g_tTex2df4a' ( uniform texture2DArrayShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -63,7 +63,7 @@
 0:48          'r32' ( temp float)
 0:48          texture ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DArrayShadow)
-0:48              'g_tTex2di4a' ( uniform itexture2DArray)
+0:48              'g_tTex2di4a' ( uniform itexture2DArrayShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -77,7 +77,7 @@
 0:49          'r34' ( temp float)
 0:49          texture ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DArrayShadow)
-0:49              'g_tTex2du4a' ( uniform utexture2DArray)
+0:49              'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -91,7 +91,7 @@
 0:52          'r60' ( temp float)
 0:52          texture ( temp float)
 0:52            Construct combined texture-sampler ( temp samplerCubeArrayShadow)
-0:52              'g_tTexcdf4a' ( uniform textureCubeArray)
+0:52              'g_tTexcdf4a' ( uniform textureCubeArrayShadow)
 0:52              'g_sSamp' (layout( binding=0) uniform sampler)
 0:52            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -106,7 +106,7 @@
 0:53          'r62' ( temp float)
 0:53          texture ( temp float)
 0:53            Construct combined texture-sampler ( temp isamplerCubeArrayShadow)
-0:53              'g_tTexcdi4a' ( uniform itextureCubeArray)
+0:53              'g_tTexcdi4a' ( uniform itextureCubeArrayShadow)
 0:53              'g_sSamp' (layout( binding=0) uniform sampler)
 0:53            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -121,7 +121,7 @@
 0:54          'r64' ( temp float)
 0:54          texture ( temp float)
 0:54            Construct combined texture-sampler ( temp usamplerCubeArrayShadow)
-0:54              'g_tTexcdu4a' ( uniform utextureCubeArray)
+0:54              'g_tTexcdu4a' ( uniform utextureCubeArrayShadow)
 0:54              'g_sSamp' (layout( binding=0) uniform sampler)
 0:54            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -183,15 +183,15 @@
 0:?     'g_tTexcdf4' ( uniform textureCube)
 0:?     'g_tTexcdi4' ( uniform itextureCube)
 0:?     'g_tTexcdu4' ( uniform utextureCube)
-0:?     'g_tTex1df4a' ( uniform texture1DArray)
-0:?     'g_tTex1di4a' ( uniform itexture1DArray)
-0:?     'g_tTex1du4a' ( uniform utexture1DArray)
-0:?     'g_tTex2df4a' ( uniform texture2DArray)
-0:?     'g_tTex2di4a' ( uniform itexture2DArray)
-0:?     'g_tTex2du4a' ( uniform utexture2DArray)
-0:?     'g_tTexcdf4a' ( uniform textureCubeArray)
-0:?     'g_tTexcdi4a' ( uniform itextureCubeArray)
-0:?     'g_tTexcdu4a' ( uniform utextureCubeArray)
+0:?     'g_tTex1df4a' ( uniform texture1DArrayShadow)
+0:?     'g_tTex1di4a' ( uniform itexture1DArrayShadow)
+0:?     'g_tTex1du4a' ( uniform utexture1DArrayShadow)
+0:?     'g_tTex2df4a' ( uniform texture2DArrayShadow)
+0:?     'g_tTex2di4a' ( uniform itexture2DArrayShadow)
+0:?     'g_tTex2du4a' ( uniform utexture2DArrayShadow)
+0:?     'g_tTexcdf4a' ( uniform textureCubeArrayShadow)
+0:?     'g_tTexcdi4a' ( uniform itextureCubeArrayShadow)
+0:?     'g_tTexcdu4a' ( uniform utextureCubeArrayShadow)
 0:?     '@entryPointOutput.Depth' ( out float FragDepth)
 0:?     '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float)
 
@@ -210,7 +210,7 @@
 0:42          'r10' ( temp float)
 0:42          texture ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DArrayShadow)
-0:42              'g_tTex1df4a' ( uniform texture1DArray)
+0:42              'g_tTex1df4a' ( uniform texture1DArrayShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -223,7 +223,7 @@
 0:43          'r12' ( temp float)
 0:43          texture ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DArrayShadow)
-0:43              'g_tTex1di4a' ( uniform itexture1DArray)
+0:43              'g_tTex1di4a' ( uniform itexture1DArrayShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -236,7 +236,7 @@
 0:44          'r14' ( temp float)
 0:44          texture ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DArrayShadow)
-0:44              'g_tTex1du4a' ( uniform utexture1DArray)
+0:44              'g_tTex1du4a' ( uniform utexture1DArrayShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -249,7 +249,7 @@
 0:47          'r30' ( temp float)
 0:47          texture ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DArrayShadow)
-0:47              'g_tTex2df4a' ( uniform texture2DArray)
+0:47              'g_tTex2df4a' ( uniform texture2DArrayShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -263,7 +263,7 @@
 0:48          'r32' ( temp float)
 0:48          texture ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DArrayShadow)
-0:48              'g_tTex2di4a' ( uniform itexture2DArray)
+0:48              'g_tTex2di4a' ( uniform itexture2DArrayShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -277,7 +277,7 @@
 0:49          'r34' ( temp float)
 0:49          texture ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DArrayShadow)
-0:49              'g_tTex2du4a' ( uniform utexture2DArray)
+0:49              'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -291,7 +291,7 @@
 0:52          'r60' ( temp float)
 0:52          texture ( temp float)
 0:52            Construct combined texture-sampler ( temp samplerCubeArrayShadow)
-0:52              'g_tTexcdf4a' ( uniform textureCubeArray)
+0:52              'g_tTexcdf4a' ( uniform textureCubeArrayShadow)
 0:52              'g_sSamp' (layout( binding=0) uniform sampler)
 0:52            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -306,7 +306,7 @@
 0:53          'r62' ( temp float)
 0:53          texture ( temp float)
 0:53            Construct combined texture-sampler ( temp isamplerCubeArrayShadow)
-0:53              'g_tTexcdi4a' ( uniform itextureCubeArray)
+0:53              'g_tTexcdi4a' ( uniform itextureCubeArrayShadow)
 0:53              'g_sSamp' (layout( binding=0) uniform sampler)
 0:53            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -321,7 +321,7 @@
 0:54          'r64' ( temp float)
 0:54          texture ( temp float)
 0:54            Construct combined texture-sampler ( temp usamplerCubeArrayShadow)
-0:54              'g_tTexcdu4a' ( uniform utextureCubeArray)
+0:54              'g_tTexcdu4a' ( uniform utextureCubeArrayShadow)
 0:54              'g_sSamp' (layout( binding=0) uniform sampler)
 0:54            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -383,28 +383,28 @@
 0:?     'g_tTexcdf4' ( uniform textureCube)
 0:?     'g_tTexcdi4' ( uniform itextureCube)
 0:?     'g_tTexcdu4' ( uniform utextureCube)
-0:?     'g_tTex1df4a' ( uniform texture1DArray)
-0:?     'g_tTex1di4a' ( uniform itexture1DArray)
-0:?     'g_tTex1du4a' ( uniform utexture1DArray)
-0:?     'g_tTex2df4a' ( uniform texture2DArray)
-0:?     'g_tTex2di4a' ( uniform itexture2DArray)
-0:?     'g_tTex2du4a' ( uniform utexture2DArray)
-0:?     'g_tTexcdf4a' ( uniform textureCubeArray)
-0:?     'g_tTexcdi4a' ( uniform itextureCubeArray)
-0:?     'g_tTexcdu4a' ( uniform utextureCubeArray)
+0:?     'g_tTex1df4a' ( uniform texture1DArrayShadow)
+0:?     'g_tTex1di4a' ( uniform itexture1DArrayShadow)
+0:?     'g_tTex1du4a' ( uniform utexture1DArrayShadow)
+0:?     'g_tTex2df4a' ( uniform texture2DArrayShadow)
+0:?     'g_tTex2di4a' ( uniform itexture2DArrayShadow)
+0:?     'g_tTex2du4a' ( uniform utexture2DArrayShadow)
+0:?     'g_tTexcdf4a' ( uniform textureCubeArrayShadow)
+0:?     'g_tTexcdi4a' ( uniform itextureCubeArrayShadow)
+0:?     'g_tTexcdu4a' ( uniform utextureCubeArrayShadow)
 0:?     '@entryPointOutput.Depth' ( out float FragDepth)
 0:?     '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float)
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 218
+// Id's are bound by 209
 
                               Capability Shader
                               Capability Sampled1D
                               Capability SampledCubeArray
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 175 179
+                              EntryPoint Fragment 4  "main" 166 170
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -415,64 +415,64 @@
                               Name 13  "r10"
                               Name 16  "g_tTex1df4a"
                               Name 20  "g_sSamp"
-                              Name 36  "r12"
-                              Name 40  "g_tTex1di4a"
-                              Name 51  "r14"
-                              Name 55  "g_tTex1du4a"
-                              Name 66  "r30"
-                              Name 69  "g_tTex2df4a"
-                              Name 83  "r32"
-                              Name 86  "g_tTex2di4a"
-                              Name 98  "r34"
-                              Name 101  "g_tTex2du4a"
-                              Name 113  "r60"
-                              Name 116  "g_tTexcdf4a"
-                              Name 130  "r62"
-                              Name 133  "g_tTexcdi4a"
-                              Name 145  "r64"
-                              Name 148  "g_tTexcdu4a"
-                              Name 161  "psout"
-                              Name 172  "flattenTemp"
-                              Name 175  "@entryPointOutput.Color"
-                              Name 179  "@entryPointOutput.Depth"
-                              Name 184  "g_tTex1df4"
-                              Name 187  "g_tTex1di4"
-                              Name 190  "g_tTex1du4"
-                              Name 193  "g_tTex2df4"
-                              Name 196  "g_tTex2di4"
-                              Name 199  "g_tTex2du4"
-                              Name 202  "g_tTex3df4"
-                              Name 205  "g_tTex3di4"
-                              Name 208  "g_tTex3du4"
-                              Name 211  "g_tTexcdf4"
-                              Name 214  "g_tTexcdi4"
-                              Name 217  "g_tTexcdu4"
+                              Name 35  "r12"
+                              Name 39  "g_tTex1di4a"
+                              Name 49  "r14"
+                              Name 53  "g_tTex1du4a"
+                              Name 63  "r30"
+                              Name 66  "g_tTex2df4a"
+                              Name 79  "r32"
+                              Name 82  "g_tTex2di4a"
+                              Name 93  "r34"
+                              Name 96  "g_tTex2du4a"
+                              Name 107  "r60"
+                              Name 110  "g_tTexcdf4a"
+                              Name 123  "r62"
+                              Name 126  "g_tTexcdi4a"
+                              Name 137  "r64"
+                              Name 140  "g_tTexcdu4a"
+                              Name 152  "psout"
+                              Name 163  "flattenTemp"
+                              Name 166  "@entryPointOutput.Color"
+                              Name 170  "@entryPointOutput.Depth"
+                              Name 175  "g_tTex1df4"
+                              Name 178  "g_tTex1di4"
+                              Name 181  "g_tTex1du4"
+                              Name 184  "g_tTex2df4"
+                              Name 187  "g_tTex2di4"
+                              Name 190  "g_tTex2du4"
+                              Name 193  "g_tTex3df4"
+                              Name 196  "g_tTex3di4"
+                              Name 199  "g_tTex3du4"
+                              Name 202  "g_tTexcdf4"
+                              Name 205  "g_tTexcdi4"
+                              Name 208  "g_tTexcdu4"
                               Decorate 16(g_tTex1df4a) DescriptorSet 0
                               Decorate 20(g_sSamp) DescriptorSet 0
                               Decorate 20(g_sSamp) Binding 0
-                              Decorate 40(g_tTex1di4a) DescriptorSet 0
-                              Decorate 55(g_tTex1du4a) DescriptorSet 0
-                              Decorate 69(g_tTex2df4a) DescriptorSet 0
-                              Decorate 86(g_tTex2di4a) DescriptorSet 0
-                              Decorate 101(g_tTex2du4a) DescriptorSet 0
-                              Decorate 116(g_tTexcdf4a) DescriptorSet 0
-                              Decorate 133(g_tTexcdi4a) DescriptorSet 0
-                              Decorate 148(g_tTexcdu4a) DescriptorSet 0
-                              Decorate 175(@entryPointOutput.Color) Location 0
-                              Decorate 179(@entryPointOutput.Depth) BuiltIn FragDepth
-                              Decorate 184(g_tTex1df4) DescriptorSet 0
-                              Decorate 184(g_tTex1df4) Binding 0
-                              Decorate 187(g_tTex1di4) DescriptorSet 0
-                              Decorate 190(g_tTex1du4) DescriptorSet 0
-                              Decorate 193(g_tTex2df4) DescriptorSet 0
-                              Decorate 196(g_tTex2di4) DescriptorSet 0
-                              Decorate 199(g_tTex2du4) DescriptorSet 0
-                              Decorate 202(g_tTex3df4) DescriptorSet 0
-                              Decorate 205(g_tTex3di4) DescriptorSet 0
-                              Decorate 208(g_tTex3du4) DescriptorSet 0
-                              Decorate 211(g_tTexcdf4) DescriptorSet 0
-                              Decorate 214(g_tTexcdi4) DescriptorSet 0
-                              Decorate 217(g_tTexcdu4) DescriptorSet 0
+                              Decorate 39(g_tTex1di4a) DescriptorSet 0
+                              Decorate 53(g_tTex1du4a) DescriptorSet 0
+                              Decorate 66(g_tTex2df4a) DescriptorSet 0
+                              Decorate 82(g_tTex2di4a) DescriptorSet 0
+                              Decorate 96(g_tTex2du4a) DescriptorSet 0
+                              Decorate 110(g_tTexcdf4a) DescriptorSet 0
+                              Decorate 126(g_tTexcdi4a) DescriptorSet 0
+                              Decorate 140(g_tTexcdu4a) DescriptorSet 0
+                              Decorate 166(@entryPointOutput.Color) Location 0
+                              Decorate 170(@entryPointOutput.Depth) BuiltIn FragDepth
+                              Decorate 175(g_tTex1df4) DescriptorSet 0
+                              Decorate 175(g_tTex1df4) Binding 0
+                              Decorate 178(g_tTex1di4) DescriptorSet 0
+                              Decorate 181(g_tTex1du4) DescriptorSet 0
+                              Decorate 184(g_tTex2df4) DescriptorSet 0
+                              Decorate 187(g_tTex2di4) DescriptorSet 0
+                              Decorate 190(g_tTex2du4) DescriptorSet 0
+                              Decorate 193(g_tTex3df4) DescriptorSet 0
+                              Decorate 196(g_tTex3di4) DescriptorSet 0
+                              Decorate 199(g_tTex3du4) DescriptorSet 0
+                              Decorate 202(g_tTexcdf4) DescriptorSet 0
+                              Decorate 205(g_tTexcdi4) DescriptorSet 0
+                              Decorate 208(g_tTexcdu4) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -480,228 +480,219 @@
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
                9:             TypeFunction 8(PS_OUTPUT)
               12:             TypePointer Function 6(float)
-              14:             TypeImage 6(float) 1D array sampled format:Unknown
+              14:             TypeImage 6(float) 1D depth array sampled format:Unknown
               15:             TypePointer UniformConstant 14
  16(g_tTex1df4a):     15(ptr) Variable UniformConstant
               18:             TypeSampler
               19:             TypePointer UniformConstant 18
      20(g_sSamp):     19(ptr) Variable UniformConstant
-              22:             TypeImage 6(float) 1D depth array sampled format:Unknown
-              23:             TypeSampledImage 22
-              25:             TypeVector 6(float) 2
-              26:    6(float) Constant 1036831949
-              27:    6(float) Constant 1045220557
-              28:   25(fvec2) ConstantComposite 26 27
-              29:    6(float) Constant 1061158912
-              30:             TypeVector 6(float) 3
-              37:             TypeInt 32 1
-              38:             TypeImage 37(int) 1D array sampled format:Unknown
-              39:             TypePointer UniformConstant 38
- 40(g_tTex1di4a):     39(ptr) Variable UniformConstant
-              43:             TypeImage 37(int) 1D depth array sampled format:Unknown
-              44:             TypeSampledImage 43
-              52:             TypeInt 32 0
-              53:             TypeImage 52(int) 1D array sampled format:Unknown
-              54:             TypePointer UniformConstant 53
- 55(g_tTex1du4a):     54(ptr) Variable UniformConstant
-              58:             TypeImage 52(int) 1D depth array sampled format:Unknown
-              59:             TypeSampledImage 58
-              67:             TypeImage 6(float) 2D array sampled format:Unknown
-              68:             TypePointer UniformConstant 67
- 69(g_tTex2df4a):     68(ptr) Variable UniformConstant
-              72:             TypeImage 6(float) 2D depth array sampled format:Unknown
-              73:             TypeSampledImage 72
-              75:    6(float) Constant 1050253722
-              76:   30(fvec3) ConstantComposite 26 27 75
-              84:             TypeImage 37(int) 2D array sampled format:Unknown
-              85:             TypePointer UniformConstant 84
- 86(g_tTex2di4a):     85(ptr) Variable UniformConstant
-              89:             TypeImage 37(int) 2D depth array sampled format:Unknown
-              90:             TypeSampledImage 89
-              99:             TypeImage 52(int) 2D array sampled format:Unknown
-             100:             TypePointer UniformConstant 99
-101(g_tTex2du4a):    100(ptr) Variable UniformConstant
-             104:             TypeImage 52(int) 2D depth array sampled format:Unknown
-             105:             TypeSampledImage 104
-             114:             TypeImage 6(float) Cube array sampled format:Unknown
-             115:             TypePointer UniformConstant 114
-116(g_tTexcdf4a):    115(ptr) Variable UniformConstant
-             119:             TypeImage 6(float) Cube depth array sampled format:Unknown
-             120:             TypeSampledImage 119
-             122:    6(float) Constant 1053609165
-             123:    7(fvec4) ConstantComposite 26 27 75 122
-             131:             TypeImage 37(int) Cube array sampled format:Unknown
-             132:             TypePointer UniformConstant 131
-133(g_tTexcdi4a):    132(ptr) Variable UniformConstant
-             136:             TypeImage 37(int) Cube depth array sampled format:Unknown
-             137:             TypeSampledImage 136
-             146:             TypeImage 52(int) Cube array sampled format:Unknown
-             147:             TypePointer UniformConstant 146
-148(g_tTexcdu4a):    147(ptr) Variable UniformConstant
-             151:             TypeImage 52(int) Cube depth array sampled format:Unknown
-             152:             TypeSampledImage 151
-             160:             TypePointer Function 8(PS_OUTPUT)
-             162:     37(int) Constant 0
-             163:    6(float) Constant 1065353216
-             164:    7(fvec4) ConstantComposite 163 163 163 163
-             165:             TypePointer Function 7(fvec4)
-             167:     37(int) Constant 1
-             174:             TypePointer Output 7(fvec4)
-175(@entryPointOutput.Color):    174(ptr) Variable Output
-             178:             TypePointer Output 6(float)
-179(@entryPointOutput.Depth):    178(ptr) Variable Output
-             182:             TypeImage 6(float) 1D sampled format:Unknown
+              22:             TypeSampledImage 14
+              24:             TypeVector 6(float) 2
+              25:    6(float) Constant 1036831949
+              26:    6(float) Constant 1045220557
+              27:   24(fvec2) ConstantComposite 25 26
+              28:    6(float) Constant 1061158912
+              29:             TypeVector 6(float) 3
+              36:             TypeInt 32 1
+              37:             TypeImage 36(int) 1D depth array sampled format:Unknown
+              38:             TypePointer UniformConstant 37
+ 39(g_tTex1di4a):     38(ptr) Variable UniformConstant
+              42:             TypeSampledImage 37
+              50:             TypeInt 32 0
+              51:             TypeImage 50(int) 1D depth array sampled format:Unknown
+              52:             TypePointer UniformConstant 51
+ 53(g_tTex1du4a):     52(ptr) Variable UniformConstant
+              56:             TypeSampledImage 51
+              64:             TypeImage 6(float) 2D depth array sampled format:Unknown
+              65:             TypePointer UniformConstant 64
+ 66(g_tTex2df4a):     65(ptr) Variable UniformConstant
+              69:             TypeSampledImage 64
+              71:    6(float) Constant 1050253722
+              72:   29(fvec3) ConstantComposite 25 26 71
+              80:             TypeImage 36(int) 2D depth array sampled format:Unknown
+              81:             TypePointer UniformConstant 80
+ 82(g_tTex2di4a):     81(ptr) Variable UniformConstant
+              85:             TypeSampledImage 80
+              94:             TypeImage 50(int) 2D depth array sampled format:Unknown
+              95:             TypePointer UniformConstant 94
+ 96(g_tTex2du4a):     95(ptr) Variable UniformConstant
+              99:             TypeSampledImage 94
+             108:             TypeImage 6(float) Cube depth array sampled format:Unknown
+             109:             TypePointer UniformConstant 108
+110(g_tTexcdf4a):    109(ptr) Variable UniformConstant
+             113:             TypeSampledImage 108
+             115:    6(float) Constant 1053609165
+             116:    7(fvec4) ConstantComposite 25 26 71 115
+             124:             TypeImage 36(int) Cube depth array sampled format:Unknown
+             125:             TypePointer UniformConstant 124
+126(g_tTexcdi4a):    125(ptr) Variable UniformConstant
+             129:             TypeSampledImage 124
+             138:             TypeImage 50(int) Cube depth array sampled format:Unknown
+             139:             TypePointer UniformConstant 138
+140(g_tTexcdu4a):    139(ptr) Variable UniformConstant
+             143:             TypeSampledImage 138
+             151:             TypePointer Function 8(PS_OUTPUT)
+             153:     36(int) Constant 0
+             154:    6(float) Constant 1065353216
+             155:    7(fvec4) ConstantComposite 154 154 154 154
+             156:             TypePointer Function 7(fvec4)
+             158:     36(int) Constant 1
+             165:             TypePointer Output 7(fvec4)
+166(@entryPointOutput.Color):    165(ptr) Variable Output
+             169:             TypePointer Output 6(float)
+170(@entryPointOutput.Depth):    169(ptr) Variable Output
+             173:             TypeImage 6(float) 1D sampled format:Unknown
+             174:             TypePointer UniformConstant 173
+ 175(g_tTex1df4):    174(ptr) Variable UniformConstant
+             176:             TypeImage 36(int) 1D sampled format:Unknown
+             177:             TypePointer UniformConstant 176
+ 178(g_tTex1di4):    177(ptr) Variable UniformConstant
+             179:             TypeImage 50(int) 1D sampled format:Unknown
+             180:             TypePointer UniformConstant 179
+ 181(g_tTex1du4):    180(ptr) Variable UniformConstant
+             182:             TypeImage 6(float) 2D sampled format:Unknown
              183:             TypePointer UniformConstant 182
- 184(g_tTex1df4):    183(ptr) Variable UniformConstant
-             185:             TypeImage 37(int) 1D sampled format:Unknown
+ 184(g_tTex2df4):    183(ptr) Variable UniformConstant
+             185:             TypeImage 36(int) 2D sampled format:Unknown
              186:             TypePointer UniformConstant 185
- 187(g_tTex1di4):    186(ptr) Variable UniformConstant
-             188:             TypeImage 52(int) 1D sampled format:Unknown
+ 187(g_tTex2di4):    186(ptr) Variable UniformConstant
+             188:             TypeImage 50(int) 2D sampled format:Unknown
              189:             TypePointer UniformConstant 188
- 190(g_tTex1du4):    189(ptr) Variable UniformConstant
-             191:             TypeImage 6(float) 2D sampled format:Unknown
+ 190(g_tTex2du4):    189(ptr) Variable UniformConstant
+             191:             TypeImage 6(float) 3D sampled format:Unknown
              192:             TypePointer UniformConstant 191
- 193(g_tTex2df4):    192(ptr) Variable UniformConstant
-             194:             TypeImage 37(int) 2D sampled format:Unknown
+ 193(g_tTex3df4):    192(ptr) Variable UniformConstant
+             194:             TypeImage 36(int) 3D sampled format:Unknown
              195:             TypePointer UniformConstant 194
- 196(g_tTex2di4):    195(ptr) Variable UniformConstant
-             197:             TypeImage 52(int) 2D sampled format:Unknown
+ 196(g_tTex3di4):    195(ptr) Variable UniformConstant
+             197:             TypeImage 50(int) 3D sampled format:Unknown
              198:             TypePointer UniformConstant 197
- 199(g_tTex2du4):    198(ptr) Variable UniformConstant
-             200:             TypeImage 6(float) 3D sampled format:Unknown
+ 199(g_tTex3du4):    198(ptr) Variable UniformConstant
+             200:             TypeImage 6(float) Cube sampled format:Unknown
              201:             TypePointer UniformConstant 200
- 202(g_tTex3df4):    201(ptr) Variable UniformConstant
-             203:             TypeImage 37(int) 3D sampled format:Unknown
+ 202(g_tTexcdf4):    201(ptr) Variable UniformConstant
+             203:             TypeImage 36(int) Cube sampled format:Unknown
              204:             TypePointer UniformConstant 203
- 205(g_tTex3di4):    204(ptr) Variable UniformConstant
-             206:             TypeImage 52(int) 3D sampled format:Unknown
+ 205(g_tTexcdi4):    204(ptr) Variable UniformConstant
+             206:             TypeImage 50(int) Cube sampled format:Unknown
              207:             TypePointer UniformConstant 206
- 208(g_tTex3du4):    207(ptr) Variable UniformConstant
-             209:             TypeImage 6(float) Cube sampled format:Unknown
-             210:             TypePointer UniformConstant 209
- 211(g_tTexcdf4):    210(ptr) Variable UniformConstant
-             212:             TypeImage 37(int) Cube sampled format:Unknown
-             213:             TypePointer UniformConstant 212
- 214(g_tTexcdi4):    213(ptr) Variable UniformConstant
-             215:             TypeImage 52(int) Cube sampled format:Unknown
-             216:             TypePointer UniformConstant 215
- 217(g_tTexcdu4):    216(ptr) Variable UniformConstant
+ 208(g_tTexcdu4):    207(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
-172(flattenTemp):    160(ptr) Variable Function
-             173:8(PS_OUTPUT) FunctionCall 10(@main()
-                              Store 172(flattenTemp) 173
-             176:    165(ptr) AccessChain 172(flattenTemp) 162
-             177:    7(fvec4) Load 176
-                              Store 175(@entryPointOutput.Color) 177
-             180:     12(ptr) AccessChain 172(flattenTemp) 167
-             181:    6(float) Load 180
-                              Store 179(@entryPointOutput.Depth) 181
+163(flattenTemp):    151(ptr) Variable Function
+             164:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 163(flattenTemp) 164
+             167:    156(ptr) AccessChain 163(flattenTemp) 153
+             168:    7(fvec4) Load 167
+                              Store 166(@entryPointOutput.Color) 168
+             171:     12(ptr) AccessChain 163(flattenTemp) 158
+             172:    6(float) Load 171
+                              Store 170(@entryPointOutput.Depth) 172
                               Return
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
          13(r10):     12(ptr) Variable Function
-         36(r12):     12(ptr) Variable Function
-         51(r14):     12(ptr) Variable Function
-         66(r30):     12(ptr) Variable Function
-         83(r32):     12(ptr) Variable Function
-         98(r34):     12(ptr) Variable Function
-        113(r60):     12(ptr) Variable Function
-        130(r62):     12(ptr) Variable Function
-        145(r64):     12(ptr) Variable Function
-      161(psout):    160(ptr) Variable Function
+         35(r12):     12(ptr) Variable Function
+         49(r14):     12(ptr) Variable Function
+         63(r30):     12(ptr) Variable Function
+         79(r32):     12(ptr) Variable Function
+         93(r34):     12(ptr) Variable Function
+        107(r60):     12(ptr) Variable Function
+        123(r62):     12(ptr) Variable Function
+        137(r64):     12(ptr) Variable Function
+      152(psout):    151(ptr) Variable Function
               17:          14 Load 16(g_tTex1df4a)
               21:          18 Load 20(g_sSamp)
-              24:          23 SampledImage 17 21
-              31:    6(float) CompositeExtract 28 0
-              32:    6(float) CompositeExtract 28 1
-              33:   30(fvec3) CompositeConstruct 31 32 29
-              34:    6(float) CompositeExtract 33 2
-              35:    6(float) ImageSampleDrefImplicitLod 24 33 34
-                              Store 13(r10) 35
-              41:          38 Load 40(g_tTex1di4a)
-              42:          18 Load 20(g_sSamp)
-              45:          44 SampledImage 41 42
-              46:    6(float) CompositeExtract 28 0
-              47:    6(float) CompositeExtract 28 1
-              48:   30(fvec3) CompositeConstruct 46 47 29
-              49:    6(float) CompositeExtract 48 2
-              50:    6(float) ImageSampleDrefImplicitLod 45 48 49
-                              Store 36(r12) 50
-              56:          53 Load 55(g_tTex1du4a)
-              57:          18 Load 20(g_sSamp)
-              60:          59 SampledImage 56 57
-              61:    6(float) CompositeExtract 28 0
-              62:    6(float) CompositeExtract 28 1
-              63:   30(fvec3) CompositeConstruct 61 62 29
-              64:    6(float) CompositeExtract 63 2
-              65:    6(float) ImageSampleDrefImplicitLod 60 63 64
-                              Store 51(r14) 65
-              70:          67 Load 69(g_tTex2df4a)
-              71:          18 Load 20(g_sSamp)
-              74:          73 SampledImage 70 71
-              77:    6(float) CompositeExtract 76 0
-              78:    6(float) CompositeExtract 76 1
-              79:    6(float) CompositeExtract 76 2
-              80:    7(fvec4) CompositeConstruct 77 78 79 29
-              81:    6(float) CompositeExtract 80 3
-              82:    6(float) ImageSampleDrefImplicitLod 74 80 81
-                              Store 66(r30) 82
-              87:          84 Load 86(g_tTex2di4a)
-              88:          18 Load 20(g_sSamp)
-              91:          90 SampledImage 87 88
-              92:    6(float) CompositeExtract 76 0
-              93:    6(float) CompositeExtract 76 1
-              94:    6(float) CompositeExtract 76 2
-              95:    7(fvec4) CompositeConstruct 92 93 94 29
-              96:    6(float) CompositeExtract 95 3
-              97:    6(float) ImageSampleDrefImplicitLod 91 95 96
-                              Store 83(r32) 97
-             102:          99 Load 101(g_tTex2du4a)
-             103:          18 Load 20(g_sSamp)
-             106:         105 SampledImage 102 103
-             107:    6(float) CompositeExtract 76 0
-             108:    6(float) CompositeExtract 76 1
-             109:    6(float) CompositeExtract 76 2
-             110:    7(fvec4) CompositeConstruct 107 108 109 29
-             111:    6(float) CompositeExtract 110 3
-             112:    6(float) ImageSampleDrefImplicitLod 106 110 111
-                              Store 98(r34) 112
-             117:         114 Load 116(g_tTexcdf4a)
-             118:          18 Load 20(g_sSamp)
-             121:         120 SampledImage 117 118
-             124:    6(float) CompositeExtract 123 0
-             125:    6(float) CompositeExtract 123 1
-             126:    6(float) CompositeExtract 123 2
-             127:    6(float) CompositeExtract 123 3
-             128:    7(fvec4) CompositeConstruct 124 125 126 127
-             129:    6(float) ImageSampleDrefImplicitLod 121 128 29
-                              Store 113(r60) 129
-             134:         131 Load 133(g_tTexcdi4a)
-             135:          18 Load 20(g_sSamp)
-             138:         137 SampledImage 134 135
-             139:    6(float) CompositeExtract 123 0
-             140:    6(float) CompositeExtract 123 1
-             141:    6(float) CompositeExtract 123 2
-             142:    6(float) CompositeExtract 123 3
-             143:    7(fvec4) CompositeConstruct 139 140 141 142
-             144:    6(float) ImageSampleDrefImplicitLod 138 143 29
-                              Store 130(r62) 144
-             149:         146 Load 148(g_tTexcdu4a)
-             150:          18 Load 20(g_sSamp)
-             153:         152 SampledImage 149 150
-             154:    6(float) CompositeExtract 123 0
-             155:    6(float) CompositeExtract 123 1
-             156:    6(float) CompositeExtract 123 2
-             157:    6(float) CompositeExtract 123 3
-             158:    7(fvec4) CompositeConstruct 154 155 156 157
-             159:    6(float) ImageSampleDrefImplicitLod 153 158 29
-                              Store 145(r64) 159
-             166:    165(ptr) AccessChain 161(psout) 162
-                              Store 166 164
-             168:     12(ptr) AccessChain 161(psout) 167
-                              Store 168 163
-             169:8(PS_OUTPUT) Load 161(psout)
-                              ReturnValue 169
+              23:          22 SampledImage 17 21
+              30:    6(float) CompositeExtract 27 0
+              31:    6(float) CompositeExtract 27 1
+              32:   29(fvec3) CompositeConstruct 30 31 28
+              33:    6(float) CompositeExtract 32 2
+              34:    6(float) ImageSampleDrefImplicitLod 23 32 33
+                              Store 13(r10) 34
+              40:          37 Load 39(g_tTex1di4a)
+              41:          18 Load 20(g_sSamp)
+              43:          42 SampledImage 40 41
+              44:    6(float) CompositeExtract 27 0
+              45:    6(float) CompositeExtract 27 1
+              46:   29(fvec3) CompositeConstruct 44 45 28
+              47:    6(float) CompositeExtract 46 2
+              48:    6(float) ImageSampleDrefImplicitLod 43 46 47
+                              Store 35(r12) 48
+              54:          51 Load 53(g_tTex1du4a)
+              55:          18 Load 20(g_sSamp)
+              57:          56 SampledImage 54 55
+              58:    6(float) CompositeExtract 27 0
+              59:    6(float) CompositeExtract 27 1
+              60:   29(fvec3) CompositeConstruct 58 59 28
+              61:    6(float) CompositeExtract 60 2
+              62:    6(float) ImageSampleDrefImplicitLod 57 60 61
+                              Store 49(r14) 62
+              67:          64 Load 66(g_tTex2df4a)
+              68:          18 Load 20(g_sSamp)
+              70:          69 SampledImage 67 68
+              73:    6(float) CompositeExtract 72 0
+              74:    6(float) CompositeExtract 72 1
+              75:    6(float) CompositeExtract 72 2
+              76:    7(fvec4) CompositeConstruct 73 74 75 28
+              77:    6(float) CompositeExtract 76 3
+              78:    6(float) ImageSampleDrefImplicitLod 70 76 77
+                              Store 63(r30) 78
+              83:          80 Load 82(g_tTex2di4a)
+              84:          18 Load 20(g_sSamp)
+              86:          85 SampledImage 83 84
+              87:    6(float) CompositeExtract 72 0
+              88:    6(float) CompositeExtract 72 1
+              89:    6(float) CompositeExtract 72 2
+              90:    7(fvec4) CompositeConstruct 87 88 89 28
+              91:    6(float) CompositeExtract 90 3
+              92:    6(float) ImageSampleDrefImplicitLod 86 90 91
+                              Store 79(r32) 92
+              97:          94 Load 96(g_tTex2du4a)
+              98:          18 Load 20(g_sSamp)
+             100:          99 SampledImage 97 98
+             101:    6(float) CompositeExtract 72 0
+             102:    6(float) CompositeExtract 72 1
+             103:    6(float) CompositeExtract 72 2
+             104:    7(fvec4) CompositeConstruct 101 102 103 28
+             105:    6(float) CompositeExtract 104 3
+             106:    6(float) ImageSampleDrefImplicitLod 100 104 105
+                              Store 93(r34) 106
+             111:         108 Load 110(g_tTexcdf4a)
+             112:          18 Load 20(g_sSamp)
+             114:         113 SampledImage 111 112
+             117:    6(float) CompositeExtract 116 0
+             118:    6(float) CompositeExtract 116 1
+             119:    6(float) CompositeExtract 116 2
+             120:    6(float) CompositeExtract 116 3
+             121:    7(fvec4) CompositeConstruct 117 118 119 120
+             122:    6(float) ImageSampleDrefImplicitLod 114 121 28
+                              Store 107(r60) 122
+             127:         124 Load 126(g_tTexcdi4a)
+             128:          18 Load 20(g_sSamp)
+             130:         129 SampledImage 127 128
+             131:    6(float) CompositeExtract 116 0
+             132:    6(float) CompositeExtract 116 1
+             133:    6(float) CompositeExtract 116 2
+             134:    6(float) CompositeExtract 116 3
+             135:    7(fvec4) CompositeConstruct 131 132 133 134
+             136:    6(float) ImageSampleDrefImplicitLod 130 135 28
+                              Store 123(r62) 136
+             141:         138 Load 140(g_tTexcdu4a)
+             142:          18 Load 20(g_sSamp)
+             144:         143 SampledImage 141 142
+             145:    6(float) CompositeExtract 116 0
+             146:    6(float) CompositeExtract 116 1
+             147:    6(float) CompositeExtract 116 2
+             148:    6(float) CompositeExtract 116 3
+             149:    7(fvec4) CompositeConstruct 145 146 147 148
+             150:    6(float) ImageSampleDrefImplicitLod 144 149 28
+                              Store 137(r64) 150
+             157:    156(ptr) AccessChain 152(psout) 153
+                              Store 157 155
+             159:     12(ptr) AccessChain 152(psout) 158
+                              Store 159 154
+             160:8(PS_OUTPUT) Load 152(psout)
+                              ReturnValue 160
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.samplecmp.basic.dx10.frag.out b/Test/baseResults/hlsl.samplecmp.basic.dx10.frag.out
index 89df15b..729dc36 100644
--- a/Test/baseResults/hlsl.samplecmp.basic.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplecmp.basic.dx10.frag.out
@@ -10,7 +10,7 @@
 0:42          'r00' ( temp float)
 0:42          texture ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DShadow)
-0:42              'g_tTex1df4' (layout( binding=0) uniform texture1D)
+0:42              'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec2 ( temp 2-component vector of float)
 0:42              Constant:
@@ -22,7 +22,7 @@
 0:43          'r02' ( temp float)
 0:43          texture ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DShadow)
-0:43              'g_tTex1di4' ( uniform itexture1D)
+0:43              'g_tTex1di4' ( uniform itexture1DShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec2 ( temp 2-component vector of float)
 0:43              Constant:
@@ -34,7 +34,7 @@
 0:44          'r04' ( temp float)
 0:44          texture ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DShadow)
-0:44              'g_tTex1du4' ( uniform utexture1D)
+0:44              'g_tTex1du4' ( uniform utexture1DShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec2 ( temp 2-component vector of float)
 0:44              Constant:
@@ -46,7 +46,7 @@
 0:47          'r20' ( temp float)
 0:47          texture ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DShadow)
-0:47              'g_tTex2df4' ( uniform texture2D)
+0:47              'g_tTex2df4' ( uniform texture2DShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -59,7 +59,7 @@
 0:48          'r22' ( temp float)
 0:48          texture ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DShadow)
-0:48              'g_tTex2di4' ( uniform itexture2D)
+0:48              'g_tTex2di4' ( uniform itexture2DShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -72,7 +72,7 @@
 0:49          'r24' ( temp float)
 0:49          texture ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DShadow)
-0:49              'g_tTex2du4' ( uniform utexture2D)
+0:49              'g_tTex2du4' ( uniform utexture2DShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -85,7 +85,7 @@
 0:53          'r50' ( temp float)
 0:53          texture ( temp float)
 0:53            Construct combined texture-sampler ( temp samplerCubeShadow)
-0:53              'g_tTexcdf4' ( uniform textureCube)
+0:53              'g_tTexcdf4' ( uniform textureCubeShadow)
 0:53              'g_sSamp' (layout( binding=0) uniform sampler)
 0:53            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -99,7 +99,7 @@
 0:54          'r52' ( temp float)
 0:54          texture ( temp float)
 0:54            Construct combined texture-sampler ( temp isamplerCubeShadow)
-0:54              'g_tTexcdi4' ( uniform itextureCube)
+0:54              'g_tTexcdi4' ( uniform itextureCubeShadow)
 0:54              'g_sSamp' (layout( binding=0) uniform sampler)
 0:54            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -113,7 +113,7 @@
 0:55          'r54' ( temp float)
 0:55          texture ( temp float)
 0:55            Construct combined texture-sampler ( temp usamplerCubeShadow)
-0:55              'g_tTexcdu4' ( uniform utextureCube)
+0:55              'g_tTexcdu4' ( uniform utextureCubeShadow)
 0:55              'g_sSamp' (layout( binding=0) uniform sampler)
 0:55            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -162,18 +162,18 @@
 0:38              1 (const int)
 0:?   Linker Objects
 0:?     'g_sSamp' (layout( binding=0) uniform sampler)
-0:?     'g_tTex1df4' (layout( binding=0) uniform texture1D)
-0:?     'g_tTex1di4' ( uniform itexture1D)
-0:?     'g_tTex1du4' ( uniform utexture1D)
-0:?     'g_tTex2df4' ( uniform texture2D)
-0:?     'g_tTex2di4' ( uniform itexture2D)
-0:?     'g_tTex2du4' ( uniform utexture2D)
+0:?     'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
+0:?     'g_tTex1di4' ( uniform itexture1DShadow)
+0:?     'g_tTex1du4' ( uniform utexture1DShadow)
+0:?     'g_tTex2df4' ( uniform texture2DShadow)
+0:?     'g_tTex2di4' ( uniform itexture2DShadow)
+0:?     'g_tTex2du4' ( uniform utexture2DShadow)
 0:?     'g_tTex3df4' ( uniform texture3D)
 0:?     'g_tTex3di4' ( uniform itexture3D)
 0:?     'g_tTex3du4' ( uniform utexture3D)
-0:?     'g_tTexcdf4' ( uniform textureCube)
-0:?     'g_tTexcdi4' ( uniform itextureCube)
-0:?     'g_tTexcdu4' ( uniform utextureCube)
+0:?     'g_tTexcdf4' ( uniform textureCubeShadow)
+0:?     'g_tTexcdi4' ( uniform itextureCubeShadow)
+0:?     'g_tTexcdu4' ( uniform utextureCubeShadow)
 0:?     'g_tTex1df4a' ( uniform texture1DArray)
 0:?     'g_tTex1di4a' ( uniform itexture1DArray)
 0:?     'g_tTex1du4a' ( uniform utexture1DArray)
@@ -201,7 +201,7 @@
 0:42          'r00' ( temp float)
 0:42          texture ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DShadow)
-0:42              'g_tTex1df4' (layout( binding=0) uniform texture1D)
+0:42              'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec2 ( temp 2-component vector of float)
 0:42              Constant:
@@ -213,7 +213,7 @@
 0:43          'r02' ( temp float)
 0:43          texture ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DShadow)
-0:43              'g_tTex1di4' ( uniform itexture1D)
+0:43              'g_tTex1di4' ( uniform itexture1DShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec2 ( temp 2-component vector of float)
 0:43              Constant:
@@ -225,7 +225,7 @@
 0:44          'r04' ( temp float)
 0:44          texture ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DShadow)
-0:44              'g_tTex1du4' ( uniform utexture1D)
+0:44              'g_tTex1du4' ( uniform utexture1DShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec2 ( temp 2-component vector of float)
 0:44              Constant:
@@ -237,7 +237,7 @@
 0:47          'r20' ( temp float)
 0:47          texture ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DShadow)
-0:47              'g_tTex2df4' ( uniform texture2D)
+0:47              'g_tTex2df4' ( uniform texture2DShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -250,7 +250,7 @@
 0:48          'r22' ( temp float)
 0:48          texture ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DShadow)
-0:48              'g_tTex2di4' ( uniform itexture2D)
+0:48              'g_tTex2di4' ( uniform itexture2DShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -263,7 +263,7 @@
 0:49          'r24' ( temp float)
 0:49          texture ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DShadow)
-0:49              'g_tTex2du4' ( uniform utexture2D)
+0:49              'g_tTex2du4' ( uniform utexture2DShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -276,7 +276,7 @@
 0:53          'r50' ( temp float)
 0:53          texture ( temp float)
 0:53            Construct combined texture-sampler ( temp samplerCubeShadow)
-0:53              'g_tTexcdf4' ( uniform textureCube)
+0:53              'g_tTexcdf4' ( uniform textureCubeShadow)
 0:53              'g_sSamp' (layout( binding=0) uniform sampler)
 0:53            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -290,7 +290,7 @@
 0:54          'r52' ( temp float)
 0:54          texture ( temp float)
 0:54            Construct combined texture-sampler ( temp isamplerCubeShadow)
-0:54              'g_tTexcdi4' ( uniform itextureCube)
+0:54              'g_tTexcdi4' ( uniform itextureCubeShadow)
 0:54              'g_sSamp' (layout( binding=0) uniform sampler)
 0:54            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -304,7 +304,7 @@
 0:55          'r54' ( temp float)
 0:55          texture ( temp float)
 0:55            Construct combined texture-sampler ( temp usamplerCubeShadow)
-0:55              'g_tTexcdu4' ( uniform utextureCube)
+0:55              'g_tTexcdu4' ( uniform utextureCubeShadow)
 0:55              'g_sSamp' (layout( binding=0) uniform sampler)
 0:55            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -353,18 +353,18 @@
 0:38              1 (const int)
 0:?   Linker Objects
 0:?     'g_sSamp' (layout( binding=0) uniform sampler)
-0:?     'g_tTex1df4' (layout( binding=0) uniform texture1D)
-0:?     'g_tTex1di4' ( uniform itexture1D)
-0:?     'g_tTex1du4' ( uniform utexture1D)
-0:?     'g_tTex2df4' ( uniform texture2D)
-0:?     'g_tTex2di4' ( uniform itexture2D)
-0:?     'g_tTex2du4' ( uniform utexture2D)
+0:?     'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
+0:?     'g_tTex1di4' ( uniform itexture1DShadow)
+0:?     'g_tTex1du4' ( uniform utexture1DShadow)
+0:?     'g_tTex2df4' ( uniform texture2DShadow)
+0:?     'g_tTex2di4' ( uniform itexture2DShadow)
+0:?     'g_tTex2du4' ( uniform utexture2DShadow)
 0:?     'g_tTex3df4' ( uniform texture3D)
 0:?     'g_tTex3di4' ( uniform itexture3D)
 0:?     'g_tTex3du4' ( uniform utexture3D)
-0:?     'g_tTexcdf4' ( uniform textureCube)
-0:?     'g_tTexcdi4' ( uniform itextureCube)
-0:?     'g_tTexcdu4' ( uniform utextureCube)
+0:?     'g_tTexcdf4' ( uniform textureCubeShadow)
+0:?     'g_tTexcdi4' ( uniform itextureCubeShadow)
+0:?     'g_tTexcdu4' ( uniform utextureCubeShadow)
 0:?     'g_tTex1df4a' ( uniform texture1DArray)
 0:?     'g_tTex1di4a' ( uniform itexture1DArray)
 0:?     'g_tTex1du4a' ( uniform utexture1DArray)
@@ -379,14 +379,14 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 207
+// Id's are bound by 198
 
                               Capability Shader
                               Capability Sampled1D
                               Capability SampledCubeArray
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 164 168
+                              EntryPoint Fragment 4  "main" 155 159
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -397,64 +397,64 @@
                               Name 13  "r00"
                               Name 16  "g_tTex1df4"
                               Name 20  "g_sSamp"
-                              Name 31  "r02"
-                              Name 35  "g_tTex1di4"
-                              Name 44  "r04"
-                              Name 48  "g_tTex1du4"
-                              Name 57  "r20"
-                              Name 60  "g_tTex2df4"
-                              Name 74  "r22"
-                              Name 77  "g_tTex2di4"
-                              Name 88  "r24"
-                              Name 91  "g_tTex2du4"
-                              Name 102  "r50"
-                              Name 105  "g_tTexcdf4"
-                              Name 119  "r52"
-                              Name 122  "g_tTexcdi4"
-                              Name 134  "r54"
-                              Name 137  "g_tTexcdu4"
-                              Name 150  "psout"
-                              Name 161  "flattenTemp"
-                              Name 164  "@entryPointOutput.Color"
-                              Name 168  "@entryPointOutput.Depth"
-                              Name 173  "g_tTex3df4"
-                              Name 176  "g_tTex3di4"
-                              Name 179  "g_tTex3du4"
-                              Name 182  "g_tTex1df4a"
-                              Name 185  "g_tTex1di4a"
-                              Name 188  "g_tTex1du4a"
-                              Name 191  "g_tTex2df4a"
-                              Name 194  "g_tTex2di4a"
-                              Name 197  "g_tTex2du4a"
-                              Name 200  "g_tTexcdf4a"
-                              Name 203  "g_tTexcdi4a"
-                              Name 206  "g_tTexcdu4a"
+                              Name 30  "r02"
+                              Name 34  "g_tTex1di4"
+                              Name 42  "r04"
+                              Name 46  "g_tTex1du4"
+                              Name 54  "r20"
+                              Name 57  "g_tTex2df4"
+                              Name 70  "r22"
+                              Name 73  "g_tTex2di4"
+                              Name 83  "r24"
+                              Name 86  "g_tTex2du4"
+                              Name 96  "r50"
+                              Name 99  "g_tTexcdf4"
+                              Name 112  "r52"
+                              Name 115  "g_tTexcdi4"
+                              Name 126  "r54"
+                              Name 129  "g_tTexcdu4"
+                              Name 141  "psout"
+                              Name 152  "flattenTemp"
+                              Name 155  "@entryPointOutput.Color"
+                              Name 159  "@entryPointOutput.Depth"
+                              Name 164  "g_tTex3df4"
+                              Name 167  "g_tTex3di4"
+                              Name 170  "g_tTex3du4"
+                              Name 173  "g_tTex1df4a"
+                              Name 176  "g_tTex1di4a"
+                              Name 179  "g_tTex1du4a"
+                              Name 182  "g_tTex2df4a"
+                              Name 185  "g_tTex2di4a"
+                              Name 188  "g_tTex2du4a"
+                              Name 191  "g_tTexcdf4a"
+                              Name 194  "g_tTexcdi4a"
+                              Name 197  "g_tTexcdu4a"
                               Decorate 16(g_tTex1df4) DescriptorSet 0
                               Decorate 16(g_tTex1df4) Binding 0
                               Decorate 20(g_sSamp) DescriptorSet 0
                               Decorate 20(g_sSamp) Binding 0
-                              Decorate 35(g_tTex1di4) DescriptorSet 0
-                              Decorate 48(g_tTex1du4) DescriptorSet 0
-                              Decorate 60(g_tTex2df4) DescriptorSet 0
-                              Decorate 77(g_tTex2di4) DescriptorSet 0
-                              Decorate 91(g_tTex2du4) DescriptorSet 0
-                              Decorate 105(g_tTexcdf4) DescriptorSet 0
-                              Decorate 122(g_tTexcdi4) DescriptorSet 0
-                              Decorate 137(g_tTexcdu4) DescriptorSet 0
-                              Decorate 164(@entryPointOutput.Color) Location 0
-                              Decorate 168(@entryPointOutput.Depth) BuiltIn FragDepth
-                              Decorate 173(g_tTex3df4) DescriptorSet 0
-                              Decorate 176(g_tTex3di4) DescriptorSet 0
-                              Decorate 179(g_tTex3du4) DescriptorSet 0
-                              Decorate 182(g_tTex1df4a) DescriptorSet 0
-                              Decorate 185(g_tTex1di4a) DescriptorSet 0
-                              Decorate 188(g_tTex1du4a) DescriptorSet 0
-                              Decorate 191(g_tTex2df4a) DescriptorSet 0
-                              Decorate 194(g_tTex2di4a) DescriptorSet 0
-                              Decorate 197(g_tTex2du4a) DescriptorSet 0
-                              Decorate 200(g_tTexcdf4a) DescriptorSet 0
-                              Decorate 203(g_tTexcdi4a) DescriptorSet 0
-                              Decorate 206(g_tTexcdu4a) DescriptorSet 0
+                              Decorate 34(g_tTex1di4) DescriptorSet 0
+                              Decorate 46(g_tTex1du4) DescriptorSet 0
+                              Decorate 57(g_tTex2df4) DescriptorSet 0
+                              Decorate 73(g_tTex2di4) DescriptorSet 0
+                              Decorate 86(g_tTex2du4) DescriptorSet 0
+                              Decorate 99(g_tTexcdf4) DescriptorSet 0
+                              Decorate 115(g_tTexcdi4) DescriptorSet 0
+                              Decorate 129(g_tTexcdu4) DescriptorSet 0
+                              Decorate 155(@entryPointOutput.Color) Location 0
+                              Decorate 159(@entryPointOutput.Depth) BuiltIn FragDepth
+                              Decorate 164(g_tTex3df4) DescriptorSet 0
+                              Decorate 167(g_tTex3di4) DescriptorSet 0
+                              Decorate 170(g_tTex3du4) DescriptorSet 0
+                              Decorate 173(g_tTex1df4a) DescriptorSet 0
+                              Decorate 176(g_tTex1di4a) DescriptorSet 0
+                              Decorate 179(g_tTex1du4a) DescriptorSet 0
+                              Decorate 182(g_tTex2df4a) DescriptorSet 0
+                              Decorate 185(g_tTex2di4a) DescriptorSet 0
+                              Decorate 188(g_tTex2du4a) DescriptorSet 0
+                              Decorate 191(g_tTexcdf4a) DescriptorSet 0
+                              Decorate 194(g_tTexcdi4a) DescriptorSet 0
+                              Decorate 197(g_tTexcdu4a) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -462,217 +462,208 @@
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
                9:             TypeFunction 8(PS_OUTPUT)
               12:             TypePointer Function 6(float)
-              14:             TypeImage 6(float) 1D sampled format:Unknown
+              14:             TypeImage 6(float) 1D depth sampled format:Unknown
               15:             TypePointer UniformConstant 14
   16(g_tTex1df4):     15(ptr) Variable UniformConstant
               18:             TypeSampler
               19:             TypePointer UniformConstant 18
      20(g_sSamp):     19(ptr) Variable UniformConstant
-              22:             TypeImage 6(float) 1D depth sampled format:Unknown
-              23:             TypeSampledImage 22
-              25:    6(float) Constant 1036831949
-              26:    6(float) Constant 1061158912
-              27:             TypeVector 6(float) 2
-              32:             TypeInt 32 1
-              33:             TypeImage 32(int) 1D sampled format:Unknown
-              34:             TypePointer UniformConstant 33
-  35(g_tTex1di4):     34(ptr) Variable UniformConstant
-              38:             TypeImage 32(int) 1D depth sampled format:Unknown
-              39:             TypeSampledImage 38
-              45:             TypeInt 32 0
-              46:             TypeImage 45(int) 1D sampled format:Unknown
-              47:             TypePointer UniformConstant 46
-  48(g_tTex1du4):     47(ptr) Variable UniformConstant
-              51:             TypeImage 45(int) 1D depth sampled format:Unknown
-              52:             TypeSampledImage 51
-              58:             TypeImage 6(float) 2D sampled format:Unknown
-              59:             TypePointer UniformConstant 58
-  60(g_tTex2df4):     59(ptr) Variable UniformConstant
-              63:             TypeImage 6(float) 2D depth sampled format:Unknown
-              64:             TypeSampledImage 63
-              66:    6(float) Constant 1045220557
-              67:   27(fvec2) ConstantComposite 25 66
-              68:             TypeVector 6(float) 3
-              75:             TypeImage 32(int) 2D sampled format:Unknown
-              76:             TypePointer UniformConstant 75
-  77(g_tTex2di4):     76(ptr) Variable UniformConstant
-              80:             TypeImage 32(int) 2D depth sampled format:Unknown
-              81:             TypeSampledImage 80
-              89:             TypeImage 45(int) 2D sampled format:Unknown
-              90:             TypePointer UniformConstant 89
-  91(g_tTex2du4):     90(ptr) Variable UniformConstant
-              94:             TypeImage 45(int) 2D depth sampled format:Unknown
-              95:             TypeSampledImage 94
-             103:             TypeImage 6(float) Cube sampled format:Unknown
-             104:             TypePointer UniformConstant 103
- 105(g_tTexcdf4):    104(ptr) Variable UniformConstant
-             108:             TypeImage 6(float) Cube depth sampled format:Unknown
-             109:             TypeSampledImage 108
-             111:    6(float) Constant 1050253722
-             112:   68(fvec3) ConstantComposite 25 66 111
-             120:             TypeImage 32(int) Cube sampled format:Unknown
-             121:             TypePointer UniformConstant 120
- 122(g_tTexcdi4):    121(ptr) Variable UniformConstant
-             125:             TypeImage 32(int) Cube depth sampled format:Unknown
-             126:             TypeSampledImage 125
-             135:             TypeImage 45(int) Cube sampled format:Unknown
-             136:             TypePointer UniformConstant 135
- 137(g_tTexcdu4):    136(ptr) Variable UniformConstant
-             140:             TypeImage 45(int) Cube depth sampled format:Unknown
-             141:             TypeSampledImage 140
-             149:             TypePointer Function 8(PS_OUTPUT)
-             151:     32(int) Constant 0
-             152:    6(float) Constant 1065353216
-             153:    7(fvec4) ConstantComposite 152 152 152 152
-             154:             TypePointer Function 7(fvec4)
-             156:     32(int) Constant 1
-             163:             TypePointer Output 7(fvec4)
-164(@entryPointOutput.Color):    163(ptr) Variable Output
-             167:             TypePointer Output 6(float)
-168(@entryPointOutput.Depth):    167(ptr) Variable Output
-             171:             TypeImage 6(float) 3D sampled format:Unknown
+              22:             TypeSampledImage 14
+              24:    6(float) Constant 1036831949
+              25:    6(float) Constant 1061158912
+              26:             TypeVector 6(float) 2
+              31:             TypeInt 32 1
+              32:             TypeImage 31(int) 1D depth sampled format:Unknown
+              33:             TypePointer UniformConstant 32
+  34(g_tTex1di4):     33(ptr) Variable UniformConstant
+              37:             TypeSampledImage 32
+              43:             TypeInt 32 0
+              44:             TypeImage 43(int) 1D depth sampled format:Unknown
+              45:             TypePointer UniformConstant 44
+  46(g_tTex1du4):     45(ptr) Variable UniformConstant
+              49:             TypeSampledImage 44
+              55:             TypeImage 6(float) 2D depth sampled format:Unknown
+              56:             TypePointer UniformConstant 55
+  57(g_tTex2df4):     56(ptr) Variable UniformConstant
+              60:             TypeSampledImage 55
+              62:    6(float) Constant 1045220557
+              63:   26(fvec2) ConstantComposite 24 62
+              64:             TypeVector 6(float) 3
+              71:             TypeImage 31(int) 2D depth sampled format:Unknown
+              72:             TypePointer UniformConstant 71
+  73(g_tTex2di4):     72(ptr) Variable UniformConstant
+              76:             TypeSampledImage 71
+              84:             TypeImage 43(int) 2D depth sampled format:Unknown
+              85:             TypePointer UniformConstant 84
+  86(g_tTex2du4):     85(ptr) Variable UniformConstant
+              89:             TypeSampledImage 84
+              97:             TypeImage 6(float) Cube depth sampled format:Unknown
+              98:             TypePointer UniformConstant 97
+  99(g_tTexcdf4):     98(ptr) Variable UniformConstant
+             102:             TypeSampledImage 97
+             104:    6(float) Constant 1050253722
+             105:   64(fvec3) ConstantComposite 24 62 104
+             113:             TypeImage 31(int) Cube depth sampled format:Unknown
+             114:             TypePointer UniformConstant 113
+ 115(g_tTexcdi4):    114(ptr) Variable UniformConstant
+             118:             TypeSampledImage 113
+             127:             TypeImage 43(int) Cube depth sampled format:Unknown
+             128:             TypePointer UniformConstant 127
+ 129(g_tTexcdu4):    128(ptr) Variable UniformConstant
+             132:             TypeSampledImage 127
+             140:             TypePointer Function 8(PS_OUTPUT)
+             142:     31(int) Constant 0
+             143:    6(float) Constant 1065353216
+             144:    7(fvec4) ConstantComposite 143 143 143 143
+             145:             TypePointer Function 7(fvec4)
+             147:     31(int) Constant 1
+             154:             TypePointer Output 7(fvec4)
+155(@entryPointOutput.Color):    154(ptr) Variable Output
+             158:             TypePointer Output 6(float)
+159(@entryPointOutput.Depth):    158(ptr) Variable Output
+             162:             TypeImage 6(float) 3D sampled format:Unknown
+             163:             TypePointer UniformConstant 162
+ 164(g_tTex3df4):    163(ptr) Variable UniformConstant
+             165:             TypeImage 31(int) 3D sampled format:Unknown
+             166:             TypePointer UniformConstant 165
+ 167(g_tTex3di4):    166(ptr) Variable UniformConstant
+             168:             TypeImage 43(int) 3D sampled format:Unknown
+             169:             TypePointer UniformConstant 168
+ 170(g_tTex3du4):    169(ptr) Variable UniformConstant
+             171:             TypeImage 6(float) 1D array sampled format:Unknown
              172:             TypePointer UniformConstant 171
- 173(g_tTex3df4):    172(ptr) Variable UniformConstant
-             174:             TypeImage 32(int) 3D sampled format:Unknown
+173(g_tTex1df4a):    172(ptr) Variable UniformConstant
+             174:             TypeImage 31(int) 1D array sampled format:Unknown
              175:             TypePointer UniformConstant 174
- 176(g_tTex3di4):    175(ptr) Variable UniformConstant
-             177:             TypeImage 45(int) 3D sampled format:Unknown
+176(g_tTex1di4a):    175(ptr) Variable UniformConstant
+             177:             TypeImage 43(int) 1D array sampled format:Unknown
              178:             TypePointer UniformConstant 177
- 179(g_tTex3du4):    178(ptr) Variable UniformConstant
-             180:             TypeImage 6(float) 1D array sampled format:Unknown
+179(g_tTex1du4a):    178(ptr) Variable UniformConstant
+             180:             TypeImage 6(float) 2D array sampled format:Unknown
              181:             TypePointer UniformConstant 180
-182(g_tTex1df4a):    181(ptr) Variable UniformConstant
-             183:             TypeImage 32(int) 1D array sampled format:Unknown
+182(g_tTex2df4a):    181(ptr) Variable UniformConstant
+             183:             TypeImage 31(int) 2D array sampled format:Unknown
              184:             TypePointer UniformConstant 183
-185(g_tTex1di4a):    184(ptr) Variable UniformConstant
-             186:             TypeImage 45(int) 1D array sampled format:Unknown
+185(g_tTex2di4a):    184(ptr) Variable UniformConstant
+             186:             TypeImage 43(int) 2D array sampled format:Unknown
              187:             TypePointer UniformConstant 186
-188(g_tTex1du4a):    187(ptr) Variable UniformConstant
-             189:             TypeImage 6(float) 2D array sampled format:Unknown
+188(g_tTex2du4a):    187(ptr) Variable UniformConstant
+             189:             TypeImage 6(float) Cube array sampled format:Unknown
              190:             TypePointer UniformConstant 189
-191(g_tTex2df4a):    190(ptr) Variable UniformConstant
-             192:             TypeImage 32(int) 2D array sampled format:Unknown
+191(g_tTexcdf4a):    190(ptr) Variable UniformConstant
+             192:             TypeImage 31(int) Cube array sampled format:Unknown
              193:             TypePointer UniformConstant 192
-194(g_tTex2di4a):    193(ptr) Variable UniformConstant
-             195:             TypeImage 45(int) 2D array sampled format:Unknown
+194(g_tTexcdi4a):    193(ptr) Variable UniformConstant
+             195:             TypeImage 43(int) Cube array sampled format:Unknown
              196:             TypePointer UniformConstant 195
-197(g_tTex2du4a):    196(ptr) Variable UniformConstant
-             198:             TypeImage 6(float) Cube array sampled format:Unknown
-             199:             TypePointer UniformConstant 198
-200(g_tTexcdf4a):    199(ptr) Variable UniformConstant
-             201:             TypeImage 32(int) Cube array sampled format:Unknown
-             202:             TypePointer UniformConstant 201
-203(g_tTexcdi4a):    202(ptr) Variable UniformConstant
-             204:             TypeImage 45(int) Cube array sampled format:Unknown
-             205:             TypePointer UniformConstant 204
-206(g_tTexcdu4a):    205(ptr) Variable UniformConstant
+197(g_tTexcdu4a):    196(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
-161(flattenTemp):    149(ptr) Variable Function
-             162:8(PS_OUTPUT) FunctionCall 10(@main()
-                              Store 161(flattenTemp) 162
-             165:    154(ptr) AccessChain 161(flattenTemp) 151
-             166:    7(fvec4) Load 165
-                              Store 164(@entryPointOutput.Color) 166
-             169:     12(ptr) AccessChain 161(flattenTemp) 156
-             170:    6(float) Load 169
-                              Store 168(@entryPointOutput.Depth) 170
+152(flattenTemp):    140(ptr) Variable Function
+             153:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 152(flattenTemp) 153
+             156:    145(ptr) AccessChain 152(flattenTemp) 142
+             157:    7(fvec4) Load 156
+                              Store 155(@entryPointOutput.Color) 157
+             160:     12(ptr) AccessChain 152(flattenTemp) 147
+             161:    6(float) Load 160
+                              Store 159(@entryPointOutput.Depth) 161
                               Return
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
          13(r00):     12(ptr) Variable Function
-         31(r02):     12(ptr) Variable Function
-         44(r04):     12(ptr) Variable Function
-         57(r20):     12(ptr) Variable Function
-         74(r22):     12(ptr) Variable Function
-         88(r24):     12(ptr) Variable Function
-        102(r50):     12(ptr) Variable Function
-        119(r52):     12(ptr) Variable Function
-        134(r54):     12(ptr) Variable Function
-      150(psout):    149(ptr) Variable Function
+         30(r02):     12(ptr) Variable Function
+         42(r04):     12(ptr) Variable Function
+         54(r20):     12(ptr) Variable Function
+         70(r22):     12(ptr) Variable Function
+         83(r24):     12(ptr) Variable Function
+         96(r50):     12(ptr) Variable Function
+        112(r52):     12(ptr) Variable Function
+        126(r54):     12(ptr) Variable Function
+      141(psout):    140(ptr) Variable Function
               17:          14 Load 16(g_tTex1df4)
               21:          18 Load 20(g_sSamp)
-              24:          23 SampledImage 17 21
-              28:   27(fvec2) CompositeConstruct 25 26
-              29:    6(float) CompositeExtract 28 1
-              30:    6(float) ImageSampleDrefImplicitLod 24 28 29
-                              Store 13(r00) 30
-              36:          33 Load 35(g_tTex1di4)
-              37:          18 Load 20(g_sSamp)
-              40:          39 SampledImage 36 37
-              41:   27(fvec2) CompositeConstruct 25 26
-              42:    6(float) CompositeExtract 41 1
-              43:    6(float) ImageSampleDrefImplicitLod 40 41 42
-                              Store 31(r02) 43
-              49:          46 Load 48(g_tTex1du4)
-              50:          18 Load 20(g_sSamp)
-              53:          52 SampledImage 49 50
-              54:   27(fvec2) CompositeConstruct 25 26
-              55:    6(float) CompositeExtract 54 1
-              56:    6(float) ImageSampleDrefImplicitLod 53 54 55
-                              Store 44(r04) 56
-              61:          58 Load 60(g_tTex2df4)
-              62:          18 Load 20(g_sSamp)
-              65:          64 SampledImage 61 62
-              69:    6(float) CompositeExtract 67 0
-              70:    6(float) CompositeExtract 67 1
-              71:   68(fvec3) CompositeConstruct 69 70 26
-              72:    6(float) CompositeExtract 71 2
-              73:    6(float) ImageSampleDrefImplicitLod 65 71 72
-                              Store 57(r20) 73
-              78:          75 Load 77(g_tTex2di4)
-              79:          18 Load 20(g_sSamp)
-              82:          81 SampledImage 78 79
-              83:    6(float) CompositeExtract 67 0
-              84:    6(float) CompositeExtract 67 1
-              85:   68(fvec3) CompositeConstruct 83 84 26
-              86:    6(float) CompositeExtract 85 2
-              87:    6(float) ImageSampleDrefImplicitLod 82 85 86
-                              Store 74(r22) 87
-              92:          89 Load 91(g_tTex2du4)
-              93:          18 Load 20(g_sSamp)
-              96:          95 SampledImage 92 93
-              97:    6(float) CompositeExtract 67 0
-              98:    6(float) CompositeExtract 67 1
-              99:   68(fvec3) CompositeConstruct 97 98 26
-             100:    6(float) CompositeExtract 99 2
-             101:    6(float) ImageSampleDrefImplicitLod 96 99 100
-                              Store 88(r24) 101
-             106:         103 Load 105(g_tTexcdf4)
-             107:          18 Load 20(g_sSamp)
-             110:         109 SampledImage 106 107
-             113:    6(float) CompositeExtract 112 0
-             114:    6(float) CompositeExtract 112 1
-             115:    6(float) CompositeExtract 112 2
-             116:    7(fvec4) CompositeConstruct 113 114 115 26
-             117:    6(float) CompositeExtract 116 3
-             118:    6(float) ImageSampleDrefImplicitLod 110 116 117
-                              Store 102(r50) 118
-             123:         120 Load 122(g_tTexcdi4)
-             124:          18 Load 20(g_sSamp)
-             127:         126 SampledImage 123 124
-             128:    6(float) CompositeExtract 112 0
-             129:    6(float) CompositeExtract 112 1
-             130:    6(float) CompositeExtract 112 2
-             131:    7(fvec4) CompositeConstruct 128 129 130 26
-             132:    6(float) CompositeExtract 131 3
-             133:    6(float) ImageSampleDrefImplicitLod 127 131 132
-                              Store 119(r52) 133
-             138:         135 Load 137(g_tTexcdu4)
-             139:          18 Load 20(g_sSamp)
-             142:         141 SampledImage 138 139
-             143:    6(float) CompositeExtract 112 0
-             144:    6(float) CompositeExtract 112 1
-             145:    6(float) CompositeExtract 112 2
-             146:    7(fvec4) CompositeConstruct 143 144 145 26
-             147:    6(float) CompositeExtract 146 3
-             148:    6(float) ImageSampleDrefImplicitLod 142 146 147
-                              Store 134(r54) 148
-             155:    154(ptr) AccessChain 150(psout) 151
-                              Store 155 153
-             157:     12(ptr) AccessChain 150(psout) 156
-                              Store 157 152
-             158:8(PS_OUTPUT) Load 150(psout)
-                              ReturnValue 158
+              23:          22 SampledImage 17 21
+              27:   26(fvec2) CompositeConstruct 24 25
+              28:    6(float) CompositeExtract 27 1
+              29:    6(float) ImageSampleDrefImplicitLod 23 27 28
+                              Store 13(r00) 29
+              35:          32 Load 34(g_tTex1di4)
+              36:          18 Load 20(g_sSamp)
+              38:          37 SampledImage 35 36
+              39:   26(fvec2) CompositeConstruct 24 25
+              40:    6(float) CompositeExtract 39 1
+              41:    6(float) ImageSampleDrefImplicitLod 38 39 40
+                              Store 30(r02) 41
+              47:          44 Load 46(g_tTex1du4)
+              48:          18 Load 20(g_sSamp)
+              50:          49 SampledImage 47 48
+              51:   26(fvec2) CompositeConstruct 24 25
+              52:    6(float) CompositeExtract 51 1
+              53:    6(float) ImageSampleDrefImplicitLod 50 51 52
+                              Store 42(r04) 53
+              58:          55 Load 57(g_tTex2df4)
+              59:          18 Load 20(g_sSamp)
+              61:          60 SampledImage 58 59
+              65:    6(float) CompositeExtract 63 0
+              66:    6(float) CompositeExtract 63 1
+              67:   64(fvec3) CompositeConstruct 65 66 25
+              68:    6(float) CompositeExtract 67 2
+              69:    6(float) ImageSampleDrefImplicitLod 61 67 68
+                              Store 54(r20) 69
+              74:          71 Load 73(g_tTex2di4)
+              75:          18 Load 20(g_sSamp)
+              77:          76 SampledImage 74 75
+              78:    6(float) CompositeExtract 63 0
+              79:    6(float) CompositeExtract 63 1
+              80:   64(fvec3) CompositeConstruct 78 79 25
+              81:    6(float) CompositeExtract 80 2
+              82:    6(float) ImageSampleDrefImplicitLod 77 80 81
+                              Store 70(r22) 82
+              87:          84 Load 86(g_tTex2du4)
+              88:          18 Load 20(g_sSamp)
+              90:          89 SampledImage 87 88
+              91:    6(float) CompositeExtract 63 0
+              92:    6(float) CompositeExtract 63 1
+              93:   64(fvec3) CompositeConstruct 91 92 25
+              94:    6(float) CompositeExtract 93 2
+              95:    6(float) ImageSampleDrefImplicitLod 90 93 94
+                              Store 83(r24) 95
+             100:          97 Load 99(g_tTexcdf4)
+             101:          18 Load 20(g_sSamp)
+             103:         102 SampledImage 100 101
+             106:    6(float) CompositeExtract 105 0
+             107:    6(float) CompositeExtract 105 1
+             108:    6(float) CompositeExtract 105 2
+             109:    7(fvec4) CompositeConstruct 106 107 108 25
+             110:    6(float) CompositeExtract 109 3
+             111:    6(float) ImageSampleDrefImplicitLod 103 109 110
+                              Store 96(r50) 111
+             116:         113 Load 115(g_tTexcdi4)
+             117:          18 Load 20(g_sSamp)
+             119:         118 SampledImage 116 117
+             120:    6(float) CompositeExtract 105 0
+             121:    6(float) CompositeExtract 105 1
+             122:    6(float) CompositeExtract 105 2
+             123:    7(fvec4) CompositeConstruct 120 121 122 25
+             124:    6(float) CompositeExtract 123 3
+             125:    6(float) ImageSampleDrefImplicitLod 119 123 124
+                              Store 112(r52) 125
+             130:         127 Load 129(g_tTexcdu4)
+             131:          18 Load 20(g_sSamp)
+             133:         132 SampledImage 130 131
+             134:    6(float) CompositeExtract 105 0
+             135:    6(float) CompositeExtract 105 1
+             136:    6(float) CompositeExtract 105 2
+             137:    7(fvec4) CompositeConstruct 134 135 136 25
+             138:    6(float) CompositeExtract 137 3
+             139:    6(float) ImageSampleDrefImplicitLod 133 137 138
+                              Store 126(r54) 139
+             146:    145(ptr) AccessChain 141(psout) 142
+                              Store 146 144
+             148:     12(ptr) AccessChain 141(psout) 147
+                              Store 148 143
+             149:8(PS_OUTPUT) Load 141(psout)
+                              ReturnValue 149
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.samplecmp.dualmode.frag.out b/Test/baseResults/hlsl.samplecmp.dualmode.frag.out
new file mode 100644
index 0000000..4ac0d77
--- /dev/null
+++ b/Test/baseResults/hlsl.samplecmp.dualmode.frag.out
@@ -0,0 +1,157 @@
+hlsl.samplecmp.dualmode.frag
+WARNING: AST will form illegal SPIR-V; need to transform to legalize
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:7  Function Definition: @main( ( temp 4-component vector of float)
+0:7    Function Parameters: 
+0:?     Sequence
+0:10      texture ( temp float)
+0:10        Construct combined texture-sampler ( temp sampler1DShadow)
+0:10          'g_tTex' (layout( binding=3) uniform texture1DShadow)
+0:10          'g_sSampCmp' (layout( binding=1) uniform sampler)
+0:10        Construct vec2 ( temp 2-component vector of float)
+0:10          Constant:
+0:10            0.100000
+0:10          Constant:
+0:10            0.750000
+0:11      texture ( temp 4-component vector of float)
+0:11        Construct combined texture-sampler ( temp sampler1D)
+0:11          'g_tTex' (layout( binding=3) uniform texture1D)
+0:11          'g_sSamp' (layout( binding=0) uniform sampler)
+0:11        Constant:
+0:11          0.100000
+0:13      Branch: Return with expression
+0:13        Constant:
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:7  Function Definition: main( ( temp void)
+0:7    Function Parameters: 
+0:?     Sequence
+0:7      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:7        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'g_sSamp' (layout( binding=0) uniform sampler)
+0:?     'g_sSampCmp' (layout( binding=1) uniform sampler)
+0:?     'g_tTex' (layout( binding=3) uniform texture1DShadow)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'g_tTex' (layout( binding=3) uniform texture1D)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:7  Function Definition: @main( ( temp 4-component vector of float)
+0:7    Function Parameters: 
+0:?     Sequence
+0:10      texture ( temp float)
+0:10        Construct combined texture-sampler ( temp sampler1DShadow)
+0:10          'g_tTex' (layout( binding=3) uniform texture1DShadow)
+0:10          'g_sSampCmp' (layout( binding=1) uniform sampler)
+0:10        Construct vec2 ( temp 2-component vector of float)
+0:10          Constant:
+0:10            0.100000
+0:10          Constant:
+0:10            0.750000
+0:11      texture ( temp 4-component vector of float)
+0:11        Construct combined texture-sampler ( temp sampler1D)
+0:11          'g_tTex' (layout( binding=3) uniform texture1D)
+0:11          'g_sSamp' (layout( binding=0) uniform sampler)
+0:11        Constant:
+0:11          0.100000
+0:13      Branch: Return with expression
+0:13        Constant:
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:13          0.000000
+0:7  Function Definition: main( ( temp void)
+0:7    Function Parameters: 
+0:?     Sequence
+0:7      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:7        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'g_sSamp' (layout( binding=0) uniform sampler)
+0:?     'g_sSampCmp' (layout( binding=1) uniform sampler)
+0:?     'g_tTex' (layout( binding=3) uniform texture1DShadow)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:?     'g_tTex' (layout( binding=3) uniform texture1D)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 43
+
+                              Capability Shader
+                              Capability Sampled1D
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 41
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 9  "@main("
+                              Name 13  "g_tTex"
+                              Name 17  "g_sSampCmp"
+                              Name 29  "g_tTex"
+                              Name 31  "g_sSamp"
+                              Name 41  "@entryPointOutput"
+                              Decorate 13(g_tTex) DescriptorSet 0
+                              Decorate 13(g_tTex) Binding 3
+                              Decorate 17(g_sSampCmp) DescriptorSet 0
+                              Decorate 17(g_sSampCmp) Binding 1
+                              Decorate 29(g_tTex) DescriptorSet 0
+                              Decorate 29(g_tTex) Binding 3
+                              Decorate 31(g_sSamp) DescriptorSet 0
+                              Decorate 31(g_sSamp) Binding 0
+                              Decorate 41(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+              11:             TypeImage 6(float) 1D depth sampled format:Unknown
+              12:             TypePointer UniformConstant 11
+      13(g_tTex):     12(ptr) Variable UniformConstant
+              15:             TypeSampler
+              16:             TypePointer UniformConstant 15
+  17(g_sSampCmp):     16(ptr) Variable UniformConstant
+              19:             TypeSampledImage 11
+              21:    6(float) Constant 1036831949
+              22:    6(float) Constant 1061158912
+              23:             TypeVector 6(float) 2
+              27:             TypeImage 6(float) 1D sampled format:Unknown
+              28:             TypePointer UniformConstant 27
+      29(g_tTex):     28(ptr) Variable UniformConstant
+     31(g_sSamp):     16(ptr) Variable UniformConstant
+              33:             TypeSampledImage 27
+              36:    6(float) Constant 0
+              37:    7(fvec4) ConstantComposite 36 36 36 36
+              40:             TypePointer Output 7(fvec4)
+41(@entryPointOutput):     40(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              42:    7(fvec4) FunctionCall 9(@main()
+                              Store 41(@entryPointOutput) 42
+                              Return
+                              FunctionEnd
+       9(@main():    7(fvec4) Function None 8
+              10:             Label
+              14:          11 Load 13(g_tTex)
+              18:          15 Load 17(g_sSampCmp)
+              20:          19 SampledImage 14 18
+              24:   23(fvec2) CompositeConstruct 21 22
+              25:    6(float) CompositeExtract 24 1
+              26:    6(float) ImageSampleDrefImplicitLod 20 24 25
+              30:          27 Load 29(g_tTex)
+              32:          15 Load 31(g_sSamp)
+              34:          33 SampledImage 30 32
+              35:    7(fvec4) ImageSampleImplicitLod 34 21
+                              ReturnValue 37
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.samplecmp.negative.frag.out b/Test/baseResults/hlsl.samplecmp.negative.frag.out
index 99cfdbf..65a69e8 100644
--- a/Test/baseResults/hlsl.samplecmp.negative.frag.out
+++ b/Test/baseResults/hlsl.samplecmp.negative.frag.out
@@ -1,47 +1,48 @@
 hlsl.samplecmp.negative.frag
-ERROR: 0:9: '' : expected: SamplerComparisonState 
+ERROR: 0:10: '' : expected: SamplerComparisonState 
 ERROR: 1 compilation errors.  No code generated.
 
 
 Shader version: 500
 gl_FragCoord origin is upper left
 ERROR: node is still EOpNull!
-0:7  Function Definition: @main( ( temp 4-component vector of float)
-0:7    Function Parameters: 
+0:8  Function Definition: @main( ( temp 4-component vector of float)
+0:8    Function Parameters: 
 0:?     Sequence
-0:8      texture ( temp float)
-0:8        Construct combined texture-sampler ( temp sampler2DShadow)
-0:8          'g_shadowTex' ( uniform texture2D)
-0:8          'g_shadowSamplerComp' ( uniform sampler)
-0:8        Construct vec3 ( temp 3-component vector of float)
+0:9      texture ( temp float)
+0:9        Construct combined texture-sampler ( temp sampler2DShadow)
+0:9          'g_shadowTex' ( uniform texture2DShadow)
+0:9          'g_shadowSamplerComp' ( uniform sampler)
+0:9        Construct vec3 ( temp 3-component vector of float)
 0:?           Constant:
 0:?             0.000000
 0:?             0.000000
-0:8          Constant:
-0:8            0.000000
-0:9      ERROR: Bad aggregation op
+0:9          Constant:
+0:9            0.000000
+0:10      ERROR: Bad aggregation op
  ( temp float)
-0:9        'g_shadowTex' ( uniform texture2D)
-0:9        'g_shadowSampler' ( uniform sampler)
+0:10        'g_nonShadowTex' ( uniform texture2D)
+0:10        'g_shadowSampler' ( uniform sampler)
 0:?         Constant:
 0:?           0.000000
 0:?           0.000000
-0:9        Constant:
-0:9          0.000000
-0:11      Branch: Return with expression
-0:11        Constant:
-0:11          0.000000
-0:11          0.000000
-0:11          0.000000
-0:11          0.000000
-0:7  Function Definition: main( ( temp void)
-0:7    Function Parameters: 
+0:10        Constant:
+0:10          0.000000
+0:12      Branch: Return with expression
+0:12        Constant:
+0:12          0.000000
+0:12          0.000000
+0:12          0.000000
+0:12          0.000000
+0:8  Function Definition: main( ( temp void)
+0:8    Function Parameters: 
 0:?     Sequence
-0:7      move second child to first child ( temp 4-component vector of float)
+0:8      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:7        Function Call: @main( ( temp 4-component vector of float)
+0:8        Function Call: @main( ( temp 4-component vector of float)
 0:?   Linker Objects
-0:?     'g_shadowTex' ( uniform texture2D)
+0:?     'g_nonShadowTex' ( uniform texture2D)
+0:?     'g_shadowTex' ( uniform texture2DShadow)
 0:?     'g_shadowSampler' ( uniform sampler)
 0:?     'g_shadowSamplerComp' ( uniform sampler)
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
@@ -53,42 +54,43 @@
 Shader version: 500
 gl_FragCoord origin is upper left
 ERROR: node is still EOpNull!
-0:7  Function Definition: @main( ( temp 4-component vector of float)
-0:7    Function Parameters: 
+0:8  Function Definition: @main( ( temp 4-component vector of float)
+0:8    Function Parameters: 
 0:?     Sequence
-0:8      texture ( temp float)
-0:8        Construct combined texture-sampler ( temp sampler2DShadow)
-0:8          'g_shadowTex' ( uniform texture2D)
-0:8          'g_shadowSamplerComp' ( uniform sampler)
-0:8        Construct vec3 ( temp 3-component vector of float)
+0:9      texture ( temp float)
+0:9        Construct combined texture-sampler ( temp sampler2DShadow)
+0:9          'g_shadowTex' ( uniform texture2DShadow)
+0:9          'g_shadowSamplerComp' ( uniform sampler)
+0:9        Construct vec3 ( temp 3-component vector of float)
 0:?           Constant:
 0:?             0.000000
 0:?             0.000000
-0:8          Constant:
-0:8            0.000000
-0:9      ERROR: Bad aggregation op
+0:9          Constant:
+0:9            0.000000
+0:10      ERROR: Bad aggregation op
  ( temp float)
-0:9        'g_shadowTex' ( uniform texture2D)
-0:9        'g_shadowSampler' ( uniform sampler)
+0:10        'g_nonShadowTex' ( uniform texture2D)
+0:10        'g_shadowSampler' ( uniform sampler)
 0:?         Constant:
 0:?           0.000000
 0:?           0.000000
-0:9        Constant:
-0:9          0.000000
-0:11      Branch: Return with expression
-0:11        Constant:
-0:11          0.000000
-0:11          0.000000
-0:11          0.000000
-0:11          0.000000
-0:7  Function Definition: main( ( temp void)
-0:7    Function Parameters: 
+0:10        Constant:
+0:10          0.000000
+0:12      Branch: Return with expression
+0:12        Constant:
+0:12          0.000000
+0:12          0.000000
+0:12          0.000000
+0:12          0.000000
+0:8  Function Definition: main( ( temp void)
+0:8    Function Parameters: 
 0:?     Sequence
-0:7      move second child to first child ( temp 4-component vector of float)
+0:8      move second child to first child ( temp 4-component vector of float)
 0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
-0:7        Function Call: @main( ( temp 4-component vector of float)
+0:8        Function Call: @main( ( temp 4-component vector of float)
 0:?   Linker Objects
-0:?     'g_shadowTex' ( uniform texture2D)
+0:?     'g_nonShadowTex' ( uniform texture2D)
+0:?     'g_shadowTex' ( uniform texture2DShadow)
 0:?     'g_shadowSampler' ( uniform sampler)
 0:?     'g_shadowSamplerComp' ( uniform sampler)
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
diff --git a/Test/baseResults/hlsl.samplecmp.offset.dx10.frag.out b/Test/baseResults/hlsl.samplecmp.offset.dx10.frag.out
index 02b05c7..5b59ab8 100644
--- a/Test/baseResults/hlsl.samplecmp.offset.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplecmp.offset.dx10.frag.out
@@ -10,7 +10,7 @@
 0:42          'r01' ( temp float)
 0:42          textureOffset ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DShadow)
-0:42              'g_tTex1df4' (layout( binding=0) uniform texture1D)
+0:42              'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec2 ( temp 2-component vector of float)
 0:42              Constant:
@@ -24,7 +24,7 @@
 0:43          'r03' ( temp float)
 0:43          textureOffset ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DShadow)
-0:43              'g_tTex1di4' ( uniform itexture1D)
+0:43              'g_tTex1di4' ( uniform itexture1DShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec2 ( temp 2-component vector of float)
 0:43              Constant:
@@ -38,7 +38,7 @@
 0:44          'r05' ( temp float)
 0:44          textureOffset ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DShadow)
-0:44              'g_tTex1du4' ( uniform utexture1D)
+0:44              'g_tTex1du4' ( uniform utexture1DShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec2 ( temp 2-component vector of float)
 0:44              Constant:
@@ -52,7 +52,7 @@
 0:47          'r21' ( temp float)
 0:47          textureOffset ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DShadow)
-0:47              'g_tTex2df4' ( uniform texture2D)
+0:47              'g_tTex2df4' ( uniform texture2DShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -68,7 +68,7 @@
 0:48          'r23' ( temp float)
 0:48          textureOffset ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DShadow)
-0:48              'g_tTex2di4' ( uniform itexture2D)
+0:48              'g_tTex2di4' ( uniform itexture2DShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -84,7 +84,7 @@
 0:49          'r25' ( temp float)
 0:49          textureOffset ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DShadow)
-0:49              'g_tTex2du4' ( uniform utexture2D)
+0:49              'g_tTex2du4' ( uniform utexture2DShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -135,12 +135,12 @@
 0:38              1 (const int)
 0:?   Linker Objects
 0:?     'g_sSamp' (layout( binding=0) uniform sampler)
-0:?     'g_tTex1df4' (layout( binding=0) uniform texture1D)
-0:?     'g_tTex1di4' ( uniform itexture1D)
-0:?     'g_tTex1du4' ( uniform utexture1D)
-0:?     'g_tTex2df4' ( uniform texture2D)
-0:?     'g_tTex2di4' ( uniform itexture2D)
-0:?     'g_tTex2du4' ( uniform utexture2D)
+0:?     'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
+0:?     'g_tTex1di4' ( uniform itexture1DShadow)
+0:?     'g_tTex1du4' ( uniform utexture1DShadow)
+0:?     'g_tTex2df4' ( uniform texture2DShadow)
+0:?     'g_tTex2di4' ( uniform itexture2DShadow)
+0:?     'g_tTex2du4' ( uniform utexture2DShadow)
 0:?     'g_tTex3df4' ( uniform texture3D)
 0:?     'g_tTex3di4' ( uniform itexture3D)
 0:?     'g_tTex3du4' ( uniform utexture3D)
@@ -174,7 +174,7 @@
 0:42          'r01' ( temp float)
 0:42          textureOffset ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DShadow)
-0:42              'g_tTex1df4' (layout( binding=0) uniform texture1D)
+0:42              'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec2 ( temp 2-component vector of float)
 0:42              Constant:
@@ -188,7 +188,7 @@
 0:43          'r03' ( temp float)
 0:43          textureOffset ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DShadow)
-0:43              'g_tTex1di4' ( uniform itexture1D)
+0:43              'g_tTex1di4' ( uniform itexture1DShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec2 ( temp 2-component vector of float)
 0:43              Constant:
@@ -202,7 +202,7 @@
 0:44          'r05' ( temp float)
 0:44          textureOffset ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DShadow)
-0:44              'g_tTex1du4' ( uniform utexture1D)
+0:44              'g_tTex1du4' ( uniform utexture1DShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec2 ( temp 2-component vector of float)
 0:44              Constant:
@@ -216,7 +216,7 @@
 0:47          'r21' ( temp float)
 0:47          textureOffset ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DShadow)
-0:47              'g_tTex2df4' ( uniform texture2D)
+0:47              'g_tTex2df4' ( uniform texture2DShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -232,7 +232,7 @@
 0:48          'r23' ( temp float)
 0:48          textureOffset ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DShadow)
-0:48              'g_tTex2di4' ( uniform itexture2D)
+0:48              'g_tTex2di4' ( uniform itexture2DShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -248,7 +248,7 @@
 0:49          'r25' ( temp float)
 0:49          textureOffset ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DShadow)
-0:49              'g_tTex2du4' ( uniform utexture2D)
+0:49              'g_tTex2du4' ( uniform utexture2DShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -299,12 +299,12 @@
 0:38              1 (const int)
 0:?   Linker Objects
 0:?     'g_sSamp' (layout( binding=0) uniform sampler)
-0:?     'g_tTex1df4' (layout( binding=0) uniform texture1D)
-0:?     'g_tTex1di4' ( uniform itexture1D)
-0:?     'g_tTex1du4' ( uniform utexture1D)
-0:?     'g_tTex2df4' ( uniform texture2D)
-0:?     'g_tTex2di4' ( uniform itexture2D)
-0:?     'g_tTex2du4' ( uniform utexture2D)
+0:?     'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
+0:?     'g_tTex1di4' ( uniform itexture1DShadow)
+0:?     'g_tTex1du4' ( uniform utexture1DShadow)
+0:?     'g_tTex2df4' ( uniform texture2DShadow)
+0:?     'g_tTex2di4' ( uniform itexture2DShadow)
+0:?     'g_tTex2du4' ( uniform utexture2DShadow)
 0:?     'g_tTex3df4' ( uniform texture3D)
 0:?     'g_tTex3di4' ( uniform itexture3D)
 0:?     'g_tTex3du4' ( uniform utexture3D)
@@ -325,14 +325,14 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 173
+// Id's are bound by 167
 
                               Capability Shader
                               Capability Sampled1D
                               Capability SampledCubeArray
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 121 125
+                              EntryPoint Fragment 4  "main" 115 119
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -343,61 +343,61 @@
                               Name 13  "r01"
                               Name 16  "g_tTex1df4"
                               Name 20  "g_sSamp"
-                              Name 33  "r03"
-                              Name 36  "g_tTex1di4"
-                              Name 45  "r05"
-                              Name 49  "g_tTex1du4"
-                              Name 58  "r21"
-                              Name 61  "g_tTex2df4"
-                              Name 78  "r23"
-                              Name 81  "g_tTex2di4"
-                              Name 92  "r25"
-                              Name 95  "g_tTex2du4"
-                              Name 107  "psout"
-                              Name 118  "flattenTemp"
-                              Name 121  "@entryPointOutput.Color"
-                              Name 125  "@entryPointOutput.Depth"
-                              Name 130  "g_tTex3df4"
-                              Name 133  "g_tTex3di4"
-                              Name 136  "g_tTex3du4"
-                              Name 139  "g_tTexcdf4"
-                              Name 142  "g_tTexcdi4"
-                              Name 145  "g_tTexcdu4"
-                              Name 148  "g_tTex1df4a"
-                              Name 151  "g_tTex1di4a"
-                              Name 154  "g_tTex1du4a"
-                              Name 157  "g_tTex2df4a"
-                              Name 160  "g_tTex2di4a"
-                              Name 163  "g_tTex2du4a"
-                              Name 166  "g_tTexcdf4a"
-                              Name 169  "g_tTexcdi4a"
-                              Name 172  "g_tTexcdu4a"
+                              Name 32  "r03"
+                              Name 35  "g_tTex1di4"
+                              Name 43  "r05"
+                              Name 47  "g_tTex1du4"
+                              Name 55  "r21"
+                              Name 58  "g_tTex2df4"
+                              Name 74  "r23"
+                              Name 77  "g_tTex2di4"
+                              Name 87  "r25"
+                              Name 90  "g_tTex2du4"
+                              Name 101  "psout"
+                              Name 112  "flattenTemp"
+                              Name 115  "@entryPointOutput.Color"
+                              Name 119  "@entryPointOutput.Depth"
+                              Name 124  "g_tTex3df4"
+                              Name 127  "g_tTex3di4"
+                              Name 130  "g_tTex3du4"
+                              Name 133  "g_tTexcdf4"
+                              Name 136  "g_tTexcdi4"
+                              Name 139  "g_tTexcdu4"
+                              Name 142  "g_tTex1df4a"
+                              Name 145  "g_tTex1di4a"
+                              Name 148  "g_tTex1du4a"
+                              Name 151  "g_tTex2df4a"
+                              Name 154  "g_tTex2di4a"
+                              Name 157  "g_tTex2du4a"
+                              Name 160  "g_tTexcdf4a"
+                              Name 163  "g_tTexcdi4a"
+                              Name 166  "g_tTexcdu4a"
                               Decorate 16(g_tTex1df4) DescriptorSet 0
                               Decorate 16(g_tTex1df4) Binding 0
                               Decorate 20(g_sSamp) DescriptorSet 0
                               Decorate 20(g_sSamp) Binding 0
-                              Decorate 36(g_tTex1di4) DescriptorSet 0
-                              Decorate 49(g_tTex1du4) DescriptorSet 0
-                              Decorate 61(g_tTex2df4) DescriptorSet 0
-                              Decorate 81(g_tTex2di4) DescriptorSet 0
-                              Decorate 95(g_tTex2du4) DescriptorSet 0
-                              Decorate 121(@entryPointOutput.Color) Location 0
-                              Decorate 125(@entryPointOutput.Depth) BuiltIn FragDepth
-                              Decorate 130(g_tTex3df4) DescriptorSet 0
-                              Decorate 133(g_tTex3di4) DescriptorSet 0
-                              Decorate 136(g_tTex3du4) DescriptorSet 0
-                              Decorate 139(g_tTexcdf4) DescriptorSet 0
-                              Decorate 142(g_tTexcdi4) DescriptorSet 0
-                              Decorate 145(g_tTexcdu4) DescriptorSet 0
-                              Decorate 148(g_tTex1df4a) DescriptorSet 0
-                              Decorate 151(g_tTex1di4a) DescriptorSet 0
-                              Decorate 154(g_tTex1du4a) DescriptorSet 0
-                              Decorate 157(g_tTex2df4a) DescriptorSet 0
-                              Decorate 160(g_tTex2di4a) DescriptorSet 0
-                              Decorate 163(g_tTex2du4a) DescriptorSet 0
-                              Decorate 166(g_tTexcdf4a) DescriptorSet 0
-                              Decorate 169(g_tTexcdi4a) DescriptorSet 0
-                              Decorate 172(g_tTexcdu4a) DescriptorSet 0
+                              Decorate 35(g_tTex1di4) DescriptorSet 0
+                              Decorate 47(g_tTex1du4) DescriptorSet 0
+                              Decorate 58(g_tTex2df4) DescriptorSet 0
+                              Decorate 77(g_tTex2di4) DescriptorSet 0
+                              Decorate 90(g_tTex2du4) DescriptorSet 0
+                              Decorate 115(@entryPointOutput.Color) Location 0
+                              Decorate 119(@entryPointOutput.Depth) BuiltIn FragDepth
+                              Decorate 124(g_tTex3df4) DescriptorSet 0
+                              Decorate 127(g_tTex3di4) DescriptorSet 0
+                              Decorate 130(g_tTex3du4) DescriptorSet 0
+                              Decorate 133(g_tTexcdf4) DescriptorSet 0
+                              Decorate 136(g_tTexcdi4) DescriptorSet 0
+                              Decorate 139(g_tTexcdu4) DescriptorSet 0
+                              Decorate 142(g_tTex1df4a) DescriptorSet 0
+                              Decorate 145(g_tTex1di4a) DescriptorSet 0
+                              Decorate 148(g_tTex1du4a) DescriptorSet 0
+                              Decorate 151(g_tTex2df4a) DescriptorSet 0
+                              Decorate 154(g_tTex2di4a) DescriptorSet 0
+                              Decorate 157(g_tTex2du4a) DescriptorSet 0
+                              Decorate 160(g_tTexcdf4a) DescriptorSet 0
+                              Decorate 163(g_tTexcdi4a) DescriptorSet 0
+                              Decorate 166(g_tTexcdu4a) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -405,180 +405,174 @@
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
                9:             TypeFunction 8(PS_OUTPUT)
               12:             TypePointer Function 6(float)
-              14:             TypeImage 6(float) 1D sampled format:Unknown
+              14:             TypeImage 6(float) 1D depth sampled format:Unknown
               15:             TypePointer UniformConstant 14
   16(g_tTex1df4):     15(ptr) Variable UniformConstant
               18:             TypeSampler
               19:             TypePointer UniformConstant 18
      20(g_sSamp):     19(ptr) Variable UniformConstant
-              22:             TypeImage 6(float) 1D depth sampled format:Unknown
-              23:             TypeSampledImage 22
-              25:    6(float) Constant 1036831949
-              26:    6(float) Constant 1061158912
-              27:             TypeVector 6(float) 2
-              29:             TypeInt 32 1
-              30:     29(int) Constant 2
-              34:             TypeImage 29(int) 1D sampled format:Unknown
-              35:             TypePointer UniformConstant 34
-  36(g_tTex1di4):     35(ptr) Variable UniformConstant
-              39:             TypeImage 29(int) 1D depth sampled format:Unknown
-              40:             TypeSampledImage 39
-              46:             TypeInt 32 0
-              47:             TypeImage 46(int) 1D sampled format:Unknown
-              48:             TypePointer UniformConstant 47
-  49(g_tTex1du4):     48(ptr) Variable UniformConstant
-              52:             TypeImage 46(int) 1D depth sampled format:Unknown
-              53:             TypeSampledImage 52
-              59:             TypeImage 6(float) 2D sampled format:Unknown
-              60:             TypePointer UniformConstant 59
-  61(g_tTex2df4):     60(ptr) Variable UniformConstant
-              64:             TypeImage 6(float) 2D depth sampled format:Unknown
-              65:             TypeSampledImage 64
-              67:    6(float) Constant 1045220557
-              68:   27(fvec2) ConstantComposite 25 67
-              69:             TypeVector 6(float) 3
-              73:             TypeVector 29(int) 2
-              74:     29(int) Constant 3
-              75:   73(ivec2) ConstantComposite 30 74
-              79:             TypeImage 29(int) 2D sampled format:Unknown
-              80:             TypePointer UniformConstant 79
-  81(g_tTex2di4):     80(ptr) Variable UniformConstant
-              84:             TypeImage 29(int) 2D depth sampled format:Unknown
-              85:             TypeSampledImage 84
-              93:             TypeImage 46(int) 2D sampled format:Unknown
-              94:             TypePointer UniformConstant 93
-  95(g_tTex2du4):     94(ptr) Variable UniformConstant
-              98:             TypeImage 46(int) 2D depth sampled format:Unknown
-              99:             TypeSampledImage 98
-             106:             TypePointer Function 8(PS_OUTPUT)
-             108:     29(int) Constant 0
-             109:    6(float) Constant 1065353216
-             110:    7(fvec4) ConstantComposite 109 109 109 109
-             111:             TypePointer Function 7(fvec4)
-             113:     29(int) Constant 1
-             120:             TypePointer Output 7(fvec4)
-121(@entryPointOutput.Color):    120(ptr) Variable Output
-             124:             TypePointer Output 6(float)
-125(@entryPointOutput.Depth):    124(ptr) Variable Output
-             128:             TypeImage 6(float) 3D sampled format:Unknown
+              22:             TypeSampledImage 14
+              24:    6(float) Constant 1036831949
+              25:    6(float) Constant 1061158912
+              26:             TypeVector 6(float) 2
+              28:             TypeInt 32 1
+              29:     28(int) Constant 2
+              33:             TypeImage 28(int) 1D depth sampled format:Unknown
+              34:             TypePointer UniformConstant 33
+  35(g_tTex1di4):     34(ptr) Variable UniformConstant
+              38:             TypeSampledImage 33
+              44:             TypeInt 32 0
+              45:             TypeImage 44(int) 1D depth sampled format:Unknown
+              46:             TypePointer UniformConstant 45
+  47(g_tTex1du4):     46(ptr) Variable UniformConstant
+              50:             TypeSampledImage 45
+              56:             TypeImage 6(float) 2D depth sampled format:Unknown
+              57:             TypePointer UniformConstant 56
+  58(g_tTex2df4):     57(ptr) Variable UniformConstant
+              61:             TypeSampledImage 56
+              63:    6(float) Constant 1045220557
+              64:   26(fvec2) ConstantComposite 24 63
+              65:             TypeVector 6(float) 3
+              69:             TypeVector 28(int) 2
+              70:     28(int) Constant 3
+              71:   69(ivec2) ConstantComposite 29 70
+              75:             TypeImage 28(int) 2D depth sampled format:Unknown
+              76:             TypePointer UniformConstant 75
+  77(g_tTex2di4):     76(ptr) Variable UniformConstant
+              80:             TypeSampledImage 75
+              88:             TypeImage 44(int) 2D depth sampled format:Unknown
+              89:             TypePointer UniformConstant 88
+  90(g_tTex2du4):     89(ptr) Variable UniformConstant
+              93:             TypeSampledImage 88
+             100:             TypePointer Function 8(PS_OUTPUT)
+             102:     28(int) Constant 0
+             103:    6(float) Constant 1065353216
+             104:    7(fvec4) ConstantComposite 103 103 103 103
+             105:             TypePointer Function 7(fvec4)
+             107:     28(int) Constant 1
+             114:             TypePointer Output 7(fvec4)
+115(@entryPointOutput.Color):    114(ptr) Variable Output
+             118:             TypePointer Output 6(float)
+119(@entryPointOutput.Depth):    118(ptr) Variable Output
+             122:             TypeImage 6(float) 3D sampled format:Unknown
+             123:             TypePointer UniformConstant 122
+ 124(g_tTex3df4):    123(ptr) Variable UniformConstant
+             125:             TypeImage 28(int) 3D sampled format:Unknown
+             126:             TypePointer UniformConstant 125
+ 127(g_tTex3di4):    126(ptr) Variable UniformConstant
+             128:             TypeImage 44(int) 3D sampled format:Unknown
              129:             TypePointer UniformConstant 128
- 130(g_tTex3df4):    129(ptr) Variable UniformConstant
-             131:             TypeImage 29(int) 3D sampled format:Unknown
+ 130(g_tTex3du4):    129(ptr) Variable UniformConstant
+             131:             TypeImage 6(float) Cube sampled format:Unknown
              132:             TypePointer UniformConstant 131
- 133(g_tTex3di4):    132(ptr) Variable UniformConstant
-             134:             TypeImage 46(int) 3D sampled format:Unknown
+ 133(g_tTexcdf4):    132(ptr) Variable UniformConstant
+             134:             TypeImage 28(int) Cube sampled format:Unknown
              135:             TypePointer UniformConstant 134
- 136(g_tTex3du4):    135(ptr) Variable UniformConstant
-             137:             TypeImage 6(float) Cube sampled format:Unknown
+ 136(g_tTexcdi4):    135(ptr) Variable UniformConstant
+             137:             TypeImage 44(int) Cube sampled format:Unknown
              138:             TypePointer UniformConstant 137
- 139(g_tTexcdf4):    138(ptr) Variable UniformConstant
-             140:             TypeImage 29(int) Cube sampled format:Unknown
+ 139(g_tTexcdu4):    138(ptr) Variable UniformConstant
+             140:             TypeImage 6(float) 1D array sampled format:Unknown
              141:             TypePointer UniformConstant 140
- 142(g_tTexcdi4):    141(ptr) Variable UniformConstant
-             143:             TypeImage 46(int) Cube sampled format:Unknown
+142(g_tTex1df4a):    141(ptr) Variable UniformConstant
+             143:             TypeImage 28(int) 1D array sampled format:Unknown
              144:             TypePointer UniformConstant 143
- 145(g_tTexcdu4):    144(ptr) Variable UniformConstant
-             146:             TypeImage 6(float) 1D array sampled format:Unknown
+145(g_tTex1di4a):    144(ptr) Variable UniformConstant
+             146:             TypeImage 44(int) 1D array sampled format:Unknown
              147:             TypePointer UniformConstant 146
-148(g_tTex1df4a):    147(ptr) Variable UniformConstant
-             149:             TypeImage 29(int) 1D array sampled format:Unknown
+148(g_tTex1du4a):    147(ptr) Variable UniformConstant
+             149:             TypeImage 6(float) 2D array sampled format:Unknown
              150:             TypePointer UniformConstant 149
-151(g_tTex1di4a):    150(ptr) Variable UniformConstant
-             152:             TypeImage 46(int) 1D array sampled format:Unknown
+151(g_tTex2df4a):    150(ptr) Variable UniformConstant
+             152:             TypeImage 28(int) 2D array sampled format:Unknown
              153:             TypePointer UniformConstant 152
-154(g_tTex1du4a):    153(ptr) Variable UniformConstant
-             155:             TypeImage 6(float) 2D array sampled format:Unknown
+154(g_tTex2di4a):    153(ptr) Variable UniformConstant
+             155:             TypeImage 44(int) 2D array sampled format:Unknown
              156:             TypePointer UniformConstant 155
-157(g_tTex2df4a):    156(ptr) Variable UniformConstant
-             158:             TypeImage 29(int) 2D array sampled format:Unknown
+157(g_tTex2du4a):    156(ptr) Variable UniformConstant
+             158:             TypeImage 6(float) Cube array sampled format:Unknown
              159:             TypePointer UniformConstant 158
-160(g_tTex2di4a):    159(ptr) Variable UniformConstant
-             161:             TypeImage 46(int) 2D array sampled format:Unknown
+160(g_tTexcdf4a):    159(ptr) Variable UniformConstant
+             161:             TypeImage 28(int) Cube array sampled format:Unknown
              162:             TypePointer UniformConstant 161
-163(g_tTex2du4a):    162(ptr) Variable UniformConstant
-             164:             TypeImage 6(float) Cube array sampled format:Unknown
+163(g_tTexcdi4a):    162(ptr) Variable UniformConstant
+             164:             TypeImage 44(int) Cube array sampled format:Unknown
              165:             TypePointer UniformConstant 164
-166(g_tTexcdf4a):    165(ptr) Variable UniformConstant
-             167:             TypeImage 29(int) Cube array sampled format:Unknown
-             168:             TypePointer UniformConstant 167
-169(g_tTexcdi4a):    168(ptr) Variable UniformConstant
-             170:             TypeImage 46(int) Cube array sampled format:Unknown
-             171:             TypePointer UniformConstant 170
-172(g_tTexcdu4a):    171(ptr) Variable UniformConstant
+166(g_tTexcdu4a):    165(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
-118(flattenTemp):    106(ptr) Variable Function
-             119:8(PS_OUTPUT) FunctionCall 10(@main()
-                              Store 118(flattenTemp) 119
-             122:    111(ptr) AccessChain 118(flattenTemp) 108
-             123:    7(fvec4) Load 122
-                              Store 121(@entryPointOutput.Color) 123
-             126:     12(ptr) AccessChain 118(flattenTemp) 113
-             127:    6(float) Load 126
-                              Store 125(@entryPointOutput.Depth) 127
+112(flattenTemp):    100(ptr) Variable Function
+             113:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 112(flattenTemp) 113
+             116:    105(ptr) AccessChain 112(flattenTemp) 102
+             117:    7(fvec4) Load 116
+                              Store 115(@entryPointOutput.Color) 117
+             120:     12(ptr) AccessChain 112(flattenTemp) 107
+             121:    6(float) Load 120
+                              Store 119(@entryPointOutput.Depth) 121
                               Return
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
          13(r01):     12(ptr) Variable Function
-         33(r03):     12(ptr) Variable Function
-         45(r05):     12(ptr) Variable Function
-         58(r21):     12(ptr) Variable Function
-         78(r23):     12(ptr) Variable Function
-         92(r25):     12(ptr) Variable Function
-      107(psout):    106(ptr) Variable Function
+         32(r03):     12(ptr) Variable Function
+         43(r05):     12(ptr) Variable Function
+         55(r21):     12(ptr) Variable Function
+         74(r23):     12(ptr) Variable Function
+         87(r25):     12(ptr) Variable Function
+      101(psout):    100(ptr) Variable Function
               17:          14 Load 16(g_tTex1df4)
               21:          18 Load 20(g_sSamp)
-              24:          23 SampledImage 17 21
-              28:   27(fvec2) CompositeConstruct 25 26
-              31:    6(float) CompositeExtract 28 1
-              32:    6(float) ImageSampleDrefImplicitLod 24 28 31 ConstOffset 30
-                              Store 13(r01) 32
-              37:          34 Load 36(g_tTex1di4)
-              38:          18 Load 20(g_sSamp)
-              41:          40 SampledImage 37 38
-              42:   27(fvec2) CompositeConstruct 25 26
-              43:    6(float) CompositeExtract 42 1
-              44:    6(float) ImageSampleDrefImplicitLod 41 42 43 ConstOffset 30
-                              Store 33(r03) 44
-              50:          47 Load 49(g_tTex1du4)
-              51:          18 Load 20(g_sSamp)
-              54:          53 SampledImage 50 51
-              55:   27(fvec2) CompositeConstruct 25 26
-              56:    6(float) CompositeExtract 55 1
-              57:    6(float) ImageSampleDrefImplicitLod 54 55 56 ConstOffset 30
-                              Store 45(r05) 57
-              62:          59 Load 61(g_tTex2df4)
-              63:          18 Load 20(g_sSamp)
-              66:          65 SampledImage 62 63
-              70:    6(float) CompositeExtract 68 0
-              71:    6(float) CompositeExtract 68 1
-              72:   69(fvec3) CompositeConstruct 70 71 26
-              76:    6(float) CompositeExtract 72 2
-              77:    6(float) ImageSampleDrefImplicitLod 66 72 76 ConstOffset 75
-                              Store 58(r21) 77
-              82:          79 Load 81(g_tTex2di4)
-              83:          18 Load 20(g_sSamp)
-              86:          85 SampledImage 82 83
-              87:    6(float) CompositeExtract 68 0
-              88:    6(float) CompositeExtract 68 1
-              89:   69(fvec3) CompositeConstruct 87 88 26
-              90:    6(float) CompositeExtract 89 2
-              91:    6(float) ImageSampleDrefImplicitLod 86 89 90 ConstOffset 75
-                              Store 78(r23) 91
-              96:          93 Load 95(g_tTex2du4)
-              97:          18 Load 20(g_sSamp)
-             100:          99 SampledImage 96 97
-             101:    6(float) CompositeExtract 68 0
-             102:    6(float) CompositeExtract 68 1
-             103:   69(fvec3) CompositeConstruct 101 102 26
-             104:    6(float) CompositeExtract 103 2
-             105:    6(float) ImageSampleDrefImplicitLod 100 103 104 ConstOffset 75
-                              Store 92(r25) 105
-             112:    111(ptr) AccessChain 107(psout) 108
-                              Store 112 110
-             114:     12(ptr) AccessChain 107(psout) 113
-                              Store 114 109
-             115:8(PS_OUTPUT) Load 107(psout)
-                              ReturnValue 115
+              23:          22 SampledImage 17 21
+              27:   26(fvec2) CompositeConstruct 24 25
+              30:    6(float) CompositeExtract 27 1
+              31:    6(float) ImageSampleDrefImplicitLod 23 27 30 ConstOffset 29
+                              Store 13(r01) 31
+              36:          33 Load 35(g_tTex1di4)
+              37:          18 Load 20(g_sSamp)
+              39:          38 SampledImage 36 37
+              40:   26(fvec2) CompositeConstruct 24 25
+              41:    6(float) CompositeExtract 40 1
+              42:    6(float) ImageSampleDrefImplicitLod 39 40 41 ConstOffset 29
+                              Store 32(r03) 42
+              48:          45 Load 47(g_tTex1du4)
+              49:          18 Load 20(g_sSamp)
+              51:          50 SampledImage 48 49
+              52:   26(fvec2) CompositeConstruct 24 25
+              53:    6(float) CompositeExtract 52 1
+              54:    6(float) ImageSampleDrefImplicitLod 51 52 53 ConstOffset 29
+                              Store 43(r05) 54
+              59:          56 Load 58(g_tTex2df4)
+              60:          18 Load 20(g_sSamp)
+              62:          61 SampledImage 59 60
+              66:    6(float) CompositeExtract 64 0
+              67:    6(float) CompositeExtract 64 1
+              68:   65(fvec3) CompositeConstruct 66 67 25
+              72:    6(float) CompositeExtract 68 2
+              73:    6(float) ImageSampleDrefImplicitLod 62 68 72 ConstOffset 71
+                              Store 55(r21) 73
+              78:          75 Load 77(g_tTex2di4)
+              79:          18 Load 20(g_sSamp)
+              81:          80 SampledImage 78 79
+              82:    6(float) CompositeExtract 64 0
+              83:    6(float) CompositeExtract 64 1
+              84:   65(fvec3) CompositeConstruct 82 83 25
+              85:    6(float) CompositeExtract 84 2
+              86:    6(float) ImageSampleDrefImplicitLod 81 84 85 ConstOffset 71
+                              Store 74(r23) 86
+              91:          88 Load 90(g_tTex2du4)
+              92:          18 Load 20(g_sSamp)
+              94:          93 SampledImage 91 92
+              95:    6(float) CompositeExtract 64 0
+              96:    6(float) CompositeExtract 64 1
+              97:   65(fvec3) CompositeConstruct 95 96 25
+              98:    6(float) CompositeExtract 97 2
+              99:    6(float) ImageSampleDrefImplicitLod 94 97 98 ConstOffset 71
+                              Store 87(r25) 99
+             106:    105(ptr) AccessChain 101(psout) 102
+                              Store 106 104
+             108:     12(ptr) AccessChain 101(psout) 107
+                              Store 108 103
+             109:8(PS_OUTPUT) Load 101(psout)
+                              ReturnValue 109
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.samplecmp.offsetarray.dx10.frag.out b/Test/baseResults/hlsl.samplecmp.offsetarray.dx10.frag.out
index d30efcd..a2a9904 100644
--- a/Test/baseResults/hlsl.samplecmp.offsetarray.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplecmp.offsetarray.dx10.frag.out
@@ -10,7 +10,7 @@
 0:42          'r11' ( temp float)
 0:42          textureOffset ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DArrayShadow)
-0:42              'g_tTex1df4a' ( uniform texture1DArray)
+0:42              'g_tTex1df4a' ( uniform texture1DArrayShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -25,7 +25,7 @@
 0:43          'r13' ( temp float)
 0:43          textureOffset ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DArrayShadow)
-0:43              'g_tTex1di4a' ( uniform itexture1DArray)
+0:43              'g_tTex1di4a' ( uniform itexture1DArrayShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -40,7 +40,7 @@
 0:44          'r15' ( temp float)
 0:44          textureOffset ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DArrayShadow)
-0:44              'g_tTex1du4a' ( uniform utexture1DArray)
+0:44              'g_tTex1du4a' ( uniform utexture1DArrayShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -55,7 +55,7 @@
 0:47          'r31' ( temp float)
 0:47          textureOffset ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DArrayShadow)
-0:47              'g_tTex2df4a' ( uniform texture2DArray)
+0:47              'g_tTex2df4a' ( uniform texture2DArrayShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -72,7 +72,7 @@
 0:48          'r33' ( temp float)
 0:48          textureOffset ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DArrayShadow)
-0:48              'g_tTex2di4a' ( uniform itexture2DArray)
+0:48              'g_tTex2di4a' ( uniform itexture2DArrayShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -89,7 +89,7 @@
 0:49          'r35' ( temp float)
 0:49          textureOffset ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DArrayShadow)
-0:49              'g_tTex2du4a' ( uniform utexture2DArray)
+0:49              'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -153,12 +153,12 @@
 0:?     'g_tTexcdf4' ( uniform textureCube)
 0:?     'g_tTexcdi4' ( uniform itextureCube)
 0:?     'g_tTexcdu4' ( uniform utextureCube)
-0:?     'g_tTex1df4a' ( uniform texture1DArray)
-0:?     'g_tTex1di4a' ( uniform itexture1DArray)
-0:?     'g_tTex1du4a' ( uniform utexture1DArray)
-0:?     'g_tTex2df4a' ( uniform texture2DArray)
-0:?     'g_tTex2di4a' ( uniform itexture2DArray)
-0:?     'g_tTex2du4a' ( uniform utexture2DArray)
+0:?     'g_tTex1df4a' ( uniform texture1DArrayShadow)
+0:?     'g_tTex1di4a' ( uniform itexture1DArrayShadow)
+0:?     'g_tTex1du4a' ( uniform utexture1DArrayShadow)
+0:?     'g_tTex2df4a' ( uniform texture2DArrayShadow)
+0:?     'g_tTex2di4a' ( uniform itexture2DArrayShadow)
+0:?     'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:?     'g_tTexcdf4a' ( uniform textureCubeArray)
 0:?     'g_tTexcdi4a' ( uniform itextureCubeArray)
 0:?     'g_tTexcdu4a' ( uniform utextureCubeArray)
@@ -180,7 +180,7 @@
 0:42          'r11' ( temp float)
 0:42          textureOffset ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DArrayShadow)
-0:42              'g_tTex1df4a' ( uniform texture1DArray)
+0:42              'g_tTex1df4a' ( uniform texture1DArrayShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -195,7 +195,7 @@
 0:43          'r13' ( temp float)
 0:43          textureOffset ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DArrayShadow)
-0:43              'g_tTex1di4a' ( uniform itexture1DArray)
+0:43              'g_tTex1di4a' ( uniform itexture1DArrayShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -210,7 +210,7 @@
 0:44          'r15' ( temp float)
 0:44          textureOffset ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DArrayShadow)
-0:44              'g_tTex1du4a' ( uniform utexture1DArray)
+0:44              'g_tTex1du4a' ( uniform utexture1DArrayShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -225,7 +225,7 @@
 0:47          'r31' ( temp float)
 0:47          textureOffset ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DArrayShadow)
-0:47              'g_tTex2df4a' ( uniform texture2DArray)
+0:47              'g_tTex2df4a' ( uniform texture2DArrayShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -242,7 +242,7 @@
 0:48          'r33' ( temp float)
 0:48          textureOffset ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DArrayShadow)
-0:48              'g_tTex2di4a' ( uniform itexture2DArray)
+0:48              'g_tTex2di4a' ( uniform itexture2DArrayShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -259,7 +259,7 @@
 0:49          'r35' ( temp float)
 0:49          textureOffset ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DArrayShadow)
-0:49              'g_tTex2du4a' ( uniform utexture2DArray)
+0:49              'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -323,12 +323,12 @@
 0:?     'g_tTexcdf4' ( uniform textureCube)
 0:?     'g_tTexcdi4' ( uniform itextureCube)
 0:?     'g_tTexcdu4' ( uniform utextureCube)
-0:?     'g_tTex1df4a' ( uniform texture1DArray)
-0:?     'g_tTex1di4a' ( uniform itexture1DArray)
-0:?     'g_tTex1du4a' ( uniform utexture1DArray)
-0:?     'g_tTex2df4a' ( uniform texture2DArray)
-0:?     'g_tTex2di4a' ( uniform itexture2DArray)
-0:?     'g_tTex2du4a' ( uniform utexture2DArray)
+0:?     'g_tTex1df4a' ( uniform texture1DArrayShadow)
+0:?     'g_tTex1di4a' ( uniform itexture1DArrayShadow)
+0:?     'g_tTex1du4a' ( uniform utexture1DArrayShadow)
+0:?     'g_tTex2df4a' ( uniform texture2DArrayShadow)
+0:?     'g_tTex2di4a' ( uniform itexture2DArrayShadow)
+0:?     'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:?     'g_tTexcdf4a' ( uniform textureCubeArray)
 0:?     'g_tTexcdi4a' ( uniform itextureCubeArray)
 0:?     'g_tTexcdu4a' ( uniform utextureCubeArray)
@@ -337,14 +337,14 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 184
+// Id's are bound by 178
 
                               Capability Shader
                               Capability Sampled1D
                               Capability SampledCubeArray
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 132 136
+                              EntryPoint Fragment 4  "main" 126 130
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -355,61 +355,61 @@
                               Name 13  "r11"
                               Name 16  "g_tTex1df4a"
                               Name 20  "g_sSamp"
-                              Name 38  "r13"
-                              Name 41  "g_tTex1di4a"
-                              Name 52  "r15"
-                              Name 56  "g_tTex1du4a"
-                              Name 67  "r31"
-                              Name 70  "g_tTex2df4a"
-                              Name 87  "r33"
-                              Name 90  "g_tTex2di4a"
-                              Name 102  "r35"
-                              Name 105  "g_tTex2du4a"
-                              Name 118  "psout"
-                              Name 129  "flattenTemp"
-                              Name 132  "@entryPointOutput.Color"
-                              Name 136  "@entryPointOutput.Depth"
-                              Name 141  "g_tTex1df4"
-                              Name 144  "g_tTex1di4"
-                              Name 147  "g_tTex1du4"
-                              Name 150  "g_tTex2df4"
-                              Name 153  "g_tTex2di4"
-                              Name 156  "g_tTex2du4"
-                              Name 159  "g_tTex3df4"
-                              Name 162  "g_tTex3di4"
-                              Name 165  "g_tTex3du4"
-                              Name 168  "g_tTexcdf4"
-                              Name 171  "g_tTexcdi4"
-                              Name 174  "g_tTexcdu4"
-                              Name 177  "g_tTexcdf4a"
-                              Name 180  "g_tTexcdi4a"
-                              Name 183  "g_tTexcdu4a"
+                              Name 37  "r13"
+                              Name 40  "g_tTex1di4a"
+                              Name 50  "r15"
+                              Name 54  "g_tTex1du4a"
+                              Name 64  "r31"
+                              Name 67  "g_tTex2df4a"
+                              Name 83  "r33"
+                              Name 86  "g_tTex2di4a"
+                              Name 97  "r35"
+                              Name 100  "g_tTex2du4a"
+                              Name 112  "psout"
+                              Name 123  "flattenTemp"
+                              Name 126  "@entryPointOutput.Color"
+                              Name 130  "@entryPointOutput.Depth"
+                              Name 135  "g_tTex1df4"
+                              Name 138  "g_tTex1di4"
+                              Name 141  "g_tTex1du4"
+                              Name 144  "g_tTex2df4"
+                              Name 147  "g_tTex2di4"
+                              Name 150  "g_tTex2du4"
+                              Name 153  "g_tTex3df4"
+                              Name 156  "g_tTex3di4"
+                              Name 159  "g_tTex3du4"
+                              Name 162  "g_tTexcdf4"
+                              Name 165  "g_tTexcdi4"
+                              Name 168  "g_tTexcdu4"
+                              Name 171  "g_tTexcdf4a"
+                              Name 174  "g_tTexcdi4a"
+                              Name 177  "g_tTexcdu4a"
                               Decorate 16(g_tTex1df4a) DescriptorSet 0
                               Decorate 20(g_sSamp) DescriptorSet 0
                               Decorate 20(g_sSamp) Binding 0
-                              Decorate 41(g_tTex1di4a) DescriptorSet 0
-                              Decorate 56(g_tTex1du4a) DescriptorSet 0
-                              Decorate 70(g_tTex2df4a) DescriptorSet 0
-                              Decorate 90(g_tTex2di4a) DescriptorSet 0
-                              Decorate 105(g_tTex2du4a) DescriptorSet 0
-                              Decorate 132(@entryPointOutput.Color) Location 0
-                              Decorate 136(@entryPointOutput.Depth) BuiltIn FragDepth
-                              Decorate 141(g_tTex1df4) DescriptorSet 0
-                              Decorate 141(g_tTex1df4) Binding 0
-                              Decorate 144(g_tTex1di4) DescriptorSet 0
-                              Decorate 147(g_tTex1du4) DescriptorSet 0
-                              Decorate 150(g_tTex2df4) DescriptorSet 0
-                              Decorate 153(g_tTex2di4) DescriptorSet 0
-                              Decorate 156(g_tTex2du4) DescriptorSet 0
-                              Decorate 159(g_tTex3df4) DescriptorSet 0
-                              Decorate 162(g_tTex3di4) DescriptorSet 0
-                              Decorate 165(g_tTex3du4) DescriptorSet 0
-                              Decorate 168(g_tTexcdf4) DescriptorSet 0
-                              Decorate 171(g_tTexcdi4) DescriptorSet 0
-                              Decorate 174(g_tTexcdu4) DescriptorSet 0
-                              Decorate 177(g_tTexcdf4a) DescriptorSet 0
-                              Decorate 180(g_tTexcdi4a) DescriptorSet 0
-                              Decorate 183(g_tTexcdu4a) DescriptorSet 0
+                              Decorate 40(g_tTex1di4a) DescriptorSet 0
+                              Decorate 54(g_tTex1du4a) DescriptorSet 0
+                              Decorate 67(g_tTex2df4a) DescriptorSet 0
+                              Decorate 86(g_tTex2di4a) DescriptorSet 0
+                              Decorate 100(g_tTex2du4a) DescriptorSet 0
+                              Decorate 126(@entryPointOutput.Color) Location 0
+                              Decorate 130(@entryPointOutput.Depth) BuiltIn FragDepth
+                              Decorate 135(g_tTex1df4) DescriptorSet 0
+                              Decorate 135(g_tTex1df4) Binding 0
+                              Decorate 138(g_tTex1di4) DescriptorSet 0
+                              Decorate 141(g_tTex1du4) DescriptorSet 0
+                              Decorate 144(g_tTex2df4) DescriptorSet 0
+                              Decorate 147(g_tTex2di4) DescriptorSet 0
+                              Decorate 150(g_tTex2du4) DescriptorSet 0
+                              Decorate 153(g_tTex3df4) DescriptorSet 0
+                              Decorate 156(g_tTex3di4) DescriptorSet 0
+                              Decorate 159(g_tTex3du4) DescriptorSet 0
+                              Decorate 162(g_tTexcdf4) DescriptorSet 0
+                              Decorate 165(g_tTexcdi4) DescriptorSet 0
+                              Decorate 168(g_tTexcdu4) DescriptorSet 0
+                              Decorate 171(g_tTexcdf4a) DescriptorSet 0
+                              Decorate 174(g_tTexcdi4a) DescriptorSet 0
+                              Decorate 177(g_tTexcdu4a) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -417,191 +417,185 @@
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
                9:             TypeFunction 8(PS_OUTPUT)
               12:             TypePointer Function 6(float)
-              14:             TypeImage 6(float) 1D array sampled format:Unknown
+              14:             TypeImage 6(float) 1D depth array sampled format:Unknown
               15:             TypePointer UniformConstant 14
  16(g_tTex1df4a):     15(ptr) Variable UniformConstant
               18:             TypeSampler
               19:             TypePointer UniformConstant 18
      20(g_sSamp):     19(ptr) Variable UniformConstant
-              22:             TypeImage 6(float) 1D depth array sampled format:Unknown
-              23:             TypeSampledImage 22
-              25:             TypeVector 6(float) 2
-              26:    6(float) Constant 1036831949
-              27:    6(float) Constant 1045220557
-              28:   25(fvec2) ConstantComposite 26 27
-              29:    6(float) Constant 1061158912
-              30:             TypeVector 6(float) 3
-              34:             TypeInt 32 1
-              35:     34(int) Constant 2
-              39:             TypeImage 34(int) 1D array sampled format:Unknown
-              40:             TypePointer UniformConstant 39
- 41(g_tTex1di4a):     40(ptr) Variable UniformConstant
-              44:             TypeImage 34(int) 1D depth array sampled format:Unknown
-              45:             TypeSampledImage 44
-              53:             TypeInt 32 0
-              54:             TypeImage 53(int) 1D array sampled format:Unknown
-              55:             TypePointer UniformConstant 54
- 56(g_tTex1du4a):     55(ptr) Variable UniformConstant
-              59:             TypeImage 53(int) 1D depth array sampled format:Unknown
-              60:             TypeSampledImage 59
-              68:             TypeImage 6(float) 2D array sampled format:Unknown
-              69:             TypePointer UniformConstant 68
- 70(g_tTex2df4a):     69(ptr) Variable UniformConstant
-              73:             TypeImage 6(float) 2D depth array sampled format:Unknown
-              74:             TypeSampledImage 73
-              76:    6(float) Constant 1050253722
-              77:   30(fvec3) ConstantComposite 26 27 76
-              82:             TypeVector 34(int) 2
-              83:     34(int) Constant 3
-              84:   82(ivec2) ConstantComposite 35 83
-              88:             TypeImage 34(int) 2D array sampled format:Unknown
-              89:             TypePointer UniformConstant 88
- 90(g_tTex2di4a):     89(ptr) Variable UniformConstant
-              93:             TypeImage 34(int) 2D depth array sampled format:Unknown
-              94:             TypeSampledImage 93
-             103:             TypeImage 53(int) 2D array sampled format:Unknown
-             104:             TypePointer UniformConstant 103
-105(g_tTex2du4a):    104(ptr) Variable UniformConstant
-             108:             TypeImage 53(int) 2D depth array sampled format:Unknown
-             109:             TypeSampledImage 108
-             117:             TypePointer Function 8(PS_OUTPUT)
-             119:     34(int) Constant 0
-             120:    6(float) Constant 1065353216
-             121:    7(fvec4) ConstantComposite 120 120 120 120
-             122:             TypePointer Function 7(fvec4)
-             124:     34(int) Constant 1
-             131:             TypePointer Output 7(fvec4)
-132(@entryPointOutput.Color):    131(ptr) Variable Output
-             135:             TypePointer Output 6(float)
-136(@entryPointOutput.Depth):    135(ptr) Variable Output
-             139:             TypeImage 6(float) 1D sampled format:Unknown
+              22:             TypeSampledImage 14
+              24:             TypeVector 6(float) 2
+              25:    6(float) Constant 1036831949
+              26:    6(float) Constant 1045220557
+              27:   24(fvec2) ConstantComposite 25 26
+              28:    6(float) Constant 1061158912
+              29:             TypeVector 6(float) 3
+              33:             TypeInt 32 1
+              34:     33(int) Constant 2
+              38:             TypeImage 33(int) 1D depth array sampled format:Unknown
+              39:             TypePointer UniformConstant 38
+ 40(g_tTex1di4a):     39(ptr) Variable UniformConstant
+              43:             TypeSampledImage 38
+              51:             TypeInt 32 0
+              52:             TypeImage 51(int) 1D depth array sampled format:Unknown
+              53:             TypePointer UniformConstant 52
+ 54(g_tTex1du4a):     53(ptr) Variable UniformConstant
+              57:             TypeSampledImage 52
+              65:             TypeImage 6(float) 2D depth array sampled format:Unknown
+              66:             TypePointer UniformConstant 65
+ 67(g_tTex2df4a):     66(ptr) Variable UniformConstant
+              70:             TypeSampledImage 65
+              72:    6(float) Constant 1050253722
+              73:   29(fvec3) ConstantComposite 25 26 72
+              78:             TypeVector 33(int) 2
+              79:     33(int) Constant 3
+              80:   78(ivec2) ConstantComposite 34 79
+              84:             TypeImage 33(int) 2D depth array sampled format:Unknown
+              85:             TypePointer UniformConstant 84
+ 86(g_tTex2di4a):     85(ptr) Variable UniformConstant
+              89:             TypeSampledImage 84
+              98:             TypeImage 51(int) 2D depth array sampled format:Unknown
+              99:             TypePointer UniformConstant 98
+100(g_tTex2du4a):     99(ptr) Variable UniformConstant
+             103:             TypeSampledImage 98
+             111:             TypePointer Function 8(PS_OUTPUT)
+             113:     33(int) Constant 0
+             114:    6(float) Constant 1065353216
+             115:    7(fvec4) ConstantComposite 114 114 114 114
+             116:             TypePointer Function 7(fvec4)
+             118:     33(int) Constant 1
+             125:             TypePointer Output 7(fvec4)
+126(@entryPointOutput.Color):    125(ptr) Variable Output
+             129:             TypePointer Output 6(float)
+130(@entryPointOutput.Depth):    129(ptr) Variable Output
+             133:             TypeImage 6(float) 1D sampled format:Unknown
+             134:             TypePointer UniformConstant 133
+ 135(g_tTex1df4):    134(ptr) Variable UniformConstant
+             136:             TypeImage 33(int) 1D sampled format:Unknown
+             137:             TypePointer UniformConstant 136
+ 138(g_tTex1di4):    137(ptr) Variable UniformConstant
+             139:             TypeImage 51(int) 1D sampled format:Unknown
              140:             TypePointer UniformConstant 139
- 141(g_tTex1df4):    140(ptr) Variable UniformConstant
-             142:             TypeImage 34(int) 1D sampled format:Unknown
+ 141(g_tTex1du4):    140(ptr) Variable UniformConstant
+             142:             TypeImage 6(float) 2D sampled format:Unknown
              143:             TypePointer UniformConstant 142
- 144(g_tTex1di4):    143(ptr) Variable UniformConstant
-             145:             TypeImage 53(int) 1D sampled format:Unknown
+ 144(g_tTex2df4):    143(ptr) Variable UniformConstant
+             145:             TypeImage 33(int) 2D sampled format:Unknown
              146:             TypePointer UniformConstant 145
- 147(g_tTex1du4):    146(ptr) Variable UniformConstant
-             148:             TypeImage 6(float) 2D sampled format:Unknown
+ 147(g_tTex2di4):    146(ptr) Variable UniformConstant
+             148:             TypeImage 51(int) 2D sampled format:Unknown
              149:             TypePointer UniformConstant 148
- 150(g_tTex2df4):    149(ptr) Variable UniformConstant
-             151:             TypeImage 34(int) 2D sampled format:Unknown
+ 150(g_tTex2du4):    149(ptr) Variable UniformConstant
+             151:             TypeImage 6(float) 3D sampled format:Unknown
              152:             TypePointer UniformConstant 151
- 153(g_tTex2di4):    152(ptr) Variable UniformConstant
-             154:             TypeImage 53(int) 2D sampled format:Unknown
+ 153(g_tTex3df4):    152(ptr) Variable UniformConstant
+             154:             TypeImage 33(int) 3D sampled format:Unknown
              155:             TypePointer UniformConstant 154
- 156(g_tTex2du4):    155(ptr) Variable UniformConstant
-             157:             TypeImage 6(float) 3D sampled format:Unknown
+ 156(g_tTex3di4):    155(ptr) Variable UniformConstant
+             157:             TypeImage 51(int) 3D sampled format:Unknown
              158:             TypePointer UniformConstant 157
- 159(g_tTex3df4):    158(ptr) Variable UniformConstant
-             160:             TypeImage 34(int) 3D sampled format:Unknown
+ 159(g_tTex3du4):    158(ptr) Variable UniformConstant
+             160:             TypeImage 6(float) Cube sampled format:Unknown
              161:             TypePointer UniformConstant 160
- 162(g_tTex3di4):    161(ptr) Variable UniformConstant
-             163:             TypeImage 53(int) 3D sampled format:Unknown
+ 162(g_tTexcdf4):    161(ptr) Variable UniformConstant
+             163:             TypeImage 33(int) Cube sampled format:Unknown
              164:             TypePointer UniformConstant 163
- 165(g_tTex3du4):    164(ptr) Variable UniformConstant
-             166:             TypeImage 6(float) Cube sampled format:Unknown
+ 165(g_tTexcdi4):    164(ptr) Variable UniformConstant
+             166:             TypeImage 51(int) Cube sampled format:Unknown
              167:             TypePointer UniformConstant 166
- 168(g_tTexcdf4):    167(ptr) Variable UniformConstant
-             169:             TypeImage 34(int) Cube sampled format:Unknown
+ 168(g_tTexcdu4):    167(ptr) Variable UniformConstant
+             169:             TypeImage 6(float) Cube array sampled format:Unknown
              170:             TypePointer UniformConstant 169
- 171(g_tTexcdi4):    170(ptr) Variable UniformConstant
-             172:             TypeImage 53(int) Cube sampled format:Unknown
+171(g_tTexcdf4a):    170(ptr) Variable UniformConstant
+             172:             TypeImage 33(int) Cube array sampled format:Unknown
              173:             TypePointer UniformConstant 172
- 174(g_tTexcdu4):    173(ptr) Variable UniformConstant
-             175:             TypeImage 6(float) Cube array sampled format:Unknown
+174(g_tTexcdi4a):    173(ptr) Variable UniformConstant
+             175:             TypeImage 51(int) Cube array sampled format:Unknown
              176:             TypePointer UniformConstant 175
-177(g_tTexcdf4a):    176(ptr) Variable UniformConstant
-             178:             TypeImage 34(int) Cube array sampled format:Unknown
-             179:             TypePointer UniformConstant 178
-180(g_tTexcdi4a):    179(ptr) Variable UniformConstant
-             181:             TypeImage 53(int) Cube array sampled format:Unknown
-             182:             TypePointer UniformConstant 181
-183(g_tTexcdu4a):    182(ptr) Variable UniformConstant
+177(g_tTexcdu4a):    176(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
-129(flattenTemp):    117(ptr) Variable Function
-             130:8(PS_OUTPUT) FunctionCall 10(@main()
-                              Store 129(flattenTemp) 130
-             133:    122(ptr) AccessChain 129(flattenTemp) 119
-             134:    7(fvec4) Load 133
-                              Store 132(@entryPointOutput.Color) 134
-             137:     12(ptr) AccessChain 129(flattenTemp) 124
-             138:    6(float) Load 137
-                              Store 136(@entryPointOutput.Depth) 138
+123(flattenTemp):    111(ptr) Variable Function
+             124:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 123(flattenTemp) 124
+             127:    116(ptr) AccessChain 123(flattenTemp) 113
+             128:    7(fvec4) Load 127
+                              Store 126(@entryPointOutput.Color) 128
+             131:     12(ptr) AccessChain 123(flattenTemp) 118
+             132:    6(float) Load 131
+                              Store 130(@entryPointOutput.Depth) 132
                               Return
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
          13(r11):     12(ptr) Variable Function
-         38(r13):     12(ptr) Variable Function
-         52(r15):     12(ptr) Variable Function
-         67(r31):     12(ptr) Variable Function
-         87(r33):     12(ptr) Variable Function
-        102(r35):     12(ptr) Variable Function
-      118(psout):    117(ptr) Variable Function
+         37(r13):     12(ptr) Variable Function
+         50(r15):     12(ptr) Variable Function
+         64(r31):     12(ptr) Variable Function
+         83(r33):     12(ptr) Variable Function
+         97(r35):     12(ptr) Variable Function
+      112(psout):    111(ptr) Variable Function
               17:          14 Load 16(g_tTex1df4a)
               21:          18 Load 20(g_sSamp)
-              24:          23 SampledImage 17 21
-              31:    6(float) CompositeExtract 28 0
-              32:    6(float) CompositeExtract 28 1
-              33:   30(fvec3) CompositeConstruct 31 32 29
-              36:    6(float) CompositeExtract 33 2
-              37:    6(float) ImageSampleDrefImplicitLod 24 33 36 ConstOffset 35
-                              Store 13(r11) 37
-              42:          39 Load 41(g_tTex1di4a)
-              43:          18 Load 20(g_sSamp)
-              46:          45 SampledImage 42 43
-              47:    6(float) CompositeExtract 28 0
-              48:    6(float) CompositeExtract 28 1
-              49:   30(fvec3) CompositeConstruct 47 48 29
-              50:    6(float) CompositeExtract 49 2
-              51:    6(float) ImageSampleDrefImplicitLod 46 49 50 ConstOffset 35
-                              Store 38(r13) 51
-              57:          54 Load 56(g_tTex1du4a)
-              58:          18 Load 20(g_sSamp)
-              61:          60 SampledImage 57 58
-              62:    6(float) CompositeExtract 28 0
-              63:    6(float) CompositeExtract 28 1
-              64:   30(fvec3) CompositeConstruct 62 63 29
-              65:    6(float) CompositeExtract 64 2
-              66:    6(float) ImageSampleDrefImplicitLod 61 64 65 ConstOffset 35
-                              Store 52(r15) 66
-              71:          68 Load 70(g_tTex2df4a)
-              72:          18 Load 20(g_sSamp)
-              75:          74 SampledImage 71 72
-              78:    6(float) CompositeExtract 77 0
-              79:    6(float) CompositeExtract 77 1
-              80:    6(float) CompositeExtract 77 2
-              81:    7(fvec4) CompositeConstruct 78 79 80 29
-              85:    6(float) CompositeExtract 81 3
-              86:    6(float) ImageSampleDrefImplicitLod 75 81 85 ConstOffset 84
-                              Store 67(r31) 86
-              91:          88 Load 90(g_tTex2di4a)
-              92:          18 Load 20(g_sSamp)
-              95:          94 SampledImage 91 92
-              96:    6(float) CompositeExtract 77 0
-              97:    6(float) CompositeExtract 77 1
-              98:    6(float) CompositeExtract 77 2
-              99:    7(fvec4) CompositeConstruct 96 97 98 29
-             100:    6(float) CompositeExtract 99 3
-             101:    6(float) ImageSampleDrefImplicitLod 95 99 100 ConstOffset 84
-                              Store 87(r33) 101
-             106:         103 Load 105(g_tTex2du4a)
-             107:          18 Load 20(g_sSamp)
-             110:         109 SampledImage 106 107
-             111:    6(float) CompositeExtract 77 0
-             112:    6(float) CompositeExtract 77 1
-             113:    6(float) CompositeExtract 77 2
-             114:    7(fvec4) CompositeConstruct 111 112 113 29
-             115:    6(float) CompositeExtract 114 3
-             116:    6(float) ImageSampleDrefImplicitLod 110 114 115 ConstOffset 84
-                              Store 102(r35) 116
-             123:    122(ptr) AccessChain 118(psout) 119
-                              Store 123 121
-             125:     12(ptr) AccessChain 118(psout) 124
-                              Store 125 120
-             126:8(PS_OUTPUT) Load 118(psout)
-                              ReturnValue 126
+              23:          22 SampledImage 17 21
+              30:    6(float) CompositeExtract 27 0
+              31:    6(float) CompositeExtract 27 1
+              32:   29(fvec3) CompositeConstruct 30 31 28
+              35:    6(float) CompositeExtract 32 2
+              36:    6(float) ImageSampleDrefImplicitLod 23 32 35 ConstOffset 34
+                              Store 13(r11) 36
+              41:          38 Load 40(g_tTex1di4a)
+              42:          18 Load 20(g_sSamp)
+              44:          43 SampledImage 41 42
+              45:    6(float) CompositeExtract 27 0
+              46:    6(float) CompositeExtract 27 1
+              47:   29(fvec3) CompositeConstruct 45 46 28
+              48:    6(float) CompositeExtract 47 2
+              49:    6(float) ImageSampleDrefImplicitLod 44 47 48 ConstOffset 34
+                              Store 37(r13) 49
+              55:          52 Load 54(g_tTex1du4a)
+              56:          18 Load 20(g_sSamp)
+              58:          57 SampledImage 55 56
+              59:    6(float) CompositeExtract 27 0
+              60:    6(float) CompositeExtract 27 1
+              61:   29(fvec3) CompositeConstruct 59 60 28
+              62:    6(float) CompositeExtract 61 2
+              63:    6(float) ImageSampleDrefImplicitLod 58 61 62 ConstOffset 34
+                              Store 50(r15) 63
+              68:          65 Load 67(g_tTex2df4a)
+              69:          18 Load 20(g_sSamp)
+              71:          70 SampledImage 68 69
+              74:    6(float) CompositeExtract 73 0
+              75:    6(float) CompositeExtract 73 1
+              76:    6(float) CompositeExtract 73 2
+              77:    7(fvec4) CompositeConstruct 74 75 76 28
+              81:    6(float) CompositeExtract 77 3
+              82:    6(float) ImageSampleDrefImplicitLod 71 77 81 ConstOffset 80
+                              Store 64(r31) 82
+              87:          84 Load 86(g_tTex2di4a)
+              88:          18 Load 20(g_sSamp)
+              90:          89 SampledImage 87 88
+              91:    6(float) CompositeExtract 73 0
+              92:    6(float) CompositeExtract 73 1
+              93:    6(float) CompositeExtract 73 2
+              94:    7(fvec4) CompositeConstruct 91 92 93 28
+              95:    6(float) CompositeExtract 94 3
+              96:    6(float) ImageSampleDrefImplicitLod 90 94 95 ConstOffset 80
+                              Store 83(r33) 96
+             101:          98 Load 100(g_tTex2du4a)
+             102:          18 Load 20(g_sSamp)
+             104:         103 SampledImage 101 102
+             105:    6(float) CompositeExtract 73 0
+             106:    6(float) CompositeExtract 73 1
+             107:    6(float) CompositeExtract 73 2
+             108:    7(fvec4) CompositeConstruct 105 106 107 28
+             109:    6(float) CompositeExtract 108 3
+             110:    6(float) ImageSampleDrefImplicitLod 104 108 109 ConstOffset 80
+                              Store 97(r35) 110
+             117:    116(ptr) AccessChain 112(psout) 113
+                              Store 117 115
+             119:     12(ptr) AccessChain 112(psout) 118
+                              Store 119 114
+             120:8(PS_OUTPUT) Load 112(psout)
+                              ReturnValue 120
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.samplecmplevelzero.array.dx10.frag.out b/Test/baseResults/hlsl.samplecmplevelzero.array.dx10.frag.out
index ef9f6fd..ea7cc5e 100644
--- a/Test/baseResults/hlsl.samplecmplevelzero.array.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplecmplevelzero.array.dx10.frag.out
@@ -10,7 +10,7 @@
 0:42          'r10' ( temp float)
 0:42          textureLod ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DArrayShadow)
-0:42              'g_tTex1df4a' ( uniform texture1DArray)
+0:42              'g_tTex1df4a' ( uniform texture1DArrayShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -25,7 +25,7 @@
 0:43          'r12' ( temp float)
 0:43          textureLod ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DArrayShadow)
-0:43              'g_tTex1di4a' ( uniform itexture1DArray)
+0:43              'g_tTex1di4a' ( uniform itexture1DArrayShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -40,7 +40,7 @@
 0:44          'r14' ( temp float)
 0:44          textureLod ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DArrayShadow)
-0:44              'g_tTex1du4a' ( uniform utexture1DArray)
+0:44              'g_tTex1du4a' ( uniform utexture1DArrayShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -55,7 +55,7 @@
 0:47          'r30' ( temp float)
 0:47          textureLod ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DArrayShadow)
-0:47              'g_tTex2df4a' ( uniform texture2DArray)
+0:47              'g_tTex2df4a' ( uniform texture2DArrayShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -71,7 +71,7 @@
 0:48          'r32' ( temp float)
 0:48          textureLod ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DArrayShadow)
-0:48              'g_tTex2di4a' ( uniform itexture2DArray)
+0:48              'g_tTex2di4a' ( uniform itexture2DArrayShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -87,7 +87,7 @@
 0:49          'r34' ( temp float)
 0:49          textureLod ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DArrayShadow)
-0:49              'g_tTex2du4a' ( uniform utexture2DArray)
+0:49              'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -103,7 +103,7 @@
 0:52          'r60' ( temp float)
 0:52          textureLod ( temp float)
 0:52            Construct combined texture-sampler ( temp samplerCubeArrayShadow)
-0:52              'g_tTexcdf4a' ( uniform textureCubeArray)
+0:52              'g_tTexcdf4a' ( uniform textureCubeArrayShadow)
 0:52              'g_sSamp' (layout( binding=0) uniform sampler)
 0:52            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -120,7 +120,7 @@
 0:53          'r62' ( temp float)
 0:53          textureLod ( temp float)
 0:53            Construct combined texture-sampler ( temp isamplerCubeArrayShadow)
-0:53              'g_tTexcdi4a' ( uniform itextureCubeArray)
+0:53              'g_tTexcdi4a' ( uniform itextureCubeArrayShadow)
 0:53              'g_sSamp' (layout( binding=0) uniform sampler)
 0:53            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -137,7 +137,7 @@
 0:54          'r64' ( temp float)
 0:54          textureLod ( temp float)
 0:54            Construct combined texture-sampler ( temp usamplerCubeArrayShadow)
-0:54              'g_tTexcdu4a' ( uniform utextureCubeArray)
+0:54              'g_tTexcdu4a' ( uniform utextureCubeArrayShadow)
 0:54              'g_sSamp' (layout( binding=0) uniform sampler)
 0:54            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -201,15 +201,15 @@
 0:?     'g_tTexcdf4' ( uniform textureCube)
 0:?     'g_tTexcdi4' ( uniform itextureCube)
 0:?     'g_tTexcdu4' ( uniform utextureCube)
-0:?     'g_tTex1df4a' ( uniform texture1DArray)
-0:?     'g_tTex1di4a' ( uniform itexture1DArray)
-0:?     'g_tTex1du4a' ( uniform utexture1DArray)
-0:?     'g_tTex2df4a' ( uniform texture2DArray)
-0:?     'g_tTex2di4a' ( uniform itexture2DArray)
-0:?     'g_tTex2du4a' ( uniform utexture2DArray)
-0:?     'g_tTexcdf4a' ( uniform textureCubeArray)
-0:?     'g_tTexcdi4a' ( uniform itextureCubeArray)
-0:?     'g_tTexcdu4a' ( uniform utextureCubeArray)
+0:?     'g_tTex1df4a' ( uniform texture1DArrayShadow)
+0:?     'g_tTex1di4a' ( uniform itexture1DArrayShadow)
+0:?     'g_tTex1du4a' ( uniform utexture1DArrayShadow)
+0:?     'g_tTex2df4a' ( uniform texture2DArrayShadow)
+0:?     'g_tTex2di4a' ( uniform itexture2DArrayShadow)
+0:?     'g_tTex2du4a' ( uniform utexture2DArrayShadow)
+0:?     'g_tTexcdf4a' ( uniform textureCubeArrayShadow)
+0:?     'g_tTexcdi4a' ( uniform itextureCubeArrayShadow)
+0:?     'g_tTexcdu4a' ( uniform utextureCubeArrayShadow)
 0:?     '@entryPointOutput.Depth' ( out float FragDepth)
 0:?     '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float)
 
@@ -228,7 +228,7 @@
 0:42          'r10' ( temp float)
 0:42          textureLod ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DArrayShadow)
-0:42              'g_tTex1df4a' ( uniform texture1DArray)
+0:42              'g_tTex1df4a' ( uniform texture1DArrayShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -243,7 +243,7 @@
 0:43          'r12' ( temp float)
 0:43          textureLod ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DArrayShadow)
-0:43              'g_tTex1di4a' ( uniform itexture1DArray)
+0:43              'g_tTex1di4a' ( uniform itexture1DArrayShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -258,7 +258,7 @@
 0:44          'r14' ( temp float)
 0:44          textureLod ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DArrayShadow)
-0:44              'g_tTex1du4a' ( uniform utexture1DArray)
+0:44              'g_tTex1du4a' ( uniform utexture1DArrayShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -273,7 +273,7 @@
 0:47          'r30' ( temp float)
 0:47          textureLod ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DArrayShadow)
-0:47              'g_tTex2df4a' ( uniform texture2DArray)
+0:47              'g_tTex2df4a' ( uniform texture2DArrayShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -289,7 +289,7 @@
 0:48          'r32' ( temp float)
 0:48          textureLod ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DArrayShadow)
-0:48              'g_tTex2di4a' ( uniform itexture2DArray)
+0:48              'g_tTex2di4a' ( uniform itexture2DArrayShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -305,7 +305,7 @@
 0:49          'r34' ( temp float)
 0:49          textureLod ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DArrayShadow)
-0:49              'g_tTex2du4a' ( uniform utexture2DArray)
+0:49              'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -321,7 +321,7 @@
 0:52          'r60' ( temp float)
 0:52          textureLod ( temp float)
 0:52            Construct combined texture-sampler ( temp samplerCubeArrayShadow)
-0:52              'g_tTexcdf4a' ( uniform textureCubeArray)
+0:52              'g_tTexcdf4a' ( uniform textureCubeArrayShadow)
 0:52              'g_sSamp' (layout( binding=0) uniform sampler)
 0:52            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -338,7 +338,7 @@
 0:53          'r62' ( temp float)
 0:53          textureLod ( temp float)
 0:53            Construct combined texture-sampler ( temp isamplerCubeArrayShadow)
-0:53              'g_tTexcdi4a' ( uniform itextureCubeArray)
+0:53              'g_tTexcdi4a' ( uniform itextureCubeArrayShadow)
 0:53              'g_sSamp' (layout( binding=0) uniform sampler)
 0:53            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -355,7 +355,7 @@
 0:54          'r64' ( temp float)
 0:54          textureLod ( temp float)
 0:54            Construct combined texture-sampler ( temp usamplerCubeArrayShadow)
-0:54              'g_tTexcdu4a' ( uniform utextureCubeArray)
+0:54              'g_tTexcdu4a' ( uniform utextureCubeArrayShadow)
 0:54              'g_sSamp' (layout( binding=0) uniform sampler)
 0:54            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -419,28 +419,28 @@
 0:?     'g_tTexcdf4' ( uniform textureCube)
 0:?     'g_tTexcdi4' ( uniform itextureCube)
 0:?     'g_tTexcdu4' ( uniform utextureCube)
-0:?     'g_tTex1df4a' ( uniform texture1DArray)
-0:?     'g_tTex1di4a' ( uniform itexture1DArray)
-0:?     'g_tTex1du4a' ( uniform utexture1DArray)
-0:?     'g_tTex2df4a' ( uniform texture2DArray)
-0:?     'g_tTex2di4a' ( uniform itexture2DArray)
-0:?     'g_tTex2du4a' ( uniform utexture2DArray)
-0:?     'g_tTexcdf4a' ( uniform textureCubeArray)
-0:?     'g_tTexcdi4a' ( uniform itextureCubeArray)
-0:?     'g_tTexcdu4a' ( uniform utextureCubeArray)
+0:?     'g_tTex1df4a' ( uniform texture1DArrayShadow)
+0:?     'g_tTex1di4a' ( uniform itexture1DArrayShadow)
+0:?     'g_tTex1du4a' ( uniform utexture1DArrayShadow)
+0:?     'g_tTex2df4a' ( uniform texture2DArrayShadow)
+0:?     'g_tTex2di4a' ( uniform itexture2DArrayShadow)
+0:?     'g_tTex2du4a' ( uniform utexture2DArrayShadow)
+0:?     'g_tTexcdf4a' ( uniform textureCubeArrayShadow)
+0:?     'g_tTexcdi4a' ( uniform itextureCubeArrayShadow)
+0:?     'g_tTexcdu4a' ( uniform utextureCubeArrayShadow)
 0:?     '@entryPointOutput.Depth' ( out float FragDepth)
 0:?     '@entryPointOutput.Color' (layout( location=0) out 4-component vector of float)
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 219
+// Id's are bound by 210
 
                               Capability Shader
                               Capability Sampled1D
                               Capability SampledCubeArray
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 176 180
+                              EntryPoint Fragment 4  "main" 167 171
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -451,64 +451,64 @@
                               Name 13  "r10"
                               Name 16  "g_tTex1df4a"
                               Name 20  "g_sSamp"
-                              Name 37  "r12"
-                              Name 41  "g_tTex1di4a"
-                              Name 52  "r14"
-                              Name 56  "g_tTex1du4a"
-                              Name 67  "r30"
-                              Name 70  "g_tTex2df4a"
-                              Name 84  "r32"
-                              Name 87  "g_tTex2di4a"
-                              Name 99  "r34"
-                              Name 102  "g_tTex2du4a"
-                              Name 114  "r60"
-                              Name 117  "g_tTexcdf4a"
-                              Name 131  "r62"
-                              Name 134  "g_tTexcdi4a"
-                              Name 146  "r64"
-                              Name 149  "g_tTexcdu4a"
-                              Name 162  "psout"
-                              Name 173  "flattenTemp"
-                              Name 176  "@entryPointOutput.Color"
-                              Name 180  "@entryPointOutput.Depth"
-                              Name 185  "g_tTex1df4"
-                              Name 188  "g_tTex1di4"
-                              Name 191  "g_tTex1du4"
-                              Name 194  "g_tTex2df4"
-                              Name 197  "g_tTex2di4"
-                              Name 200  "g_tTex2du4"
-                              Name 203  "g_tTex3df4"
-                              Name 206  "g_tTex3di4"
-                              Name 209  "g_tTex3du4"
-                              Name 212  "g_tTexcdf4"
-                              Name 215  "g_tTexcdi4"
-                              Name 218  "g_tTexcdu4"
+                              Name 36  "r12"
+                              Name 40  "g_tTex1di4a"
+                              Name 50  "r14"
+                              Name 54  "g_tTex1du4a"
+                              Name 64  "r30"
+                              Name 67  "g_tTex2df4a"
+                              Name 80  "r32"
+                              Name 83  "g_tTex2di4a"
+                              Name 94  "r34"
+                              Name 97  "g_tTex2du4a"
+                              Name 108  "r60"
+                              Name 111  "g_tTexcdf4a"
+                              Name 124  "r62"
+                              Name 127  "g_tTexcdi4a"
+                              Name 138  "r64"
+                              Name 141  "g_tTexcdu4a"
+                              Name 153  "psout"
+                              Name 164  "flattenTemp"
+                              Name 167  "@entryPointOutput.Color"
+                              Name 171  "@entryPointOutput.Depth"
+                              Name 176  "g_tTex1df4"
+                              Name 179  "g_tTex1di4"
+                              Name 182  "g_tTex1du4"
+                              Name 185  "g_tTex2df4"
+                              Name 188  "g_tTex2di4"
+                              Name 191  "g_tTex2du4"
+                              Name 194  "g_tTex3df4"
+                              Name 197  "g_tTex3di4"
+                              Name 200  "g_tTex3du4"
+                              Name 203  "g_tTexcdf4"
+                              Name 206  "g_tTexcdi4"
+                              Name 209  "g_tTexcdu4"
                               Decorate 16(g_tTex1df4a) DescriptorSet 0
                               Decorate 20(g_sSamp) DescriptorSet 0
                               Decorate 20(g_sSamp) Binding 0
-                              Decorate 41(g_tTex1di4a) DescriptorSet 0
-                              Decorate 56(g_tTex1du4a) DescriptorSet 0
-                              Decorate 70(g_tTex2df4a) DescriptorSet 0
-                              Decorate 87(g_tTex2di4a) DescriptorSet 0
-                              Decorate 102(g_tTex2du4a) DescriptorSet 0
-                              Decorate 117(g_tTexcdf4a) DescriptorSet 0
-                              Decorate 134(g_tTexcdi4a) DescriptorSet 0
-                              Decorate 149(g_tTexcdu4a) DescriptorSet 0
-                              Decorate 176(@entryPointOutput.Color) Location 0
-                              Decorate 180(@entryPointOutput.Depth) BuiltIn FragDepth
-                              Decorate 185(g_tTex1df4) DescriptorSet 0
-                              Decorate 185(g_tTex1df4) Binding 0
-                              Decorate 188(g_tTex1di4) DescriptorSet 0
-                              Decorate 191(g_tTex1du4) DescriptorSet 0
-                              Decorate 194(g_tTex2df4) DescriptorSet 0
-                              Decorate 197(g_tTex2di4) DescriptorSet 0
-                              Decorate 200(g_tTex2du4) DescriptorSet 0
-                              Decorate 203(g_tTex3df4) DescriptorSet 0
-                              Decorate 206(g_tTex3di4) DescriptorSet 0
-                              Decorate 209(g_tTex3du4) DescriptorSet 0
-                              Decorate 212(g_tTexcdf4) DescriptorSet 0
-                              Decorate 215(g_tTexcdi4) DescriptorSet 0
-                              Decorate 218(g_tTexcdu4) DescriptorSet 0
+                              Decorate 40(g_tTex1di4a) DescriptorSet 0
+                              Decorate 54(g_tTex1du4a) DescriptorSet 0
+                              Decorate 67(g_tTex2df4a) DescriptorSet 0
+                              Decorate 83(g_tTex2di4a) DescriptorSet 0
+                              Decorate 97(g_tTex2du4a) DescriptorSet 0
+                              Decorate 111(g_tTexcdf4a) DescriptorSet 0
+                              Decorate 127(g_tTexcdi4a) DescriptorSet 0
+                              Decorate 141(g_tTexcdu4a) DescriptorSet 0
+                              Decorate 167(@entryPointOutput.Color) Location 0
+                              Decorate 171(@entryPointOutput.Depth) BuiltIn FragDepth
+                              Decorate 176(g_tTex1df4) DescriptorSet 0
+                              Decorate 176(g_tTex1df4) Binding 0
+                              Decorate 179(g_tTex1di4) DescriptorSet 0
+                              Decorate 182(g_tTex1du4) DescriptorSet 0
+                              Decorate 185(g_tTex2df4) DescriptorSet 0
+                              Decorate 188(g_tTex2di4) DescriptorSet 0
+                              Decorate 191(g_tTex2du4) DescriptorSet 0
+                              Decorate 194(g_tTex3df4) DescriptorSet 0
+                              Decorate 197(g_tTex3di4) DescriptorSet 0
+                              Decorate 200(g_tTex3du4) DescriptorSet 0
+                              Decorate 203(g_tTexcdf4) DescriptorSet 0
+                              Decorate 206(g_tTexcdi4) DescriptorSet 0
+                              Decorate 209(g_tTexcdu4) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -516,229 +516,220 @@
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
                9:             TypeFunction 8(PS_OUTPUT)
               12:             TypePointer Function 6(float)
-              14:             TypeImage 6(float) 1D array sampled format:Unknown
+              14:             TypeImage 6(float) 1D depth array sampled format:Unknown
               15:             TypePointer UniformConstant 14
  16(g_tTex1df4a):     15(ptr) Variable UniformConstant
               18:             TypeSampler
               19:             TypePointer UniformConstant 18
      20(g_sSamp):     19(ptr) Variable UniformConstant
-              22:             TypeImage 6(float) 1D depth array sampled format:Unknown
-              23:             TypeSampledImage 22
-              25:             TypeVector 6(float) 2
-              26:    6(float) Constant 1036831949
-              27:    6(float) Constant 1045220557
-              28:   25(fvec2) ConstantComposite 26 27
-              29:    6(float) Constant 1061158912
-              30:             TypeVector 6(float) 3
-              34:    6(float) Constant 0
-              38:             TypeInt 32 1
-              39:             TypeImage 38(int) 1D array sampled format:Unknown
-              40:             TypePointer UniformConstant 39
- 41(g_tTex1di4a):     40(ptr) Variable UniformConstant
-              44:             TypeImage 38(int) 1D depth array sampled format:Unknown
-              45:             TypeSampledImage 44
-              53:             TypeInt 32 0
-              54:             TypeImage 53(int) 1D array sampled format:Unknown
-              55:             TypePointer UniformConstant 54
- 56(g_tTex1du4a):     55(ptr) Variable UniformConstant
-              59:             TypeImage 53(int) 1D depth array sampled format:Unknown
-              60:             TypeSampledImage 59
-              68:             TypeImage 6(float) 2D array sampled format:Unknown
-              69:             TypePointer UniformConstant 68
- 70(g_tTex2df4a):     69(ptr) Variable UniformConstant
-              73:             TypeImage 6(float) 2D depth array sampled format:Unknown
-              74:             TypeSampledImage 73
-              76:    6(float) Constant 1050253722
-              77:   30(fvec3) ConstantComposite 26 27 76
-              85:             TypeImage 38(int) 2D array sampled format:Unknown
-              86:             TypePointer UniformConstant 85
- 87(g_tTex2di4a):     86(ptr) Variable UniformConstant
-              90:             TypeImage 38(int) 2D depth array sampled format:Unknown
-              91:             TypeSampledImage 90
-             100:             TypeImage 53(int) 2D array sampled format:Unknown
-             101:             TypePointer UniformConstant 100
-102(g_tTex2du4a):    101(ptr) Variable UniformConstant
-             105:             TypeImage 53(int) 2D depth array sampled format:Unknown
-             106:             TypeSampledImage 105
-             115:             TypeImage 6(float) Cube array sampled format:Unknown
-             116:             TypePointer UniformConstant 115
-117(g_tTexcdf4a):    116(ptr) Variable UniformConstant
-             120:             TypeImage 6(float) Cube depth array sampled format:Unknown
-             121:             TypeSampledImage 120
-             123:    6(float) Constant 1053609165
-             124:    7(fvec4) ConstantComposite 26 27 76 123
-             132:             TypeImage 38(int) Cube array sampled format:Unknown
-             133:             TypePointer UniformConstant 132
-134(g_tTexcdi4a):    133(ptr) Variable UniformConstant
-             137:             TypeImage 38(int) Cube depth array sampled format:Unknown
-             138:             TypeSampledImage 137
-             147:             TypeImage 53(int) Cube array sampled format:Unknown
-             148:             TypePointer UniformConstant 147
-149(g_tTexcdu4a):    148(ptr) Variable UniformConstant
-             152:             TypeImage 53(int) Cube depth array sampled format:Unknown
-             153:             TypeSampledImage 152
-             161:             TypePointer Function 8(PS_OUTPUT)
-             163:     38(int) Constant 0
-             164:    6(float) Constant 1065353216
-             165:    7(fvec4) ConstantComposite 164 164 164 164
-             166:             TypePointer Function 7(fvec4)
-             168:     38(int) Constant 1
-             175:             TypePointer Output 7(fvec4)
-176(@entryPointOutput.Color):    175(ptr) Variable Output
-             179:             TypePointer Output 6(float)
-180(@entryPointOutput.Depth):    179(ptr) Variable Output
-             183:             TypeImage 6(float) 1D sampled format:Unknown
+              22:             TypeSampledImage 14
+              24:             TypeVector 6(float) 2
+              25:    6(float) Constant 1036831949
+              26:    6(float) Constant 1045220557
+              27:   24(fvec2) ConstantComposite 25 26
+              28:    6(float) Constant 1061158912
+              29:             TypeVector 6(float) 3
+              33:    6(float) Constant 0
+              37:             TypeInt 32 1
+              38:             TypeImage 37(int) 1D depth array sampled format:Unknown
+              39:             TypePointer UniformConstant 38
+ 40(g_tTex1di4a):     39(ptr) Variable UniformConstant
+              43:             TypeSampledImage 38
+              51:             TypeInt 32 0
+              52:             TypeImage 51(int) 1D depth array sampled format:Unknown
+              53:             TypePointer UniformConstant 52
+ 54(g_tTex1du4a):     53(ptr) Variable UniformConstant
+              57:             TypeSampledImage 52
+              65:             TypeImage 6(float) 2D depth array sampled format:Unknown
+              66:             TypePointer UniformConstant 65
+ 67(g_tTex2df4a):     66(ptr) Variable UniformConstant
+              70:             TypeSampledImage 65
+              72:    6(float) Constant 1050253722
+              73:   29(fvec3) ConstantComposite 25 26 72
+              81:             TypeImage 37(int) 2D depth array sampled format:Unknown
+              82:             TypePointer UniformConstant 81
+ 83(g_tTex2di4a):     82(ptr) Variable UniformConstant
+              86:             TypeSampledImage 81
+              95:             TypeImage 51(int) 2D depth array sampled format:Unknown
+              96:             TypePointer UniformConstant 95
+ 97(g_tTex2du4a):     96(ptr) Variable UniformConstant
+             100:             TypeSampledImage 95
+             109:             TypeImage 6(float) Cube depth array sampled format:Unknown
+             110:             TypePointer UniformConstant 109
+111(g_tTexcdf4a):    110(ptr) Variable UniformConstant
+             114:             TypeSampledImage 109
+             116:    6(float) Constant 1053609165
+             117:    7(fvec4) ConstantComposite 25 26 72 116
+             125:             TypeImage 37(int) Cube depth array sampled format:Unknown
+             126:             TypePointer UniformConstant 125
+127(g_tTexcdi4a):    126(ptr) Variable UniformConstant
+             130:             TypeSampledImage 125
+             139:             TypeImage 51(int) Cube depth array sampled format:Unknown
+             140:             TypePointer UniformConstant 139
+141(g_tTexcdu4a):    140(ptr) Variable UniformConstant
+             144:             TypeSampledImage 139
+             152:             TypePointer Function 8(PS_OUTPUT)
+             154:     37(int) Constant 0
+             155:    6(float) Constant 1065353216
+             156:    7(fvec4) ConstantComposite 155 155 155 155
+             157:             TypePointer Function 7(fvec4)
+             159:     37(int) Constant 1
+             166:             TypePointer Output 7(fvec4)
+167(@entryPointOutput.Color):    166(ptr) Variable Output
+             170:             TypePointer Output 6(float)
+171(@entryPointOutput.Depth):    170(ptr) Variable Output
+             174:             TypeImage 6(float) 1D sampled format:Unknown
+             175:             TypePointer UniformConstant 174
+ 176(g_tTex1df4):    175(ptr) Variable UniformConstant
+             177:             TypeImage 37(int) 1D sampled format:Unknown
+             178:             TypePointer UniformConstant 177
+ 179(g_tTex1di4):    178(ptr) Variable UniformConstant
+             180:             TypeImage 51(int) 1D sampled format:Unknown
+             181:             TypePointer UniformConstant 180
+ 182(g_tTex1du4):    181(ptr) Variable UniformConstant
+             183:             TypeImage 6(float) 2D sampled format:Unknown
              184:             TypePointer UniformConstant 183
- 185(g_tTex1df4):    184(ptr) Variable UniformConstant
-             186:             TypeImage 38(int) 1D sampled format:Unknown
+ 185(g_tTex2df4):    184(ptr) Variable UniformConstant
+             186:             TypeImage 37(int) 2D sampled format:Unknown
              187:             TypePointer UniformConstant 186
- 188(g_tTex1di4):    187(ptr) Variable UniformConstant
-             189:             TypeImage 53(int) 1D sampled format:Unknown
+ 188(g_tTex2di4):    187(ptr) Variable UniformConstant
+             189:             TypeImage 51(int) 2D sampled format:Unknown
              190:             TypePointer UniformConstant 189
- 191(g_tTex1du4):    190(ptr) Variable UniformConstant
-             192:             TypeImage 6(float) 2D sampled format:Unknown
+ 191(g_tTex2du4):    190(ptr) Variable UniformConstant
+             192:             TypeImage 6(float) 3D sampled format:Unknown
              193:             TypePointer UniformConstant 192
- 194(g_tTex2df4):    193(ptr) Variable UniformConstant
-             195:             TypeImage 38(int) 2D sampled format:Unknown
+ 194(g_tTex3df4):    193(ptr) Variable UniformConstant
+             195:             TypeImage 37(int) 3D sampled format:Unknown
              196:             TypePointer UniformConstant 195
- 197(g_tTex2di4):    196(ptr) Variable UniformConstant
-             198:             TypeImage 53(int) 2D sampled format:Unknown
+ 197(g_tTex3di4):    196(ptr) Variable UniformConstant
+             198:             TypeImage 51(int) 3D sampled format:Unknown
              199:             TypePointer UniformConstant 198
- 200(g_tTex2du4):    199(ptr) Variable UniformConstant
-             201:             TypeImage 6(float) 3D sampled format:Unknown
+ 200(g_tTex3du4):    199(ptr) Variable UniformConstant
+             201:             TypeImage 6(float) Cube sampled format:Unknown
              202:             TypePointer UniformConstant 201
- 203(g_tTex3df4):    202(ptr) Variable UniformConstant
-             204:             TypeImage 38(int) 3D sampled format:Unknown
+ 203(g_tTexcdf4):    202(ptr) Variable UniformConstant
+             204:             TypeImage 37(int) Cube sampled format:Unknown
              205:             TypePointer UniformConstant 204
- 206(g_tTex3di4):    205(ptr) Variable UniformConstant
-             207:             TypeImage 53(int) 3D sampled format:Unknown
+ 206(g_tTexcdi4):    205(ptr) Variable UniformConstant
+             207:             TypeImage 51(int) Cube sampled format:Unknown
              208:             TypePointer UniformConstant 207
- 209(g_tTex3du4):    208(ptr) Variable UniformConstant
-             210:             TypeImage 6(float) Cube sampled format:Unknown
-             211:             TypePointer UniformConstant 210
- 212(g_tTexcdf4):    211(ptr) Variable UniformConstant
-             213:             TypeImage 38(int) Cube sampled format:Unknown
-             214:             TypePointer UniformConstant 213
- 215(g_tTexcdi4):    214(ptr) Variable UniformConstant
-             216:             TypeImage 53(int) Cube sampled format:Unknown
-             217:             TypePointer UniformConstant 216
- 218(g_tTexcdu4):    217(ptr) Variable UniformConstant
+ 209(g_tTexcdu4):    208(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
-173(flattenTemp):    161(ptr) Variable Function
-             174:8(PS_OUTPUT) FunctionCall 10(@main()
-                              Store 173(flattenTemp) 174
-             177:    166(ptr) AccessChain 173(flattenTemp) 163
-             178:    7(fvec4) Load 177
-                              Store 176(@entryPointOutput.Color) 178
-             181:     12(ptr) AccessChain 173(flattenTemp) 168
-             182:    6(float) Load 181
-                              Store 180(@entryPointOutput.Depth) 182
+164(flattenTemp):    152(ptr) Variable Function
+             165:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 164(flattenTemp) 165
+             168:    157(ptr) AccessChain 164(flattenTemp) 154
+             169:    7(fvec4) Load 168
+                              Store 167(@entryPointOutput.Color) 169
+             172:     12(ptr) AccessChain 164(flattenTemp) 159
+             173:    6(float) Load 172
+                              Store 171(@entryPointOutput.Depth) 173
                               Return
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
          13(r10):     12(ptr) Variable Function
-         37(r12):     12(ptr) Variable Function
-         52(r14):     12(ptr) Variable Function
-         67(r30):     12(ptr) Variable Function
-         84(r32):     12(ptr) Variable Function
-         99(r34):     12(ptr) Variable Function
-        114(r60):     12(ptr) Variable Function
-        131(r62):     12(ptr) Variable Function
-        146(r64):     12(ptr) Variable Function
-      162(psout):    161(ptr) Variable Function
+         36(r12):     12(ptr) Variable Function
+         50(r14):     12(ptr) Variable Function
+         64(r30):     12(ptr) Variable Function
+         80(r32):     12(ptr) Variable Function
+         94(r34):     12(ptr) Variable Function
+        108(r60):     12(ptr) Variable Function
+        124(r62):     12(ptr) Variable Function
+        138(r64):     12(ptr) Variable Function
+      153(psout):    152(ptr) Variable Function
               17:          14 Load 16(g_tTex1df4a)
               21:          18 Load 20(g_sSamp)
-              24:          23 SampledImage 17 21
-              31:    6(float) CompositeExtract 28 0
-              32:    6(float) CompositeExtract 28 1
-              33:   30(fvec3) CompositeConstruct 31 32 29
-              35:    6(float) CompositeExtract 33 2
-              36:    6(float) ImageSampleDrefExplicitLod 24 33 35 Lod 34
-                              Store 13(r10) 36
-              42:          39 Load 41(g_tTex1di4a)
-              43:          18 Load 20(g_sSamp)
-              46:          45 SampledImage 42 43
-              47:    6(float) CompositeExtract 28 0
-              48:    6(float) CompositeExtract 28 1
-              49:   30(fvec3) CompositeConstruct 47 48 29
-              50:    6(float) CompositeExtract 49 2
-              51:    6(float) ImageSampleDrefExplicitLod 46 49 50 Lod 34
-                              Store 37(r12) 51
-              57:          54 Load 56(g_tTex1du4a)
-              58:          18 Load 20(g_sSamp)
-              61:          60 SampledImage 57 58
-              62:    6(float) CompositeExtract 28 0
-              63:    6(float) CompositeExtract 28 1
-              64:   30(fvec3) CompositeConstruct 62 63 29
-              65:    6(float) CompositeExtract 64 2
-              66:    6(float) ImageSampleDrefExplicitLod 61 64 65 Lod 34
-                              Store 52(r14) 66
-              71:          68 Load 70(g_tTex2df4a)
-              72:          18 Load 20(g_sSamp)
-              75:          74 SampledImage 71 72
-              78:    6(float) CompositeExtract 77 0
-              79:    6(float) CompositeExtract 77 1
-              80:    6(float) CompositeExtract 77 2
-              81:    7(fvec4) CompositeConstruct 78 79 80 29
-              82:    6(float) CompositeExtract 81 3
-              83:    6(float) ImageSampleDrefExplicitLod 75 81 82 Lod 34
-                              Store 67(r30) 83
-              88:          85 Load 87(g_tTex2di4a)
-              89:          18 Load 20(g_sSamp)
-              92:          91 SampledImage 88 89
-              93:    6(float) CompositeExtract 77 0
-              94:    6(float) CompositeExtract 77 1
-              95:    6(float) CompositeExtract 77 2
-              96:    7(fvec4) CompositeConstruct 93 94 95 29
-              97:    6(float) CompositeExtract 96 3
-              98:    6(float) ImageSampleDrefExplicitLod 92 96 97 Lod 34
-                              Store 84(r32) 98
-             103:         100 Load 102(g_tTex2du4a)
-             104:          18 Load 20(g_sSamp)
-             107:         106 SampledImage 103 104
-             108:    6(float) CompositeExtract 77 0
-             109:    6(float) CompositeExtract 77 1
-             110:    6(float) CompositeExtract 77 2
-             111:    7(fvec4) CompositeConstruct 108 109 110 29
-             112:    6(float) CompositeExtract 111 3
-             113:    6(float) ImageSampleDrefExplicitLod 107 111 112 Lod 34
-                              Store 99(r34) 113
-             118:         115 Load 117(g_tTexcdf4a)
-             119:          18 Load 20(g_sSamp)
-             122:         121 SampledImage 118 119
-             125:    6(float) CompositeExtract 124 0
-             126:    6(float) CompositeExtract 124 1
-             127:    6(float) CompositeExtract 124 2
-             128:    6(float) CompositeExtract 124 3
-             129:    7(fvec4) CompositeConstruct 125 126 127 128
-             130:    6(float) ImageSampleDrefExplicitLod 122 129 29 Lod 34
-                              Store 114(r60) 130
-             135:         132 Load 134(g_tTexcdi4a)
-             136:          18 Load 20(g_sSamp)
-             139:         138 SampledImage 135 136
-             140:    6(float) CompositeExtract 124 0
-             141:    6(float) CompositeExtract 124 1
-             142:    6(float) CompositeExtract 124 2
-             143:    6(float) CompositeExtract 124 3
-             144:    7(fvec4) CompositeConstruct 140 141 142 143
-             145:    6(float) ImageSampleDrefExplicitLod 139 144 29 Lod 34
-                              Store 131(r62) 145
-             150:         147 Load 149(g_tTexcdu4a)
-             151:          18 Load 20(g_sSamp)
-             154:         153 SampledImage 150 151
-             155:    6(float) CompositeExtract 124 0
-             156:    6(float) CompositeExtract 124 1
-             157:    6(float) CompositeExtract 124 2
-             158:    6(float) CompositeExtract 124 3
-             159:    7(fvec4) CompositeConstruct 155 156 157 158
-             160:    6(float) ImageSampleDrefExplicitLod 154 159 29 Lod 34
-                              Store 146(r64) 160
-             167:    166(ptr) AccessChain 162(psout) 163
-                              Store 167 165
-             169:     12(ptr) AccessChain 162(psout) 168
-                              Store 169 164
-             170:8(PS_OUTPUT) Load 162(psout)
-                              ReturnValue 170
+              23:          22 SampledImage 17 21
+              30:    6(float) CompositeExtract 27 0
+              31:    6(float) CompositeExtract 27 1
+              32:   29(fvec3) CompositeConstruct 30 31 28
+              34:    6(float) CompositeExtract 32 2
+              35:    6(float) ImageSampleDrefExplicitLod 23 32 34 Lod 33
+                              Store 13(r10) 35
+              41:          38 Load 40(g_tTex1di4a)
+              42:          18 Load 20(g_sSamp)
+              44:          43 SampledImage 41 42
+              45:    6(float) CompositeExtract 27 0
+              46:    6(float) CompositeExtract 27 1
+              47:   29(fvec3) CompositeConstruct 45 46 28
+              48:    6(float) CompositeExtract 47 2
+              49:    6(float) ImageSampleDrefExplicitLod 44 47 48 Lod 33
+                              Store 36(r12) 49
+              55:          52 Load 54(g_tTex1du4a)
+              56:          18 Load 20(g_sSamp)
+              58:          57 SampledImage 55 56
+              59:    6(float) CompositeExtract 27 0
+              60:    6(float) CompositeExtract 27 1
+              61:   29(fvec3) CompositeConstruct 59 60 28
+              62:    6(float) CompositeExtract 61 2
+              63:    6(float) ImageSampleDrefExplicitLod 58 61 62 Lod 33
+                              Store 50(r14) 63
+              68:          65 Load 67(g_tTex2df4a)
+              69:          18 Load 20(g_sSamp)
+              71:          70 SampledImage 68 69
+              74:    6(float) CompositeExtract 73 0
+              75:    6(float) CompositeExtract 73 1
+              76:    6(float) CompositeExtract 73 2
+              77:    7(fvec4) CompositeConstruct 74 75 76 28
+              78:    6(float) CompositeExtract 77 3
+              79:    6(float) ImageSampleDrefExplicitLod 71 77 78 Lod 33
+                              Store 64(r30) 79
+              84:          81 Load 83(g_tTex2di4a)
+              85:          18 Load 20(g_sSamp)
+              87:          86 SampledImage 84 85
+              88:    6(float) CompositeExtract 73 0
+              89:    6(float) CompositeExtract 73 1
+              90:    6(float) CompositeExtract 73 2
+              91:    7(fvec4) CompositeConstruct 88 89 90 28
+              92:    6(float) CompositeExtract 91 3
+              93:    6(float) ImageSampleDrefExplicitLod 87 91 92 Lod 33
+                              Store 80(r32) 93
+              98:          95 Load 97(g_tTex2du4a)
+              99:          18 Load 20(g_sSamp)
+             101:         100 SampledImage 98 99
+             102:    6(float) CompositeExtract 73 0
+             103:    6(float) CompositeExtract 73 1
+             104:    6(float) CompositeExtract 73 2
+             105:    7(fvec4) CompositeConstruct 102 103 104 28
+             106:    6(float) CompositeExtract 105 3
+             107:    6(float) ImageSampleDrefExplicitLod 101 105 106 Lod 33
+                              Store 94(r34) 107
+             112:         109 Load 111(g_tTexcdf4a)
+             113:          18 Load 20(g_sSamp)
+             115:         114 SampledImage 112 113
+             118:    6(float) CompositeExtract 117 0
+             119:    6(float) CompositeExtract 117 1
+             120:    6(float) CompositeExtract 117 2
+             121:    6(float) CompositeExtract 117 3
+             122:    7(fvec4) CompositeConstruct 118 119 120 121
+             123:    6(float) ImageSampleDrefExplicitLod 115 122 28 Lod 33
+                              Store 108(r60) 123
+             128:         125 Load 127(g_tTexcdi4a)
+             129:          18 Load 20(g_sSamp)
+             131:         130 SampledImage 128 129
+             132:    6(float) CompositeExtract 117 0
+             133:    6(float) CompositeExtract 117 1
+             134:    6(float) CompositeExtract 117 2
+             135:    6(float) CompositeExtract 117 3
+             136:    7(fvec4) CompositeConstruct 132 133 134 135
+             137:    6(float) ImageSampleDrefExplicitLod 131 136 28 Lod 33
+                              Store 124(r62) 137
+             142:         139 Load 141(g_tTexcdu4a)
+             143:          18 Load 20(g_sSamp)
+             145:         144 SampledImage 142 143
+             146:    6(float) CompositeExtract 117 0
+             147:    6(float) CompositeExtract 117 1
+             148:    6(float) CompositeExtract 117 2
+             149:    6(float) CompositeExtract 117 3
+             150:    7(fvec4) CompositeConstruct 146 147 148 149
+             151:    6(float) ImageSampleDrefExplicitLod 145 150 28 Lod 33
+                              Store 138(r64) 151
+             158:    157(ptr) AccessChain 153(psout) 154
+                              Store 158 156
+             160:     12(ptr) AccessChain 153(psout) 159
+                              Store 160 155
+             161:8(PS_OUTPUT) Load 153(psout)
+                              ReturnValue 161
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.samplecmplevelzero.basic.dx10.frag.out b/Test/baseResults/hlsl.samplecmplevelzero.basic.dx10.frag.out
index f1d0024..278aad5 100644
--- a/Test/baseResults/hlsl.samplecmplevelzero.basic.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplecmplevelzero.basic.dx10.frag.out
@@ -10,7 +10,7 @@
 0:42          'r00' ( temp float)
 0:42          textureLod ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DShadow)
-0:42              'g_tTex1df4' (layout( binding=0) uniform texture1D)
+0:42              'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec2 ( temp 2-component vector of float)
 0:42              Constant:
@@ -24,7 +24,7 @@
 0:43          'r02' ( temp float)
 0:43          textureLod ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DShadow)
-0:43              'g_tTex1di4' ( uniform itexture1D)
+0:43              'g_tTex1di4' ( uniform itexture1DShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec2 ( temp 2-component vector of float)
 0:43              Constant:
@@ -38,7 +38,7 @@
 0:44          'r04' ( temp float)
 0:44          textureLod ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DShadow)
-0:44              'g_tTex1du4' ( uniform utexture1D)
+0:44              'g_tTex1du4' ( uniform utexture1DShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec2 ( temp 2-component vector of float)
 0:44              Constant:
@@ -52,7 +52,7 @@
 0:47          'r20' ( temp float)
 0:47          textureLod ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DShadow)
-0:47              'g_tTex2df4' ( uniform texture2D)
+0:47              'g_tTex2df4' ( uniform texture2DShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -67,7 +67,7 @@
 0:48          'r22' ( temp float)
 0:48          textureLod ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DShadow)
-0:48              'g_tTex2di4' ( uniform itexture2D)
+0:48              'g_tTex2di4' ( uniform itexture2DShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -82,7 +82,7 @@
 0:49          'r24' ( temp float)
 0:49          textureLod ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DShadow)
-0:49              'g_tTex2du4' ( uniform utexture2D)
+0:49              'g_tTex2du4' ( uniform utexture2DShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -97,7 +97,7 @@
 0:53          'r50' ( temp float)
 0:53          textureLod ( temp float)
 0:53            Construct combined texture-sampler ( temp samplerCubeShadow)
-0:53              'g_tTexcdf4' ( uniform textureCube)
+0:53              'g_tTexcdf4' ( uniform textureCubeShadow)
 0:53              'g_sSamp' (layout( binding=0) uniform sampler)
 0:53            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -113,7 +113,7 @@
 0:54          'r52' ( temp float)
 0:54          textureLod ( temp float)
 0:54            Construct combined texture-sampler ( temp isamplerCubeShadow)
-0:54              'g_tTexcdi4' ( uniform itextureCube)
+0:54              'g_tTexcdi4' ( uniform itextureCubeShadow)
 0:54              'g_sSamp' (layout( binding=0) uniform sampler)
 0:54            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -129,7 +129,7 @@
 0:55          'r54' ( temp float)
 0:55          textureLod ( temp float)
 0:55            Construct combined texture-sampler ( temp usamplerCubeShadow)
-0:55              'g_tTexcdu4' ( uniform utextureCube)
+0:55              'g_tTexcdu4' ( uniform utextureCubeShadow)
 0:55              'g_sSamp' (layout( binding=0) uniform sampler)
 0:55            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -180,18 +180,18 @@
 0:38              1 (const int)
 0:?   Linker Objects
 0:?     'g_sSamp' (layout( binding=0) uniform sampler)
-0:?     'g_tTex1df4' (layout( binding=0) uniform texture1D)
-0:?     'g_tTex1di4' ( uniform itexture1D)
-0:?     'g_tTex1du4' ( uniform utexture1D)
-0:?     'g_tTex2df4' ( uniform texture2D)
-0:?     'g_tTex2di4' ( uniform itexture2D)
-0:?     'g_tTex2du4' ( uniform utexture2D)
+0:?     'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
+0:?     'g_tTex1di4' ( uniform itexture1DShadow)
+0:?     'g_tTex1du4' ( uniform utexture1DShadow)
+0:?     'g_tTex2df4' ( uniform texture2DShadow)
+0:?     'g_tTex2di4' ( uniform itexture2DShadow)
+0:?     'g_tTex2du4' ( uniform utexture2DShadow)
 0:?     'g_tTex3df4' ( uniform texture3D)
 0:?     'g_tTex3di4' ( uniform itexture3D)
 0:?     'g_tTex3du4' ( uniform utexture3D)
-0:?     'g_tTexcdf4' ( uniform textureCube)
-0:?     'g_tTexcdi4' ( uniform itextureCube)
-0:?     'g_tTexcdu4' ( uniform utextureCube)
+0:?     'g_tTexcdf4' ( uniform textureCubeShadow)
+0:?     'g_tTexcdi4' ( uniform itextureCubeShadow)
+0:?     'g_tTexcdu4' ( uniform utextureCubeShadow)
 0:?     'g_tTex1df4a' ( uniform texture1DArray)
 0:?     'g_tTex1di4a' ( uniform itexture1DArray)
 0:?     'g_tTex1du4a' ( uniform utexture1DArray)
@@ -219,7 +219,7 @@
 0:42          'r00' ( temp float)
 0:42          textureLod ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DShadow)
-0:42              'g_tTex1df4' (layout( binding=0) uniform texture1D)
+0:42              'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec2 ( temp 2-component vector of float)
 0:42              Constant:
@@ -233,7 +233,7 @@
 0:43          'r02' ( temp float)
 0:43          textureLod ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DShadow)
-0:43              'g_tTex1di4' ( uniform itexture1D)
+0:43              'g_tTex1di4' ( uniform itexture1DShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec2 ( temp 2-component vector of float)
 0:43              Constant:
@@ -247,7 +247,7 @@
 0:44          'r04' ( temp float)
 0:44          textureLod ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DShadow)
-0:44              'g_tTex1du4' ( uniform utexture1D)
+0:44              'g_tTex1du4' ( uniform utexture1DShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec2 ( temp 2-component vector of float)
 0:44              Constant:
@@ -261,7 +261,7 @@
 0:47          'r20' ( temp float)
 0:47          textureLod ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DShadow)
-0:47              'g_tTex2df4' ( uniform texture2D)
+0:47              'g_tTex2df4' ( uniform texture2DShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -276,7 +276,7 @@
 0:48          'r22' ( temp float)
 0:48          textureLod ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DShadow)
-0:48              'g_tTex2di4' ( uniform itexture2D)
+0:48              'g_tTex2di4' ( uniform itexture2DShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -291,7 +291,7 @@
 0:49          'r24' ( temp float)
 0:49          textureLod ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DShadow)
-0:49              'g_tTex2du4' ( uniform utexture2D)
+0:49              'g_tTex2du4' ( uniform utexture2DShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -306,7 +306,7 @@
 0:53          'r50' ( temp float)
 0:53          textureLod ( temp float)
 0:53            Construct combined texture-sampler ( temp samplerCubeShadow)
-0:53              'g_tTexcdf4' ( uniform textureCube)
+0:53              'g_tTexcdf4' ( uniform textureCubeShadow)
 0:53              'g_sSamp' (layout( binding=0) uniform sampler)
 0:53            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -322,7 +322,7 @@
 0:54          'r52' ( temp float)
 0:54          textureLod ( temp float)
 0:54            Construct combined texture-sampler ( temp isamplerCubeShadow)
-0:54              'g_tTexcdi4' ( uniform itextureCube)
+0:54              'g_tTexcdi4' ( uniform itextureCubeShadow)
 0:54              'g_sSamp' (layout( binding=0) uniform sampler)
 0:54            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -338,7 +338,7 @@
 0:55          'r54' ( temp float)
 0:55          textureLod ( temp float)
 0:55            Construct combined texture-sampler ( temp usamplerCubeShadow)
-0:55              'g_tTexcdu4' ( uniform utextureCube)
+0:55              'g_tTexcdu4' ( uniform utextureCubeShadow)
 0:55              'g_sSamp' (layout( binding=0) uniform sampler)
 0:55            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -389,18 +389,18 @@
 0:38              1 (const int)
 0:?   Linker Objects
 0:?     'g_sSamp' (layout( binding=0) uniform sampler)
-0:?     'g_tTex1df4' (layout( binding=0) uniform texture1D)
-0:?     'g_tTex1di4' ( uniform itexture1D)
-0:?     'g_tTex1du4' ( uniform utexture1D)
-0:?     'g_tTex2df4' ( uniform texture2D)
-0:?     'g_tTex2di4' ( uniform itexture2D)
-0:?     'g_tTex2du4' ( uniform utexture2D)
+0:?     'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
+0:?     'g_tTex1di4' ( uniform itexture1DShadow)
+0:?     'g_tTex1du4' ( uniform utexture1DShadow)
+0:?     'g_tTex2df4' ( uniform texture2DShadow)
+0:?     'g_tTex2di4' ( uniform itexture2DShadow)
+0:?     'g_tTex2du4' ( uniform utexture2DShadow)
 0:?     'g_tTex3df4' ( uniform texture3D)
 0:?     'g_tTex3di4' ( uniform itexture3D)
 0:?     'g_tTex3du4' ( uniform utexture3D)
-0:?     'g_tTexcdf4' ( uniform textureCube)
-0:?     'g_tTexcdi4' ( uniform itextureCube)
-0:?     'g_tTexcdu4' ( uniform utextureCube)
+0:?     'g_tTexcdf4' ( uniform textureCubeShadow)
+0:?     'g_tTexcdi4' ( uniform itextureCubeShadow)
+0:?     'g_tTexcdu4' ( uniform utextureCubeShadow)
 0:?     'g_tTex1df4a' ( uniform texture1DArray)
 0:?     'g_tTex1di4a' ( uniform itexture1DArray)
 0:?     'g_tTex1du4a' ( uniform utexture1DArray)
@@ -415,14 +415,14 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 208
+// Id's are bound by 199
 
                               Capability Shader
                               Capability Sampled1D
                               Capability SampledCubeArray
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 165 169
+                              EntryPoint Fragment 4  "main" 156 160
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -433,64 +433,64 @@
                               Name 13  "r00"
                               Name 16  "g_tTex1df4"
                               Name 20  "g_sSamp"
-                              Name 32  "r02"
-                              Name 36  "g_tTex1di4"
-                              Name 45  "r04"
-                              Name 49  "g_tTex1du4"
-                              Name 58  "r20"
-                              Name 61  "g_tTex2df4"
-                              Name 75  "r22"
-                              Name 78  "g_tTex2di4"
-                              Name 89  "r24"
-                              Name 92  "g_tTex2du4"
-                              Name 103  "r50"
-                              Name 106  "g_tTexcdf4"
-                              Name 120  "r52"
-                              Name 123  "g_tTexcdi4"
-                              Name 135  "r54"
-                              Name 138  "g_tTexcdu4"
-                              Name 151  "psout"
-                              Name 162  "flattenTemp"
-                              Name 165  "@entryPointOutput.Color"
-                              Name 169  "@entryPointOutput.Depth"
-                              Name 174  "g_tTex3df4"
-                              Name 177  "g_tTex3di4"
-                              Name 180  "g_tTex3du4"
-                              Name 183  "g_tTex1df4a"
-                              Name 186  "g_tTex1di4a"
-                              Name 189  "g_tTex1du4a"
-                              Name 192  "g_tTex2df4a"
-                              Name 195  "g_tTex2di4a"
-                              Name 198  "g_tTex2du4a"
-                              Name 201  "g_tTexcdf4a"
-                              Name 204  "g_tTexcdi4a"
-                              Name 207  "g_tTexcdu4a"
+                              Name 31  "r02"
+                              Name 35  "g_tTex1di4"
+                              Name 43  "r04"
+                              Name 47  "g_tTex1du4"
+                              Name 55  "r20"
+                              Name 58  "g_tTex2df4"
+                              Name 71  "r22"
+                              Name 74  "g_tTex2di4"
+                              Name 84  "r24"
+                              Name 87  "g_tTex2du4"
+                              Name 97  "r50"
+                              Name 100  "g_tTexcdf4"
+                              Name 113  "r52"
+                              Name 116  "g_tTexcdi4"
+                              Name 127  "r54"
+                              Name 130  "g_tTexcdu4"
+                              Name 142  "psout"
+                              Name 153  "flattenTemp"
+                              Name 156  "@entryPointOutput.Color"
+                              Name 160  "@entryPointOutput.Depth"
+                              Name 165  "g_tTex3df4"
+                              Name 168  "g_tTex3di4"
+                              Name 171  "g_tTex3du4"
+                              Name 174  "g_tTex1df4a"
+                              Name 177  "g_tTex1di4a"
+                              Name 180  "g_tTex1du4a"
+                              Name 183  "g_tTex2df4a"
+                              Name 186  "g_tTex2di4a"
+                              Name 189  "g_tTex2du4a"
+                              Name 192  "g_tTexcdf4a"
+                              Name 195  "g_tTexcdi4a"
+                              Name 198  "g_tTexcdu4a"
                               Decorate 16(g_tTex1df4) DescriptorSet 0
                               Decorate 16(g_tTex1df4) Binding 0
                               Decorate 20(g_sSamp) DescriptorSet 0
                               Decorate 20(g_sSamp) Binding 0
-                              Decorate 36(g_tTex1di4) DescriptorSet 0
-                              Decorate 49(g_tTex1du4) DescriptorSet 0
-                              Decorate 61(g_tTex2df4) DescriptorSet 0
-                              Decorate 78(g_tTex2di4) DescriptorSet 0
-                              Decorate 92(g_tTex2du4) DescriptorSet 0
-                              Decorate 106(g_tTexcdf4) DescriptorSet 0
-                              Decorate 123(g_tTexcdi4) DescriptorSet 0
-                              Decorate 138(g_tTexcdu4) DescriptorSet 0
-                              Decorate 165(@entryPointOutput.Color) Location 0
-                              Decorate 169(@entryPointOutput.Depth) BuiltIn FragDepth
-                              Decorate 174(g_tTex3df4) DescriptorSet 0
-                              Decorate 177(g_tTex3di4) DescriptorSet 0
-                              Decorate 180(g_tTex3du4) DescriptorSet 0
-                              Decorate 183(g_tTex1df4a) DescriptorSet 0
-                              Decorate 186(g_tTex1di4a) DescriptorSet 0
-                              Decorate 189(g_tTex1du4a) DescriptorSet 0
-                              Decorate 192(g_tTex2df4a) DescriptorSet 0
-                              Decorate 195(g_tTex2di4a) DescriptorSet 0
-                              Decorate 198(g_tTex2du4a) DescriptorSet 0
-                              Decorate 201(g_tTexcdf4a) DescriptorSet 0
-                              Decorate 204(g_tTexcdi4a) DescriptorSet 0
-                              Decorate 207(g_tTexcdu4a) DescriptorSet 0
+                              Decorate 35(g_tTex1di4) DescriptorSet 0
+                              Decorate 47(g_tTex1du4) DescriptorSet 0
+                              Decorate 58(g_tTex2df4) DescriptorSet 0
+                              Decorate 74(g_tTex2di4) DescriptorSet 0
+                              Decorate 87(g_tTex2du4) DescriptorSet 0
+                              Decorate 100(g_tTexcdf4) DescriptorSet 0
+                              Decorate 116(g_tTexcdi4) DescriptorSet 0
+                              Decorate 130(g_tTexcdu4) DescriptorSet 0
+                              Decorate 156(@entryPointOutput.Color) Location 0
+                              Decorate 160(@entryPointOutput.Depth) BuiltIn FragDepth
+                              Decorate 165(g_tTex3df4) DescriptorSet 0
+                              Decorate 168(g_tTex3di4) DescriptorSet 0
+                              Decorate 171(g_tTex3du4) DescriptorSet 0
+                              Decorate 174(g_tTex1df4a) DescriptorSet 0
+                              Decorate 177(g_tTex1di4a) DescriptorSet 0
+                              Decorate 180(g_tTex1du4a) DescriptorSet 0
+                              Decorate 183(g_tTex2df4a) DescriptorSet 0
+                              Decorate 186(g_tTex2di4a) DescriptorSet 0
+                              Decorate 189(g_tTex2du4a) DescriptorSet 0
+                              Decorate 192(g_tTexcdf4a) DescriptorSet 0
+                              Decorate 195(g_tTexcdi4a) DescriptorSet 0
+                              Decorate 198(g_tTexcdu4a) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -498,218 +498,209 @@
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
                9:             TypeFunction 8(PS_OUTPUT)
               12:             TypePointer Function 6(float)
-              14:             TypeImage 6(float) 1D sampled format:Unknown
+              14:             TypeImage 6(float) 1D depth sampled format:Unknown
               15:             TypePointer UniformConstant 14
   16(g_tTex1df4):     15(ptr) Variable UniformConstant
               18:             TypeSampler
               19:             TypePointer UniformConstant 18
      20(g_sSamp):     19(ptr) Variable UniformConstant
-              22:             TypeImage 6(float) 1D depth sampled format:Unknown
-              23:             TypeSampledImage 22
-              25:    6(float) Constant 1036831949
-              26:    6(float) Constant 1061158912
-              27:             TypeVector 6(float) 2
-              29:    6(float) Constant 0
-              33:             TypeInt 32 1
-              34:             TypeImage 33(int) 1D sampled format:Unknown
-              35:             TypePointer UniformConstant 34
-  36(g_tTex1di4):     35(ptr) Variable UniformConstant
-              39:             TypeImage 33(int) 1D depth sampled format:Unknown
-              40:             TypeSampledImage 39
-              46:             TypeInt 32 0
-              47:             TypeImage 46(int) 1D sampled format:Unknown
-              48:             TypePointer UniformConstant 47
-  49(g_tTex1du4):     48(ptr) Variable UniformConstant
-              52:             TypeImage 46(int) 1D depth sampled format:Unknown
-              53:             TypeSampledImage 52
-              59:             TypeImage 6(float) 2D sampled format:Unknown
-              60:             TypePointer UniformConstant 59
-  61(g_tTex2df4):     60(ptr) Variable UniformConstant
-              64:             TypeImage 6(float) 2D depth sampled format:Unknown
-              65:             TypeSampledImage 64
-              67:    6(float) Constant 1045220557
-              68:   27(fvec2) ConstantComposite 25 67
-              69:             TypeVector 6(float) 3
-              76:             TypeImage 33(int) 2D sampled format:Unknown
-              77:             TypePointer UniformConstant 76
-  78(g_tTex2di4):     77(ptr) Variable UniformConstant
-              81:             TypeImage 33(int) 2D depth sampled format:Unknown
-              82:             TypeSampledImage 81
-              90:             TypeImage 46(int) 2D sampled format:Unknown
-              91:             TypePointer UniformConstant 90
-  92(g_tTex2du4):     91(ptr) Variable UniformConstant
-              95:             TypeImage 46(int) 2D depth sampled format:Unknown
-              96:             TypeSampledImage 95
-             104:             TypeImage 6(float) Cube sampled format:Unknown
-             105:             TypePointer UniformConstant 104
- 106(g_tTexcdf4):    105(ptr) Variable UniformConstant
-             109:             TypeImage 6(float) Cube depth sampled format:Unknown
-             110:             TypeSampledImage 109
-             112:    6(float) Constant 1050253722
-             113:   69(fvec3) ConstantComposite 25 67 112
-             121:             TypeImage 33(int) Cube sampled format:Unknown
-             122:             TypePointer UniformConstant 121
- 123(g_tTexcdi4):    122(ptr) Variable UniformConstant
-             126:             TypeImage 33(int) Cube depth sampled format:Unknown
-             127:             TypeSampledImage 126
-             136:             TypeImage 46(int) Cube sampled format:Unknown
-             137:             TypePointer UniformConstant 136
- 138(g_tTexcdu4):    137(ptr) Variable UniformConstant
-             141:             TypeImage 46(int) Cube depth sampled format:Unknown
-             142:             TypeSampledImage 141
-             150:             TypePointer Function 8(PS_OUTPUT)
-             152:     33(int) Constant 0
-             153:    6(float) Constant 1065353216
-             154:    7(fvec4) ConstantComposite 153 153 153 153
-             155:             TypePointer Function 7(fvec4)
-             157:     33(int) Constant 1
-             164:             TypePointer Output 7(fvec4)
-165(@entryPointOutput.Color):    164(ptr) Variable Output
-             168:             TypePointer Output 6(float)
-169(@entryPointOutput.Depth):    168(ptr) Variable Output
-             172:             TypeImage 6(float) 3D sampled format:Unknown
+              22:             TypeSampledImage 14
+              24:    6(float) Constant 1036831949
+              25:    6(float) Constant 1061158912
+              26:             TypeVector 6(float) 2
+              28:    6(float) Constant 0
+              32:             TypeInt 32 1
+              33:             TypeImage 32(int) 1D depth sampled format:Unknown
+              34:             TypePointer UniformConstant 33
+  35(g_tTex1di4):     34(ptr) Variable UniformConstant
+              38:             TypeSampledImage 33
+              44:             TypeInt 32 0
+              45:             TypeImage 44(int) 1D depth sampled format:Unknown
+              46:             TypePointer UniformConstant 45
+  47(g_tTex1du4):     46(ptr) Variable UniformConstant
+              50:             TypeSampledImage 45
+              56:             TypeImage 6(float) 2D depth sampled format:Unknown
+              57:             TypePointer UniformConstant 56
+  58(g_tTex2df4):     57(ptr) Variable UniformConstant
+              61:             TypeSampledImage 56
+              63:    6(float) Constant 1045220557
+              64:   26(fvec2) ConstantComposite 24 63
+              65:             TypeVector 6(float) 3
+              72:             TypeImage 32(int) 2D depth sampled format:Unknown
+              73:             TypePointer UniformConstant 72
+  74(g_tTex2di4):     73(ptr) Variable UniformConstant
+              77:             TypeSampledImage 72
+              85:             TypeImage 44(int) 2D depth sampled format:Unknown
+              86:             TypePointer UniformConstant 85
+  87(g_tTex2du4):     86(ptr) Variable UniformConstant
+              90:             TypeSampledImage 85
+              98:             TypeImage 6(float) Cube depth sampled format:Unknown
+              99:             TypePointer UniformConstant 98
+ 100(g_tTexcdf4):     99(ptr) Variable UniformConstant
+             103:             TypeSampledImage 98
+             105:    6(float) Constant 1050253722
+             106:   65(fvec3) ConstantComposite 24 63 105
+             114:             TypeImage 32(int) Cube depth sampled format:Unknown
+             115:             TypePointer UniformConstant 114
+ 116(g_tTexcdi4):    115(ptr) Variable UniformConstant
+             119:             TypeSampledImage 114
+             128:             TypeImage 44(int) Cube depth sampled format:Unknown
+             129:             TypePointer UniformConstant 128
+ 130(g_tTexcdu4):    129(ptr) Variable UniformConstant
+             133:             TypeSampledImage 128
+             141:             TypePointer Function 8(PS_OUTPUT)
+             143:     32(int) Constant 0
+             144:    6(float) Constant 1065353216
+             145:    7(fvec4) ConstantComposite 144 144 144 144
+             146:             TypePointer Function 7(fvec4)
+             148:     32(int) Constant 1
+             155:             TypePointer Output 7(fvec4)
+156(@entryPointOutput.Color):    155(ptr) Variable Output
+             159:             TypePointer Output 6(float)
+160(@entryPointOutput.Depth):    159(ptr) Variable Output
+             163:             TypeImage 6(float) 3D sampled format:Unknown
+             164:             TypePointer UniformConstant 163
+ 165(g_tTex3df4):    164(ptr) Variable UniformConstant
+             166:             TypeImage 32(int) 3D sampled format:Unknown
+             167:             TypePointer UniformConstant 166
+ 168(g_tTex3di4):    167(ptr) Variable UniformConstant
+             169:             TypeImage 44(int) 3D sampled format:Unknown
+             170:             TypePointer UniformConstant 169
+ 171(g_tTex3du4):    170(ptr) Variable UniformConstant
+             172:             TypeImage 6(float) 1D array sampled format:Unknown
              173:             TypePointer UniformConstant 172
- 174(g_tTex3df4):    173(ptr) Variable UniformConstant
-             175:             TypeImage 33(int) 3D sampled format:Unknown
+174(g_tTex1df4a):    173(ptr) Variable UniformConstant
+             175:             TypeImage 32(int) 1D array sampled format:Unknown
              176:             TypePointer UniformConstant 175
- 177(g_tTex3di4):    176(ptr) Variable UniformConstant
-             178:             TypeImage 46(int) 3D sampled format:Unknown
+177(g_tTex1di4a):    176(ptr) Variable UniformConstant
+             178:             TypeImage 44(int) 1D array sampled format:Unknown
              179:             TypePointer UniformConstant 178
- 180(g_tTex3du4):    179(ptr) Variable UniformConstant
-             181:             TypeImage 6(float) 1D array sampled format:Unknown
+180(g_tTex1du4a):    179(ptr) Variable UniformConstant
+             181:             TypeImage 6(float) 2D array sampled format:Unknown
              182:             TypePointer UniformConstant 181
-183(g_tTex1df4a):    182(ptr) Variable UniformConstant
-             184:             TypeImage 33(int) 1D array sampled format:Unknown
+183(g_tTex2df4a):    182(ptr) Variable UniformConstant
+             184:             TypeImage 32(int) 2D array sampled format:Unknown
              185:             TypePointer UniformConstant 184
-186(g_tTex1di4a):    185(ptr) Variable UniformConstant
-             187:             TypeImage 46(int) 1D array sampled format:Unknown
+186(g_tTex2di4a):    185(ptr) Variable UniformConstant
+             187:             TypeImage 44(int) 2D array sampled format:Unknown
              188:             TypePointer UniformConstant 187
-189(g_tTex1du4a):    188(ptr) Variable UniformConstant
-             190:             TypeImage 6(float) 2D array sampled format:Unknown
+189(g_tTex2du4a):    188(ptr) Variable UniformConstant
+             190:             TypeImage 6(float) Cube array sampled format:Unknown
              191:             TypePointer UniformConstant 190
-192(g_tTex2df4a):    191(ptr) Variable UniformConstant
-             193:             TypeImage 33(int) 2D array sampled format:Unknown
+192(g_tTexcdf4a):    191(ptr) Variable UniformConstant
+             193:             TypeImage 32(int) Cube array sampled format:Unknown
              194:             TypePointer UniformConstant 193
-195(g_tTex2di4a):    194(ptr) Variable UniformConstant
-             196:             TypeImage 46(int) 2D array sampled format:Unknown
+195(g_tTexcdi4a):    194(ptr) Variable UniformConstant
+             196:             TypeImage 44(int) Cube array sampled format:Unknown
              197:             TypePointer UniformConstant 196
-198(g_tTex2du4a):    197(ptr) Variable UniformConstant
-             199:             TypeImage 6(float) Cube array sampled format:Unknown
-             200:             TypePointer UniformConstant 199
-201(g_tTexcdf4a):    200(ptr) Variable UniformConstant
-             202:             TypeImage 33(int) Cube array sampled format:Unknown
-             203:             TypePointer UniformConstant 202
-204(g_tTexcdi4a):    203(ptr) Variable UniformConstant
-             205:             TypeImage 46(int) Cube array sampled format:Unknown
-             206:             TypePointer UniformConstant 205
-207(g_tTexcdu4a):    206(ptr) Variable UniformConstant
+198(g_tTexcdu4a):    197(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
-162(flattenTemp):    150(ptr) Variable Function
-             163:8(PS_OUTPUT) FunctionCall 10(@main()
-                              Store 162(flattenTemp) 163
-             166:    155(ptr) AccessChain 162(flattenTemp) 152
-             167:    7(fvec4) Load 166
-                              Store 165(@entryPointOutput.Color) 167
-             170:     12(ptr) AccessChain 162(flattenTemp) 157
-             171:    6(float) Load 170
-                              Store 169(@entryPointOutput.Depth) 171
+153(flattenTemp):    141(ptr) Variable Function
+             154:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 153(flattenTemp) 154
+             157:    146(ptr) AccessChain 153(flattenTemp) 143
+             158:    7(fvec4) Load 157
+                              Store 156(@entryPointOutput.Color) 158
+             161:     12(ptr) AccessChain 153(flattenTemp) 148
+             162:    6(float) Load 161
+                              Store 160(@entryPointOutput.Depth) 162
                               Return
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
          13(r00):     12(ptr) Variable Function
-         32(r02):     12(ptr) Variable Function
-         45(r04):     12(ptr) Variable Function
-         58(r20):     12(ptr) Variable Function
-         75(r22):     12(ptr) Variable Function
-         89(r24):     12(ptr) Variable Function
-        103(r50):     12(ptr) Variable Function
-        120(r52):     12(ptr) Variable Function
-        135(r54):     12(ptr) Variable Function
-      151(psout):    150(ptr) Variable Function
+         31(r02):     12(ptr) Variable Function
+         43(r04):     12(ptr) Variable Function
+         55(r20):     12(ptr) Variable Function
+         71(r22):     12(ptr) Variable Function
+         84(r24):     12(ptr) Variable Function
+         97(r50):     12(ptr) Variable Function
+        113(r52):     12(ptr) Variable Function
+        127(r54):     12(ptr) Variable Function
+      142(psout):    141(ptr) Variable Function
               17:          14 Load 16(g_tTex1df4)
               21:          18 Load 20(g_sSamp)
-              24:          23 SampledImage 17 21
-              28:   27(fvec2) CompositeConstruct 25 26
-              30:    6(float) CompositeExtract 28 1
-              31:    6(float) ImageSampleDrefExplicitLod 24 28 30 Lod 29
-                              Store 13(r00) 31
-              37:          34 Load 36(g_tTex1di4)
-              38:          18 Load 20(g_sSamp)
-              41:          40 SampledImage 37 38
-              42:   27(fvec2) CompositeConstruct 25 26
-              43:    6(float) CompositeExtract 42 1
-              44:    6(float) ImageSampleDrefExplicitLod 41 42 43 Lod 29
-                              Store 32(r02) 44
-              50:          47 Load 49(g_tTex1du4)
-              51:          18 Load 20(g_sSamp)
-              54:          53 SampledImage 50 51
-              55:   27(fvec2) CompositeConstruct 25 26
-              56:    6(float) CompositeExtract 55 1
-              57:    6(float) ImageSampleDrefExplicitLod 54 55 56 Lod 29
-                              Store 45(r04) 57
-              62:          59 Load 61(g_tTex2df4)
-              63:          18 Load 20(g_sSamp)
-              66:          65 SampledImage 62 63
-              70:    6(float) CompositeExtract 68 0
-              71:    6(float) CompositeExtract 68 1
-              72:   69(fvec3) CompositeConstruct 70 71 26
-              73:    6(float) CompositeExtract 72 2
-              74:    6(float) ImageSampleDrefExplicitLod 66 72 73 Lod 29
-                              Store 58(r20) 74
-              79:          76 Load 78(g_tTex2di4)
-              80:          18 Load 20(g_sSamp)
-              83:          82 SampledImage 79 80
-              84:    6(float) CompositeExtract 68 0
-              85:    6(float) CompositeExtract 68 1
-              86:   69(fvec3) CompositeConstruct 84 85 26
-              87:    6(float) CompositeExtract 86 2
-              88:    6(float) ImageSampleDrefExplicitLod 83 86 87 Lod 29
-                              Store 75(r22) 88
-              93:          90 Load 92(g_tTex2du4)
-              94:          18 Load 20(g_sSamp)
-              97:          96 SampledImage 93 94
-              98:    6(float) CompositeExtract 68 0
-              99:    6(float) CompositeExtract 68 1
-             100:   69(fvec3) CompositeConstruct 98 99 26
-             101:    6(float) CompositeExtract 100 2
-             102:    6(float) ImageSampleDrefExplicitLod 97 100 101 Lod 29
-                              Store 89(r24) 102
-             107:         104 Load 106(g_tTexcdf4)
-             108:          18 Load 20(g_sSamp)
-             111:         110 SampledImage 107 108
-             114:    6(float) CompositeExtract 113 0
-             115:    6(float) CompositeExtract 113 1
-             116:    6(float) CompositeExtract 113 2
-             117:    7(fvec4) CompositeConstruct 114 115 116 26
-             118:    6(float) CompositeExtract 117 3
-             119:    6(float) ImageSampleDrefExplicitLod 111 117 118 Lod 29
-                              Store 103(r50) 119
-             124:         121 Load 123(g_tTexcdi4)
-             125:          18 Load 20(g_sSamp)
-             128:         127 SampledImage 124 125
-             129:    6(float) CompositeExtract 113 0
-             130:    6(float) CompositeExtract 113 1
-             131:    6(float) CompositeExtract 113 2
-             132:    7(fvec4) CompositeConstruct 129 130 131 26
-             133:    6(float) CompositeExtract 132 3
-             134:    6(float) ImageSampleDrefExplicitLod 128 132 133 Lod 29
-                              Store 120(r52) 134
-             139:         136 Load 138(g_tTexcdu4)
-             140:          18 Load 20(g_sSamp)
-             143:         142 SampledImage 139 140
-             144:    6(float) CompositeExtract 113 0
-             145:    6(float) CompositeExtract 113 1
-             146:    6(float) CompositeExtract 113 2
-             147:    7(fvec4) CompositeConstruct 144 145 146 26
-             148:    6(float) CompositeExtract 147 3
-             149:    6(float) ImageSampleDrefExplicitLod 143 147 148 Lod 29
-                              Store 135(r54) 149
-             156:    155(ptr) AccessChain 151(psout) 152
-                              Store 156 154
-             158:     12(ptr) AccessChain 151(psout) 157
-                              Store 158 153
-             159:8(PS_OUTPUT) Load 151(psout)
-                              ReturnValue 159
+              23:          22 SampledImage 17 21
+              27:   26(fvec2) CompositeConstruct 24 25
+              29:    6(float) CompositeExtract 27 1
+              30:    6(float) ImageSampleDrefExplicitLod 23 27 29 Lod 28
+                              Store 13(r00) 30
+              36:          33 Load 35(g_tTex1di4)
+              37:          18 Load 20(g_sSamp)
+              39:          38 SampledImage 36 37
+              40:   26(fvec2) CompositeConstruct 24 25
+              41:    6(float) CompositeExtract 40 1
+              42:    6(float) ImageSampleDrefExplicitLod 39 40 41 Lod 28
+                              Store 31(r02) 42
+              48:          45 Load 47(g_tTex1du4)
+              49:          18 Load 20(g_sSamp)
+              51:          50 SampledImage 48 49
+              52:   26(fvec2) CompositeConstruct 24 25
+              53:    6(float) CompositeExtract 52 1
+              54:    6(float) ImageSampleDrefExplicitLod 51 52 53 Lod 28
+                              Store 43(r04) 54
+              59:          56 Load 58(g_tTex2df4)
+              60:          18 Load 20(g_sSamp)
+              62:          61 SampledImage 59 60
+              66:    6(float) CompositeExtract 64 0
+              67:    6(float) CompositeExtract 64 1
+              68:   65(fvec3) CompositeConstruct 66 67 25
+              69:    6(float) CompositeExtract 68 2
+              70:    6(float) ImageSampleDrefExplicitLod 62 68 69 Lod 28
+                              Store 55(r20) 70
+              75:          72 Load 74(g_tTex2di4)
+              76:          18 Load 20(g_sSamp)
+              78:          77 SampledImage 75 76
+              79:    6(float) CompositeExtract 64 0
+              80:    6(float) CompositeExtract 64 1
+              81:   65(fvec3) CompositeConstruct 79 80 25
+              82:    6(float) CompositeExtract 81 2
+              83:    6(float) ImageSampleDrefExplicitLod 78 81 82 Lod 28
+                              Store 71(r22) 83
+              88:          85 Load 87(g_tTex2du4)
+              89:          18 Load 20(g_sSamp)
+              91:          90 SampledImage 88 89
+              92:    6(float) CompositeExtract 64 0
+              93:    6(float) CompositeExtract 64 1
+              94:   65(fvec3) CompositeConstruct 92 93 25
+              95:    6(float) CompositeExtract 94 2
+              96:    6(float) ImageSampleDrefExplicitLod 91 94 95 Lod 28
+                              Store 84(r24) 96
+             101:          98 Load 100(g_tTexcdf4)
+             102:          18 Load 20(g_sSamp)
+             104:         103 SampledImage 101 102
+             107:    6(float) CompositeExtract 106 0
+             108:    6(float) CompositeExtract 106 1
+             109:    6(float) CompositeExtract 106 2
+             110:    7(fvec4) CompositeConstruct 107 108 109 25
+             111:    6(float) CompositeExtract 110 3
+             112:    6(float) ImageSampleDrefExplicitLod 104 110 111 Lod 28
+                              Store 97(r50) 112
+             117:         114 Load 116(g_tTexcdi4)
+             118:          18 Load 20(g_sSamp)
+             120:         119 SampledImage 117 118
+             121:    6(float) CompositeExtract 106 0
+             122:    6(float) CompositeExtract 106 1
+             123:    6(float) CompositeExtract 106 2
+             124:    7(fvec4) CompositeConstruct 121 122 123 25
+             125:    6(float) CompositeExtract 124 3
+             126:    6(float) ImageSampleDrefExplicitLod 120 124 125 Lod 28
+                              Store 113(r52) 126
+             131:         128 Load 130(g_tTexcdu4)
+             132:          18 Load 20(g_sSamp)
+             134:         133 SampledImage 131 132
+             135:    6(float) CompositeExtract 106 0
+             136:    6(float) CompositeExtract 106 1
+             137:    6(float) CompositeExtract 106 2
+             138:    7(fvec4) CompositeConstruct 135 136 137 25
+             139:    6(float) CompositeExtract 138 3
+             140:    6(float) ImageSampleDrefExplicitLod 134 138 139 Lod 28
+                              Store 127(r54) 140
+             147:    146(ptr) AccessChain 142(psout) 143
+                              Store 147 145
+             149:     12(ptr) AccessChain 142(psout) 148
+                              Store 149 144
+             150:8(PS_OUTPUT) Load 142(psout)
+                              ReturnValue 150
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.samplecmplevelzero.offset.dx10.frag.out b/Test/baseResults/hlsl.samplecmplevelzero.offset.dx10.frag.out
index 7cf097f..141f1f4 100644
--- a/Test/baseResults/hlsl.samplecmplevelzero.offset.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplecmplevelzero.offset.dx10.frag.out
@@ -10,7 +10,7 @@
 0:42          'r01' ( temp float)
 0:42          textureLodOffset ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DShadow)
-0:42              'g_tTex1df4' (layout( binding=0) uniform texture1D)
+0:42              'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec2 ( temp 2-component vector of float)
 0:42              Constant:
@@ -26,7 +26,7 @@
 0:43          'r03' ( temp float)
 0:43          textureLodOffset ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DShadow)
-0:43              'g_tTex1di4' ( uniform itexture1D)
+0:43              'g_tTex1di4' ( uniform itexture1DShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec2 ( temp 2-component vector of float)
 0:43              Constant:
@@ -42,7 +42,7 @@
 0:44          'r05' ( temp float)
 0:44          textureLodOffset ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DShadow)
-0:44              'g_tTex1du4' ( uniform utexture1D)
+0:44              'g_tTex1du4' ( uniform utexture1DShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec2 ( temp 2-component vector of float)
 0:44              Constant:
@@ -58,7 +58,7 @@
 0:47          'r21' ( temp float)
 0:47          textureLodOffset ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DShadow)
-0:47              'g_tTex2df4' ( uniform texture2D)
+0:47              'g_tTex2df4' ( uniform texture2DShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -76,7 +76,7 @@
 0:48          'r23' ( temp float)
 0:48          textureLodOffset ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DShadow)
-0:48              'g_tTex2di4' ( uniform itexture2D)
+0:48              'g_tTex2di4' ( uniform itexture2DShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -94,7 +94,7 @@
 0:49          'r25' ( temp float)
 0:49          textureLodOffset ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DShadow)
-0:49              'g_tTex2du4' ( uniform utexture2D)
+0:49              'g_tTex2du4' ( uniform utexture2DShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -147,12 +147,12 @@
 0:38              1 (const int)
 0:?   Linker Objects
 0:?     'g_sSamp' (layout( binding=0) uniform sampler)
-0:?     'g_tTex1df4' (layout( binding=0) uniform texture1D)
-0:?     'g_tTex1di4' ( uniform itexture1D)
-0:?     'g_tTex1du4' ( uniform utexture1D)
-0:?     'g_tTex2df4' ( uniform texture2D)
-0:?     'g_tTex2di4' ( uniform itexture2D)
-0:?     'g_tTex2du4' ( uniform utexture2D)
+0:?     'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
+0:?     'g_tTex1di4' ( uniform itexture1DShadow)
+0:?     'g_tTex1du4' ( uniform utexture1DShadow)
+0:?     'g_tTex2df4' ( uniform texture2DShadow)
+0:?     'g_tTex2di4' ( uniform itexture2DShadow)
+0:?     'g_tTex2du4' ( uniform utexture2DShadow)
 0:?     'g_tTex3df4' ( uniform texture3D)
 0:?     'g_tTex3di4' ( uniform itexture3D)
 0:?     'g_tTex3du4' ( uniform utexture3D)
@@ -186,7 +186,7 @@
 0:42          'r01' ( temp float)
 0:42          textureLodOffset ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DShadow)
-0:42              'g_tTex1df4' (layout( binding=0) uniform texture1D)
+0:42              'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec2 ( temp 2-component vector of float)
 0:42              Constant:
@@ -202,7 +202,7 @@
 0:43          'r03' ( temp float)
 0:43          textureLodOffset ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DShadow)
-0:43              'g_tTex1di4' ( uniform itexture1D)
+0:43              'g_tTex1di4' ( uniform itexture1DShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec2 ( temp 2-component vector of float)
 0:43              Constant:
@@ -218,7 +218,7 @@
 0:44          'r05' ( temp float)
 0:44          textureLodOffset ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DShadow)
-0:44              'g_tTex1du4' ( uniform utexture1D)
+0:44              'g_tTex1du4' ( uniform utexture1DShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec2 ( temp 2-component vector of float)
 0:44              Constant:
@@ -234,7 +234,7 @@
 0:47          'r21' ( temp float)
 0:47          textureLodOffset ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DShadow)
-0:47              'g_tTex2df4' ( uniform texture2D)
+0:47              'g_tTex2df4' ( uniform texture2DShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -252,7 +252,7 @@
 0:48          'r23' ( temp float)
 0:48          textureLodOffset ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DShadow)
-0:48              'g_tTex2di4' ( uniform itexture2D)
+0:48              'g_tTex2di4' ( uniform itexture2DShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -270,7 +270,7 @@
 0:49          'r25' ( temp float)
 0:49          textureLodOffset ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DShadow)
-0:49              'g_tTex2du4' ( uniform utexture2D)
+0:49              'g_tTex2du4' ( uniform utexture2DShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -323,12 +323,12 @@
 0:38              1 (const int)
 0:?   Linker Objects
 0:?     'g_sSamp' (layout( binding=0) uniform sampler)
-0:?     'g_tTex1df4' (layout( binding=0) uniform texture1D)
-0:?     'g_tTex1di4' ( uniform itexture1D)
-0:?     'g_tTex1du4' ( uniform utexture1D)
-0:?     'g_tTex2df4' ( uniform texture2D)
-0:?     'g_tTex2di4' ( uniform itexture2D)
-0:?     'g_tTex2du4' ( uniform utexture2D)
+0:?     'g_tTex1df4' (layout( binding=0) uniform texture1DShadow)
+0:?     'g_tTex1di4' ( uniform itexture1DShadow)
+0:?     'g_tTex1du4' ( uniform utexture1DShadow)
+0:?     'g_tTex2df4' ( uniform texture2DShadow)
+0:?     'g_tTex2di4' ( uniform itexture2DShadow)
+0:?     'g_tTex2du4' ( uniform utexture2DShadow)
 0:?     'g_tTex3df4' ( uniform texture3D)
 0:?     'g_tTex3di4' ( uniform itexture3D)
 0:?     'g_tTex3du4' ( uniform utexture3D)
@@ -349,14 +349,14 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 174
+// Id's are bound by 168
 
                               Capability Shader
                               Capability Sampled1D
                               Capability SampledCubeArray
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 122 126
+                              EntryPoint Fragment 4  "main" 116 120
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -367,61 +367,61 @@
                               Name 13  "r01"
                               Name 16  "g_tTex1df4"
                               Name 20  "g_sSamp"
-                              Name 34  "r03"
-                              Name 37  "g_tTex1di4"
-                              Name 46  "r05"
-                              Name 50  "g_tTex1du4"
-                              Name 59  "r21"
-                              Name 62  "g_tTex2df4"
-                              Name 79  "r23"
-                              Name 82  "g_tTex2di4"
-                              Name 93  "r25"
-                              Name 96  "g_tTex2du4"
-                              Name 108  "psout"
-                              Name 119  "flattenTemp"
-                              Name 122  "@entryPointOutput.Color"
-                              Name 126  "@entryPointOutput.Depth"
-                              Name 131  "g_tTex3df4"
-                              Name 134  "g_tTex3di4"
-                              Name 137  "g_tTex3du4"
-                              Name 140  "g_tTexcdf4"
-                              Name 143  "g_tTexcdi4"
-                              Name 146  "g_tTexcdu4"
-                              Name 149  "g_tTex1df4a"
-                              Name 152  "g_tTex1di4a"
-                              Name 155  "g_tTex1du4a"
-                              Name 158  "g_tTex2df4a"
-                              Name 161  "g_tTex2di4a"
-                              Name 164  "g_tTex2du4a"
-                              Name 167  "g_tTexcdf4a"
-                              Name 170  "g_tTexcdi4a"
-                              Name 173  "g_tTexcdu4a"
+                              Name 33  "r03"
+                              Name 36  "g_tTex1di4"
+                              Name 44  "r05"
+                              Name 48  "g_tTex1du4"
+                              Name 56  "r21"
+                              Name 59  "g_tTex2df4"
+                              Name 75  "r23"
+                              Name 78  "g_tTex2di4"
+                              Name 88  "r25"
+                              Name 91  "g_tTex2du4"
+                              Name 102  "psout"
+                              Name 113  "flattenTemp"
+                              Name 116  "@entryPointOutput.Color"
+                              Name 120  "@entryPointOutput.Depth"
+                              Name 125  "g_tTex3df4"
+                              Name 128  "g_tTex3di4"
+                              Name 131  "g_tTex3du4"
+                              Name 134  "g_tTexcdf4"
+                              Name 137  "g_tTexcdi4"
+                              Name 140  "g_tTexcdu4"
+                              Name 143  "g_tTex1df4a"
+                              Name 146  "g_tTex1di4a"
+                              Name 149  "g_tTex1du4a"
+                              Name 152  "g_tTex2df4a"
+                              Name 155  "g_tTex2di4a"
+                              Name 158  "g_tTex2du4a"
+                              Name 161  "g_tTexcdf4a"
+                              Name 164  "g_tTexcdi4a"
+                              Name 167  "g_tTexcdu4a"
                               Decorate 16(g_tTex1df4) DescriptorSet 0
                               Decorate 16(g_tTex1df4) Binding 0
                               Decorate 20(g_sSamp) DescriptorSet 0
                               Decorate 20(g_sSamp) Binding 0
-                              Decorate 37(g_tTex1di4) DescriptorSet 0
-                              Decorate 50(g_tTex1du4) DescriptorSet 0
-                              Decorate 62(g_tTex2df4) DescriptorSet 0
-                              Decorate 82(g_tTex2di4) DescriptorSet 0
-                              Decorate 96(g_tTex2du4) DescriptorSet 0
-                              Decorate 122(@entryPointOutput.Color) Location 0
-                              Decorate 126(@entryPointOutput.Depth) BuiltIn FragDepth
-                              Decorate 131(g_tTex3df4) DescriptorSet 0
-                              Decorate 134(g_tTex3di4) DescriptorSet 0
-                              Decorate 137(g_tTex3du4) DescriptorSet 0
-                              Decorate 140(g_tTexcdf4) DescriptorSet 0
-                              Decorate 143(g_tTexcdi4) DescriptorSet 0
-                              Decorate 146(g_tTexcdu4) DescriptorSet 0
-                              Decorate 149(g_tTex1df4a) DescriptorSet 0
-                              Decorate 152(g_tTex1di4a) DescriptorSet 0
-                              Decorate 155(g_tTex1du4a) DescriptorSet 0
-                              Decorate 158(g_tTex2df4a) DescriptorSet 0
-                              Decorate 161(g_tTex2di4a) DescriptorSet 0
-                              Decorate 164(g_tTex2du4a) DescriptorSet 0
-                              Decorate 167(g_tTexcdf4a) DescriptorSet 0
-                              Decorate 170(g_tTexcdi4a) DescriptorSet 0
-                              Decorate 173(g_tTexcdu4a) DescriptorSet 0
+                              Decorate 36(g_tTex1di4) DescriptorSet 0
+                              Decorate 48(g_tTex1du4) DescriptorSet 0
+                              Decorate 59(g_tTex2df4) DescriptorSet 0
+                              Decorate 78(g_tTex2di4) DescriptorSet 0
+                              Decorate 91(g_tTex2du4) DescriptorSet 0
+                              Decorate 116(@entryPointOutput.Color) Location 0
+                              Decorate 120(@entryPointOutput.Depth) BuiltIn FragDepth
+                              Decorate 125(g_tTex3df4) DescriptorSet 0
+                              Decorate 128(g_tTex3di4) DescriptorSet 0
+                              Decorate 131(g_tTex3du4) DescriptorSet 0
+                              Decorate 134(g_tTexcdf4) DescriptorSet 0
+                              Decorate 137(g_tTexcdi4) DescriptorSet 0
+                              Decorate 140(g_tTexcdu4) DescriptorSet 0
+                              Decorate 143(g_tTex1df4a) DescriptorSet 0
+                              Decorate 146(g_tTex1di4a) DescriptorSet 0
+                              Decorate 149(g_tTex1du4a) DescriptorSet 0
+                              Decorate 152(g_tTex2df4a) DescriptorSet 0
+                              Decorate 155(g_tTex2di4a) DescriptorSet 0
+                              Decorate 158(g_tTex2du4a) DescriptorSet 0
+                              Decorate 161(g_tTexcdf4a) DescriptorSet 0
+                              Decorate 164(g_tTexcdi4a) DescriptorSet 0
+                              Decorate 167(g_tTexcdu4a) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -429,181 +429,175 @@
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
                9:             TypeFunction 8(PS_OUTPUT)
               12:             TypePointer Function 6(float)
-              14:             TypeImage 6(float) 1D sampled format:Unknown
+              14:             TypeImage 6(float) 1D depth sampled format:Unknown
               15:             TypePointer UniformConstant 14
   16(g_tTex1df4):     15(ptr) Variable UniformConstant
               18:             TypeSampler
               19:             TypePointer UniformConstant 18
      20(g_sSamp):     19(ptr) Variable UniformConstant
-              22:             TypeImage 6(float) 1D depth sampled format:Unknown
-              23:             TypeSampledImage 22
-              25:    6(float) Constant 1036831949
-              26:    6(float) Constant 1061158912
-              27:             TypeVector 6(float) 2
-              29:    6(float) Constant 0
-              30:             TypeInt 32 1
-              31:     30(int) Constant 2
-              35:             TypeImage 30(int) 1D sampled format:Unknown
-              36:             TypePointer UniformConstant 35
-  37(g_tTex1di4):     36(ptr) Variable UniformConstant
-              40:             TypeImage 30(int) 1D depth sampled format:Unknown
-              41:             TypeSampledImage 40
-              47:             TypeInt 32 0
-              48:             TypeImage 47(int) 1D sampled format:Unknown
-              49:             TypePointer UniformConstant 48
-  50(g_tTex1du4):     49(ptr) Variable UniformConstant
-              53:             TypeImage 47(int) 1D depth sampled format:Unknown
-              54:             TypeSampledImage 53
-              60:             TypeImage 6(float) 2D sampled format:Unknown
-              61:             TypePointer UniformConstant 60
-  62(g_tTex2df4):     61(ptr) Variable UniformConstant
-              65:             TypeImage 6(float) 2D depth sampled format:Unknown
-              66:             TypeSampledImage 65
-              68:    6(float) Constant 1045220557
-              69:   27(fvec2) ConstantComposite 25 68
-              70:             TypeVector 6(float) 3
-              74:             TypeVector 30(int) 2
-              75:     30(int) Constant 3
-              76:   74(ivec2) ConstantComposite 31 75
-              80:             TypeImage 30(int) 2D sampled format:Unknown
-              81:             TypePointer UniformConstant 80
-  82(g_tTex2di4):     81(ptr) Variable UniformConstant
-              85:             TypeImage 30(int) 2D depth sampled format:Unknown
-              86:             TypeSampledImage 85
-              94:             TypeImage 47(int) 2D sampled format:Unknown
-              95:             TypePointer UniformConstant 94
-  96(g_tTex2du4):     95(ptr) Variable UniformConstant
-              99:             TypeImage 47(int) 2D depth sampled format:Unknown
-             100:             TypeSampledImage 99
-             107:             TypePointer Function 8(PS_OUTPUT)
-             109:     30(int) Constant 0
-             110:    6(float) Constant 1065353216
-             111:    7(fvec4) ConstantComposite 110 110 110 110
-             112:             TypePointer Function 7(fvec4)
-             114:     30(int) Constant 1
-             121:             TypePointer Output 7(fvec4)
-122(@entryPointOutput.Color):    121(ptr) Variable Output
-             125:             TypePointer Output 6(float)
-126(@entryPointOutput.Depth):    125(ptr) Variable Output
-             129:             TypeImage 6(float) 3D sampled format:Unknown
+              22:             TypeSampledImage 14
+              24:    6(float) Constant 1036831949
+              25:    6(float) Constant 1061158912
+              26:             TypeVector 6(float) 2
+              28:    6(float) Constant 0
+              29:             TypeInt 32 1
+              30:     29(int) Constant 2
+              34:             TypeImage 29(int) 1D depth sampled format:Unknown
+              35:             TypePointer UniformConstant 34
+  36(g_tTex1di4):     35(ptr) Variable UniformConstant
+              39:             TypeSampledImage 34
+              45:             TypeInt 32 0
+              46:             TypeImage 45(int) 1D depth sampled format:Unknown
+              47:             TypePointer UniformConstant 46
+  48(g_tTex1du4):     47(ptr) Variable UniformConstant
+              51:             TypeSampledImage 46
+              57:             TypeImage 6(float) 2D depth sampled format:Unknown
+              58:             TypePointer UniformConstant 57
+  59(g_tTex2df4):     58(ptr) Variable UniformConstant
+              62:             TypeSampledImage 57
+              64:    6(float) Constant 1045220557
+              65:   26(fvec2) ConstantComposite 24 64
+              66:             TypeVector 6(float) 3
+              70:             TypeVector 29(int) 2
+              71:     29(int) Constant 3
+              72:   70(ivec2) ConstantComposite 30 71
+              76:             TypeImage 29(int) 2D depth sampled format:Unknown
+              77:             TypePointer UniformConstant 76
+  78(g_tTex2di4):     77(ptr) Variable UniformConstant
+              81:             TypeSampledImage 76
+              89:             TypeImage 45(int) 2D depth sampled format:Unknown
+              90:             TypePointer UniformConstant 89
+  91(g_tTex2du4):     90(ptr) Variable UniformConstant
+              94:             TypeSampledImage 89
+             101:             TypePointer Function 8(PS_OUTPUT)
+             103:     29(int) Constant 0
+             104:    6(float) Constant 1065353216
+             105:    7(fvec4) ConstantComposite 104 104 104 104
+             106:             TypePointer Function 7(fvec4)
+             108:     29(int) Constant 1
+             115:             TypePointer Output 7(fvec4)
+116(@entryPointOutput.Color):    115(ptr) Variable Output
+             119:             TypePointer Output 6(float)
+120(@entryPointOutput.Depth):    119(ptr) Variable Output
+             123:             TypeImage 6(float) 3D sampled format:Unknown
+             124:             TypePointer UniformConstant 123
+ 125(g_tTex3df4):    124(ptr) Variable UniformConstant
+             126:             TypeImage 29(int) 3D sampled format:Unknown
+             127:             TypePointer UniformConstant 126
+ 128(g_tTex3di4):    127(ptr) Variable UniformConstant
+             129:             TypeImage 45(int) 3D sampled format:Unknown
              130:             TypePointer UniformConstant 129
- 131(g_tTex3df4):    130(ptr) Variable UniformConstant
-             132:             TypeImage 30(int) 3D sampled format:Unknown
+ 131(g_tTex3du4):    130(ptr) Variable UniformConstant
+             132:             TypeImage 6(float) Cube sampled format:Unknown
              133:             TypePointer UniformConstant 132
- 134(g_tTex3di4):    133(ptr) Variable UniformConstant
-             135:             TypeImage 47(int) 3D sampled format:Unknown
+ 134(g_tTexcdf4):    133(ptr) Variable UniformConstant
+             135:             TypeImage 29(int) Cube sampled format:Unknown
              136:             TypePointer UniformConstant 135
- 137(g_tTex3du4):    136(ptr) Variable UniformConstant
-             138:             TypeImage 6(float) Cube sampled format:Unknown
+ 137(g_tTexcdi4):    136(ptr) Variable UniformConstant
+             138:             TypeImage 45(int) Cube sampled format:Unknown
              139:             TypePointer UniformConstant 138
- 140(g_tTexcdf4):    139(ptr) Variable UniformConstant
-             141:             TypeImage 30(int) Cube sampled format:Unknown
+ 140(g_tTexcdu4):    139(ptr) Variable UniformConstant
+             141:             TypeImage 6(float) 1D array sampled format:Unknown
              142:             TypePointer UniformConstant 141
- 143(g_tTexcdi4):    142(ptr) Variable UniformConstant
-             144:             TypeImage 47(int) Cube sampled format:Unknown
+143(g_tTex1df4a):    142(ptr) Variable UniformConstant
+             144:             TypeImage 29(int) 1D array sampled format:Unknown
              145:             TypePointer UniformConstant 144
- 146(g_tTexcdu4):    145(ptr) Variable UniformConstant
-             147:             TypeImage 6(float) 1D array sampled format:Unknown
+146(g_tTex1di4a):    145(ptr) Variable UniformConstant
+             147:             TypeImage 45(int) 1D array sampled format:Unknown
              148:             TypePointer UniformConstant 147
-149(g_tTex1df4a):    148(ptr) Variable UniformConstant
-             150:             TypeImage 30(int) 1D array sampled format:Unknown
+149(g_tTex1du4a):    148(ptr) Variable UniformConstant
+             150:             TypeImage 6(float) 2D array sampled format:Unknown
              151:             TypePointer UniformConstant 150
-152(g_tTex1di4a):    151(ptr) Variable UniformConstant
-             153:             TypeImage 47(int) 1D array sampled format:Unknown
+152(g_tTex2df4a):    151(ptr) Variable UniformConstant
+             153:             TypeImage 29(int) 2D array sampled format:Unknown
              154:             TypePointer UniformConstant 153
-155(g_tTex1du4a):    154(ptr) Variable UniformConstant
-             156:             TypeImage 6(float) 2D array sampled format:Unknown
+155(g_tTex2di4a):    154(ptr) Variable UniformConstant
+             156:             TypeImage 45(int) 2D array sampled format:Unknown
              157:             TypePointer UniformConstant 156
-158(g_tTex2df4a):    157(ptr) Variable UniformConstant
-             159:             TypeImage 30(int) 2D array sampled format:Unknown
+158(g_tTex2du4a):    157(ptr) Variable UniformConstant
+             159:             TypeImage 6(float) Cube array sampled format:Unknown
              160:             TypePointer UniformConstant 159
-161(g_tTex2di4a):    160(ptr) Variable UniformConstant
-             162:             TypeImage 47(int) 2D array sampled format:Unknown
+161(g_tTexcdf4a):    160(ptr) Variable UniformConstant
+             162:             TypeImage 29(int) Cube array sampled format:Unknown
              163:             TypePointer UniformConstant 162
-164(g_tTex2du4a):    163(ptr) Variable UniformConstant
-             165:             TypeImage 6(float) Cube array sampled format:Unknown
+164(g_tTexcdi4a):    163(ptr) Variable UniformConstant
+             165:             TypeImage 45(int) Cube array sampled format:Unknown
              166:             TypePointer UniformConstant 165
-167(g_tTexcdf4a):    166(ptr) Variable UniformConstant
-             168:             TypeImage 30(int) Cube array sampled format:Unknown
-             169:             TypePointer UniformConstant 168
-170(g_tTexcdi4a):    169(ptr) Variable UniformConstant
-             171:             TypeImage 47(int) Cube array sampled format:Unknown
-             172:             TypePointer UniformConstant 171
-173(g_tTexcdu4a):    172(ptr) Variable UniformConstant
+167(g_tTexcdu4a):    166(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
-119(flattenTemp):    107(ptr) Variable Function
-             120:8(PS_OUTPUT) FunctionCall 10(@main()
-                              Store 119(flattenTemp) 120
-             123:    112(ptr) AccessChain 119(flattenTemp) 109
-             124:    7(fvec4) Load 123
-                              Store 122(@entryPointOutput.Color) 124
-             127:     12(ptr) AccessChain 119(flattenTemp) 114
-             128:    6(float) Load 127
-                              Store 126(@entryPointOutput.Depth) 128
+113(flattenTemp):    101(ptr) Variable Function
+             114:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 113(flattenTemp) 114
+             117:    106(ptr) AccessChain 113(flattenTemp) 103
+             118:    7(fvec4) Load 117
+                              Store 116(@entryPointOutput.Color) 118
+             121:     12(ptr) AccessChain 113(flattenTemp) 108
+             122:    6(float) Load 121
+                              Store 120(@entryPointOutput.Depth) 122
                               Return
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
          13(r01):     12(ptr) Variable Function
-         34(r03):     12(ptr) Variable Function
-         46(r05):     12(ptr) Variable Function
-         59(r21):     12(ptr) Variable Function
-         79(r23):     12(ptr) Variable Function
-         93(r25):     12(ptr) Variable Function
-      108(psout):    107(ptr) Variable Function
+         33(r03):     12(ptr) Variable Function
+         44(r05):     12(ptr) Variable Function
+         56(r21):     12(ptr) Variable Function
+         75(r23):     12(ptr) Variable Function
+         88(r25):     12(ptr) Variable Function
+      102(psout):    101(ptr) Variable Function
               17:          14 Load 16(g_tTex1df4)
               21:          18 Load 20(g_sSamp)
-              24:          23 SampledImage 17 21
-              28:   27(fvec2) CompositeConstruct 25 26
-              32:    6(float) CompositeExtract 28 1
-              33:    6(float) ImageSampleDrefExplicitLod 24 28 32 Lod ConstOffset 29 31
-                              Store 13(r01) 33
-              38:          35 Load 37(g_tTex1di4)
-              39:          18 Load 20(g_sSamp)
-              42:          41 SampledImage 38 39
-              43:   27(fvec2) CompositeConstruct 25 26
-              44:    6(float) CompositeExtract 43 1
-              45:    6(float) ImageSampleDrefExplicitLod 42 43 44 Lod ConstOffset 29 31
-                              Store 34(r03) 45
-              51:          48 Load 50(g_tTex1du4)
-              52:          18 Load 20(g_sSamp)
-              55:          54 SampledImage 51 52
-              56:   27(fvec2) CompositeConstruct 25 26
-              57:    6(float) CompositeExtract 56 1
-              58:    6(float) ImageSampleDrefExplicitLod 55 56 57 Lod ConstOffset 29 31
-                              Store 46(r05) 58
-              63:          60 Load 62(g_tTex2df4)
-              64:          18 Load 20(g_sSamp)
-              67:          66 SampledImage 63 64
-              71:    6(float) CompositeExtract 69 0
-              72:    6(float) CompositeExtract 69 1
-              73:   70(fvec3) CompositeConstruct 71 72 26
-              77:    6(float) CompositeExtract 73 2
-              78:    6(float) ImageSampleDrefExplicitLod 67 73 77 Lod ConstOffset 29 76
-                              Store 59(r21) 78
-              83:          80 Load 82(g_tTex2di4)
-              84:          18 Load 20(g_sSamp)
-              87:          86 SampledImage 83 84
-              88:    6(float) CompositeExtract 69 0
-              89:    6(float) CompositeExtract 69 1
-              90:   70(fvec3) CompositeConstruct 88 89 26
-              91:    6(float) CompositeExtract 90 2
-              92:    6(float) ImageSampleDrefExplicitLod 87 90 91 Lod ConstOffset 29 76
-                              Store 79(r23) 92
-              97:          94 Load 96(g_tTex2du4)
-              98:          18 Load 20(g_sSamp)
-             101:         100 SampledImage 97 98
-             102:    6(float) CompositeExtract 69 0
-             103:    6(float) CompositeExtract 69 1
-             104:   70(fvec3) CompositeConstruct 102 103 26
-             105:    6(float) CompositeExtract 104 2
-             106:    6(float) ImageSampleDrefExplicitLod 101 104 105 Lod ConstOffset 29 76
-                              Store 93(r25) 106
-             113:    112(ptr) AccessChain 108(psout) 109
-                              Store 113 111
-             115:     12(ptr) AccessChain 108(psout) 114
-                              Store 115 110
-             116:8(PS_OUTPUT) Load 108(psout)
-                              ReturnValue 116
+              23:          22 SampledImage 17 21
+              27:   26(fvec2) CompositeConstruct 24 25
+              31:    6(float) CompositeExtract 27 1
+              32:    6(float) ImageSampleDrefExplicitLod 23 27 31 Lod ConstOffset 28 30
+                              Store 13(r01) 32
+              37:          34 Load 36(g_tTex1di4)
+              38:          18 Load 20(g_sSamp)
+              40:          39 SampledImage 37 38
+              41:   26(fvec2) CompositeConstruct 24 25
+              42:    6(float) CompositeExtract 41 1
+              43:    6(float) ImageSampleDrefExplicitLod 40 41 42 Lod ConstOffset 28 30
+                              Store 33(r03) 43
+              49:          46 Load 48(g_tTex1du4)
+              50:          18 Load 20(g_sSamp)
+              52:          51 SampledImage 49 50
+              53:   26(fvec2) CompositeConstruct 24 25
+              54:    6(float) CompositeExtract 53 1
+              55:    6(float) ImageSampleDrefExplicitLod 52 53 54 Lod ConstOffset 28 30
+                              Store 44(r05) 55
+              60:          57 Load 59(g_tTex2df4)
+              61:          18 Load 20(g_sSamp)
+              63:          62 SampledImage 60 61
+              67:    6(float) CompositeExtract 65 0
+              68:    6(float) CompositeExtract 65 1
+              69:   66(fvec3) CompositeConstruct 67 68 25
+              73:    6(float) CompositeExtract 69 2
+              74:    6(float) ImageSampleDrefExplicitLod 63 69 73 Lod ConstOffset 28 72
+                              Store 56(r21) 74
+              79:          76 Load 78(g_tTex2di4)
+              80:          18 Load 20(g_sSamp)
+              82:          81 SampledImage 79 80
+              83:    6(float) CompositeExtract 65 0
+              84:    6(float) CompositeExtract 65 1
+              85:   66(fvec3) CompositeConstruct 83 84 25
+              86:    6(float) CompositeExtract 85 2
+              87:    6(float) ImageSampleDrefExplicitLod 82 85 86 Lod ConstOffset 28 72
+                              Store 75(r23) 87
+              92:          89 Load 91(g_tTex2du4)
+              93:          18 Load 20(g_sSamp)
+              95:          94 SampledImage 92 93
+              96:    6(float) CompositeExtract 65 0
+              97:    6(float) CompositeExtract 65 1
+              98:   66(fvec3) CompositeConstruct 96 97 25
+              99:    6(float) CompositeExtract 98 2
+             100:    6(float) ImageSampleDrefExplicitLod 95 98 99 Lod ConstOffset 28 72
+                              Store 88(r25) 100
+             107:    106(ptr) AccessChain 102(psout) 103
+                              Store 107 105
+             109:     12(ptr) AccessChain 102(psout) 108
+                              Store 109 104
+             110:8(PS_OUTPUT) Load 102(psout)
+                              ReturnValue 110
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.samplecmplevelzero.offsetarray.dx10.frag.out b/Test/baseResults/hlsl.samplecmplevelzero.offsetarray.dx10.frag.out
index 2b404f3..84b830c 100644
--- a/Test/baseResults/hlsl.samplecmplevelzero.offsetarray.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplecmplevelzero.offsetarray.dx10.frag.out
@@ -10,7 +10,7 @@
 0:42          'r11' ( temp float)
 0:42          textureLodOffset ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DArrayShadow)
-0:42              'g_tTex1df4a' ( uniform texture1DArray)
+0:42              'g_tTex1df4a' ( uniform texture1DArrayShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -27,7 +27,7 @@
 0:43          'r13' ( temp float)
 0:43          textureLodOffset ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DArrayShadow)
-0:43              'g_tTex1di4a' ( uniform itexture1DArray)
+0:43              'g_tTex1di4a' ( uniform itexture1DArrayShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -44,7 +44,7 @@
 0:44          'r15' ( temp float)
 0:44          textureLodOffset ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DArrayShadow)
-0:44              'g_tTex1du4a' ( uniform utexture1DArray)
+0:44              'g_tTex1du4a' ( uniform utexture1DArrayShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -61,7 +61,7 @@
 0:47          'r31' ( temp float)
 0:47          textureLodOffset ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DArrayShadow)
-0:47              'g_tTex2df4a' ( uniform texture2DArray)
+0:47              'g_tTex2df4a' ( uniform texture2DArrayShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -80,7 +80,7 @@
 0:48          'r33' ( temp float)
 0:48          textureLodOffset ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DArrayShadow)
-0:48              'g_tTex2di4a' ( uniform itexture2DArray)
+0:48              'g_tTex2di4a' ( uniform itexture2DArrayShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -99,7 +99,7 @@
 0:49          'r35' ( temp float)
 0:49          textureLodOffset ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DArrayShadow)
-0:49              'g_tTex2du4a' ( uniform utexture2DArray)
+0:49              'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -165,12 +165,12 @@
 0:?     'g_tTexcdf4' ( uniform textureCube)
 0:?     'g_tTexcdi4' ( uniform itextureCube)
 0:?     'g_tTexcdu4' ( uniform utextureCube)
-0:?     'g_tTex1df4a' ( uniform texture1DArray)
-0:?     'g_tTex1di4a' ( uniform itexture1DArray)
-0:?     'g_tTex1du4a' ( uniform utexture1DArray)
-0:?     'g_tTex2df4a' ( uniform texture2DArray)
-0:?     'g_tTex2di4a' ( uniform itexture2DArray)
-0:?     'g_tTex2du4a' ( uniform utexture2DArray)
+0:?     'g_tTex1df4a' ( uniform texture1DArrayShadow)
+0:?     'g_tTex1di4a' ( uniform itexture1DArrayShadow)
+0:?     'g_tTex1du4a' ( uniform utexture1DArrayShadow)
+0:?     'g_tTex2df4a' ( uniform texture2DArrayShadow)
+0:?     'g_tTex2di4a' ( uniform itexture2DArrayShadow)
+0:?     'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:?     'g_tTexcdf4a' ( uniform textureCubeArray)
 0:?     'g_tTexcdi4a' ( uniform itextureCubeArray)
 0:?     'g_tTexcdu4a' ( uniform utextureCubeArray)
@@ -192,7 +192,7 @@
 0:42          'r11' ( temp float)
 0:42          textureLodOffset ( temp float)
 0:42            Construct combined texture-sampler ( temp sampler1DArrayShadow)
-0:42              'g_tTex1df4a' ( uniform texture1DArray)
+0:42              'g_tTex1df4a' ( uniform texture1DArrayShadow)
 0:42              'g_sSamp' (layout( binding=0) uniform sampler)
 0:42            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -209,7 +209,7 @@
 0:43          'r13' ( temp float)
 0:43          textureLodOffset ( temp float)
 0:43            Construct combined texture-sampler ( temp isampler1DArrayShadow)
-0:43              'g_tTex1di4a' ( uniform itexture1DArray)
+0:43              'g_tTex1di4a' ( uniform itexture1DArrayShadow)
 0:43              'g_sSamp' (layout( binding=0) uniform sampler)
 0:43            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -226,7 +226,7 @@
 0:44          'r15' ( temp float)
 0:44          textureLodOffset ( temp float)
 0:44            Construct combined texture-sampler ( temp usampler1DArrayShadow)
-0:44              'g_tTex1du4a' ( uniform utexture1DArray)
+0:44              'g_tTex1du4a' ( uniform utexture1DArrayShadow)
 0:44              'g_sSamp' (layout( binding=0) uniform sampler)
 0:44            Construct vec3 ( temp 3-component vector of float)
 0:?               Constant:
@@ -243,7 +243,7 @@
 0:47          'r31' ( temp float)
 0:47          textureLodOffset ( temp float)
 0:47            Construct combined texture-sampler ( temp sampler2DArrayShadow)
-0:47              'g_tTex2df4a' ( uniform texture2DArray)
+0:47              'g_tTex2df4a' ( uniform texture2DArrayShadow)
 0:47              'g_sSamp' (layout( binding=0) uniform sampler)
 0:47            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -262,7 +262,7 @@
 0:48          'r33' ( temp float)
 0:48          textureLodOffset ( temp float)
 0:48            Construct combined texture-sampler ( temp isampler2DArrayShadow)
-0:48              'g_tTex2di4a' ( uniform itexture2DArray)
+0:48              'g_tTex2di4a' ( uniform itexture2DArrayShadow)
 0:48              'g_sSamp' (layout( binding=0) uniform sampler)
 0:48            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -281,7 +281,7 @@
 0:49          'r35' ( temp float)
 0:49          textureLodOffset ( temp float)
 0:49            Construct combined texture-sampler ( temp usampler2DArrayShadow)
-0:49              'g_tTex2du4a' ( uniform utexture2DArray)
+0:49              'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:49              'g_sSamp' (layout( binding=0) uniform sampler)
 0:49            Construct vec4 ( temp 4-component vector of float)
 0:?               Constant:
@@ -347,12 +347,12 @@
 0:?     'g_tTexcdf4' ( uniform textureCube)
 0:?     'g_tTexcdi4' ( uniform itextureCube)
 0:?     'g_tTexcdu4' ( uniform utextureCube)
-0:?     'g_tTex1df4a' ( uniform texture1DArray)
-0:?     'g_tTex1di4a' ( uniform itexture1DArray)
-0:?     'g_tTex1du4a' ( uniform utexture1DArray)
-0:?     'g_tTex2df4a' ( uniform texture2DArray)
-0:?     'g_tTex2di4a' ( uniform itexture2DArray)
-0:?     'g_tTex2du4a' ( uniform utexture2DArray)
+0:?     'g_tTex1df4a' ( uniform texture1DArrayShadow)
+0:?     'g_tTex1di4a' ( uniform itexture1DArrayShadow)
+0:?     'g_tTex1du4a' ( uniform utexture1DArrayShadow)
+0:?     'g_tTex2df4a' ( uniform texture2DArrayShadow)
+0:?     'g_tTex2di4a' ( uniform itexture2DArrayShadow)
+0:?     'g_tTex2du4a' ( uniform utexture2DArrayShadow)
 0:?     'g_tTexcdf4a' ( uniform textureCubeArray)
 0:?     'g_tTexcdi4a' ( uniform itextureCubeArray)
 0:?     'g_tTexcdu4a' ( uniform utextureCubeArray)
@@ -361,14 +361,14 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 185
+// Id's are bound by 179
 
                               Capability Shader
                               Capability Sampled1D
                               Capability SampledCubeArray
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 133 137
+                              EntryPoint Fragment 4  "main" 127 131
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -379,61 +379,61 @@
                               Name 13  "r11"
                               Name 16  "g_tTex1df4a"
                               Name 20  "g_sSamp"
-                              Name 39  "r13"
-                              Name 42  "g_tTex1di4a"
-                              Name 53  "r15"
-                              Name 57  "g_tTex1du4a"
-                              Name 68  "r31"
-                              Name 71  "g_tTex2df4a"
-                              Name 88  "r33"
-                              Name 91  "g_tTex2di4a"
-                              Name 103  "r35"
-                              Name 106  "g_tTex2du4a"
-                              Name 119  "psout"
-                              Name 130  "flattenTemp"
-                              Name 133  "@entryPointOutput.Color"
-                              Name 137  "@entryPointOutput.Depth"
-                              Name 142  "g_tTex1df4"
-                              Name 145  "g_tTex1di4"
-                              Name 148  "g_tTex1du4"
-                              Name 151  "g_tTex2df4"
-                              Name 154  "g_tTex2di4"
-                              Name 157  "g_tTex2du4"
-                              Name 160  "g_tTex3df4"
-                              Name 163  "g_tTex3di4"
-                              Name 166  "g_tTex3du4"
-                              Name 169  "g_tTexcdf4"
-                              Name 172  "g_tTexcdi4"
-                              Name 175  "g_tTexcdu4"
-                              Name 178  "g_tTexcdf4a"
-                              Name 181  "g_tTexcdi4a"
-                              Name 184  "g_tTexcdu4a"
+                              Name 38  "r13"
+                              Name 41  "g_tTex1di4a"
+                              Name 51  "r15"
+                              Name 55  "g_tTex1du4a"
+                              Name 65  "r31"
+                              Name 68  "g_tTex2df4a"
+                              Name 84  "r33"
+                              Name 87  "g_tTex2di4a"
+                              Name 98  "r35"
+                              Name 101  "g_tTex2du4a"
+                              Name 113  "psout"
+                              Name 124  "flattenTemp"
+                              Name 127  "@entryPointOutput.Color"
+                              Name 131  "@entryPointOutput.Depth"
+                              Name 136  "g_tTex1df4"
+                              Name 139  "g_tTex1di4"
+                              Name 142  "g_tTex1du4"
+                              Name 145  "g_tTex2df4"
+                              Name 148  "g_tTex2di4"
+                              Name 151  "g_tTex2du4"
+                              Name 154  "g_tTex3df4"
+                              Name 157  "g_tTex3di4"
+                              Name 160  "g_tTex3du4"
+                              Name 163  "g_tTexcdf4"
+                              Name 166  "g_tTexcdi4"
+                              Name 169  "g_tTexcdu4"
+                              Name 172  "g_tTexcdf4a"
+                              Name 175  "g_tTexcdi4a"
+                              Name 178  "g_tTexcdu4a"
                               Decorate 16(g_tTex1df4a) DescriptorSet 0
                               Decorate 20(g_sSamp) DescriptorSet 0
                               Decorate 20(g_sSamp) Binding 0
-                              Decorate 42(g_tTex1di4a) DescriptorSet 0
-                              Decorate 57(g_tTex1du4a) DescriptorSet 0
-                              Decorate 71(g_tTex2df4a) DescriptorSet 0
-                              Decorate 91(g_tTex2di4a) DescriptorSet 0
-                              Decorate 106(g_tTex2du4a) DescriptorSet 0
-                              Decorate 133(@entryPointOutput.Color) Location 0
-                              Decorate 137(@entryPointOutput.Depth) BuiltIn FragDepth
-                              Decorate 142(g_tTex1df4) DescriptorSet 0
-                              Decorate 142(g_tTex1df4) Binding 0
-                              Decorate 145(g_tTex1di4) DescriptorSet 0
-                              Decorate 148(g_tTex1du4) DescriptorSet 0
-                              Decorate 151(g_tTex2df4) DescriptorSet 0
-                              Decorate 154(g_tTex2di4) DescriptorSet 0
-                              Decorate 157(g_tTex2du4) DescriptorSet 0
-                              Decorate 160(g_tTex3df4) DescriptorSet 0
-                              Decorate 163(g_tTex3di4) DescriptorSet 0
-                              Decorate 166(g_tTex3du4) DescriptorSet 0
-                              Decorate 169(g_tTexcdf4) DescriptorSet 0
-                              Decorate 172(g_tTexcdi4) DescriptorSet 0
-                              Decorate 175(g_tTexcdu4) DescriptorSet 0
-                              Decorate 178(g_tTexcdf4a) DescriptorSet 0
-                              Decorate 181(g_tTexcdi4a) DescriptorSet 0
-                              Decorate 184(g_tTexcdu4a) DescriptorSet 0
+                              Decorate 41(g_tTex1di4a) DescriptorSet 0
+                              Decorate 55(g_tTex1du4a) DescriptorSet 0
+                              Decorate 68(g_tTex2df4a) DescriptorSet 0
+                              Decorate 87(g_tTex2di4a) DescriptorSet 0
+                              Decorate 101(g_tTex2du4a) DescriptorSet 0
+                              Decorate 127(@entryPointOutput.Color) Location 0
+                              Decorate 131(@entryPointOutput.Depth) BuiltIn FragDepth
+                              Decorate 136(g_tTex1df4) DescriptorSet 0
+                              Decorate 136(g_tTex1df4) Binding 0
+                              Decorate 139(g_tTex1di4) DescriptorSet 0
+                              Decorate 142(g_tTex1du4) DescriptorSet 0
+                              Decorate 145(g_tTex2df4) DescriptorSet 0
+                              Decorate 148(g_tTex2di4) DescriptorSet 0
+                              Decorate 151(g_tTex2du4) DescriptorSet 0
+                              Decorate 154(g_tTex3df4) DescriptorSet 0
+                              Decorate 157(g_tTex3di4) DescriptorSet 0
+                              Decorate 160(g_tTex3du4) DescriptorSet 0
+                              Decorate 163(g_tTexcdf4) DescriptorSet 0
+                              Decorate 166(g_tTexcdi4) DescriptorSet 0
+                              Decorate 169(g_tTexcdu4) DescriptorSet 0
+                              Decorate 172(g_tTexcdf4a) DescriptorSet 0
+                              Decorate 175(g_tTexcdi4a) DescriptorSet 0
+                              Decorate 178(g_tTexcdu4a) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -441,192 +441,186 @@
     8(PS_OUTPUT):             TypeStruct 7(fvec4) 6(float)
                9:             TypeFunction 8(PS_OUTPUT)
               12:             TypePointer Function 6(float)
-              14:             TypeImage 6(float) 1D array sampled format:Unknown
+              14:             TypeImage 6(float) 1D depth array sampled format:Unknown
               15:             TypePointer UniformConstant 14
  16(g_tTex1df4a):     15(ptr) Variable UniformConstant
               18:             TypeSampler
               19:             TypePointer UniformConstant 18
      20(g_sSamp):     19(ptr) Variable UniformConstant
-              22:             TypeImage 6(float) 1D depth array sampled format:Unknown
-              23:             TypeSampledImage 22
-              25:             TypeVector 6(float) 2
-              26:    6(float) Constant 1036831949
-              27:    6(float) Constant 1045220557
-              28:   25(fvec2) ConstantComposite 26 27
-              29:    6(float) Constant 1061158912
-              30:             TypeVector 6(float) 3
-              34:    6(float) Constant 0
-              35:             TypeInt 32 1
-              36:     35(int) Constant 2
-              40:             TypeImage 35(int) 1D array sampled format:Unknown
-              41:             TypePointer UniformConstant 40
- 42(g_tTex1di4a):     41(ptr) Variable UniformConstant
-              45:             TypeImage 35(int) 1D depth array sampled format:Unknown
-              46:             TypeSampledImage 45
-              54:             TypeInt 32 0
-              55:             TypeImage 54(int) 1D array sampled format:Unknown
-              56:             TypePointer UniformConstant 55
- 57(g_tTex1du4a):     56(ptr) Variable UniformConstant
-              60:             TypeImage 54(int) 1D depth array sampled format:Unknown
-              61:             TypeSampledImage 60
-              69:             TypeImage 6(float) 2D array sampled format:Unknown
-              70:             TypePointer UniformConstant 69
- 71(g_tTex2df4a):     70(ptr) Variable UniformConstant
-              74:             TypeImage 6(float) 2D depth array sampled format:Unknown
-              75:             TypeSampledImage 74
-              77:    6(float) Constant 1050253722
-              78:   30(fvec3) ConstantComposite 26 27 77
-              83:             TypeVector 35(int) 2
-              84:     35(int) Constant 3
-              85:   83(ivec2) ConstantComposite 36 84
-              89:             TypeImage 35(int) 2D array sampled format:Unknown
-              90:             TypePointer UniformConstant 89
- 91(g_tTex2di4a):     90(ptr) Variable UniformConstant
-              94:             TypeImage 35(int) 2D depth array sampled format:Unknown
-              95:             TypeSampledImage 94
-             104:             TypeImage 54(int) 2D array sampled format:Unknown
-             105:             TypePointer UniformConstant 104
-106(g_tTex2du4a):    105(ptr) Variable UniformConstant
-             109:             TypeImage 54(int) 2D depth array sampled format:Unknown
-             110:             TypeSampledImage 109
-             118:             TypePointer Function 8(PS_OUTPUT)
-             120:     35(int) Constant 0
-             121:    6(float) Constant 1065353216
-             122:    7(fvec4) ConstantComposite 121 121 121 121
-             123:             TypePointer Function 7(fvec4)
-             125:     35(int) Constant 1
-             132:             TypePointer Output 7(fvec4)
-133(@entryPointOutput.Color):    132(ptr) Variable Output
-             136:             TypePointer Output 6(float)
-137(@entryPointOutput.Depth):    136(ptr) Variable Output
-             140:             TypeImage 6(float) 1D sampled format:Unknown
+              22:             TypeSampledImage 14
+              24:             TypeVector 6(float) 2
+              25:    6(float) Constant 1036831949
+              26:    6(float) Constant 1045220557
+              27:   24(fvec2) ConstantComposite 25 26
+              28:    6(float) Constant 1061158912
+              29:             TypeVector 6(float) 3
+              33:    6(float) Constant 0
+              34:             TypeInt 32 1
+              35:     34(int) Constant 2
+              39:             TypeImage 34(int) 1D depth array sampled format:Unknown
+              40:             TypePointer UniformConstant 39
+ 41(g_tTex1di4a):     40(ptr) Variable UniformConstant
+              44:             TypeSampledImage 39
+              52:             TypeInt 32 0
+              53:             TypeImage 52(int) 1D depth array sampled format:Unknown
+              54:             TypePointer UniformConstant 53
+ 55(g_tTex1du4a):     54(ptr) Variable UniformConstant
+              58:             TypeSampledImage 53
+              66:             TypeImage 6(float) 2D depth array sampled format:Unknown
+              67:             TypePointer UniformConstant 66
+ 68(g_tTex2df4a):     67(ptr) Variable UniformConstant
+              71:             TypeSampledImage 66
+              73:    6(float) Constant 1050253722
+              74:   29(fvec3) ConstantComposite 25 26 73
+              79:             TypeVector 34(int) 2
+              80:     34(int) Constant 3
+              81:   79(ivec2) ConstantComposite 35 80
+              85:             TypeImage 34(int) 2D depth array sampled format:Unknown
+              86:             TypePointer UniformConstant 85
+ 87(g_tTex2di4a):     86(ptr) Variable UniformConstant
+              90:             TypeSampledImage 85
+              99:             TypeImage 52(int) 2D depth array sampled format:Unknown
+             100:             TypePointer UniformConstant 99
+101(g_tTex2du4a):    100(ptr) Variable UniformConstant
+             104:             TypeSampledImage 99
+             112:             TypePointer Function 8(PS_OUTPUT)
+             114:     34(int) Constant 0
+             115:    6(float) Constant 1065353216
+             116:    7(fvec4) ConstantComposite 115 115 115 115
+             117:             TypePointer Function 7(fvec4)
+             119:     34(int) Constant 1
+             126:             TypePointer Output 7(fvec4)
+127(@entryPointOutput.Color):    126(ptr) Variable Output
+             130:             TypePointer Output 6(float)
+131(@entryPointOutput.Depth):    130(ptr) Variable Output
+             134:             TypeImage 6(float) 1D sampled format:Unknown
+             135:             TypePointer UniformConstant 134
+ 136(g_tTex1df4):    135(ptr) Variable UniformConstant
+             137:             TypeImage 34(int) 1D sampled format:Unknown
+             138:             TypePointer UniformConstant 137
+ 139(g_tTex1di4):    138(ptr) Variable UniformConstant
+             140:             TypeImage 52(int) 1D sampled format:Unknown
              141:             TypePointer UniformConstant 140
- 142(g_tTex1df4):    141(ptr) Variable UniformConstant
-             143:             TypeImage 35(int) 1D sampled format:Unknown
+ 142(g_tTex1du4):    141(ptr) Variable UniformConstant
+             143:             TypeImage 6(float) 2D sampled format:Unknown
              144:             TypePointer UniformConstant 143
- 145(g_tTex1di4):    144(ptr) Variable UniformConstant
-             146:             TypeImage 54(int) 1D sampled format:Unknown
+ 145(g_tTex2df4):    144(ptr) Variable UniformConstant
+             146:             TypeImage 34(int) 2D sampled format:Unknown
              147:             TypePointer UniformConstant 146
- 148(g_tTex1du4):    147(ptr) Variable UniformConstant
-             149:             TypeImage 6(float) 2D sampled format:Unknown
+ 148(g_tTex2di4):    147(ptr) Variable UniformConstant
+             149:             TypeImage 52(int) 2D sampled format:Unknown
              150:             TypePointer UniformConstant 149
- 151(g_tTex2df4):    150(ptr) Variable UniformConstant
-             152:             TypeImage 35(int) 2D sampled format:Unknown
+ 151(g_tTex2du4):    150(ptr) Variable UniformConstant
+             152:             TypeImage 6(float) 3D sampled format:Unknown
              153:             TypePointer UniformConstant 152
- 154(g_tTex2di4):    153(ptr) Variable UniformConstant
-             155:             TypeImage 54(int) 2D sampled format:Unknown
+ 154(g_tTex3df4):    153(ptr) Variable UniformConstant
+             155:             TypeImage 34(int) 3D sampled format:Unknown
              156:             TypePointer UniformConstant 155
- 157(g_tTex2du4):    156(ptr) Variable UniformConstant
-             158:             TypeImage 6(float) 3D sampled format:Unknown
+ 157(g_tTex3di4):    156(ptr) Variable UniformConstant
+             158:             TypeImage 52(int) 3D sampled format:Unknown
              159:             TypePointer UniformConstant 158
- 160(g_tTex3df4):    159(ptr) Variable UniformConstant
-             161:             TypeImage 35(int) 3D sampled format:Unknown
+ 160(g_tTex3du4):    159(ptr) Variable UniformConstant
+             161:             TypeImage 6(float) Cube sampled format:Unknown
              162:             TypePointer UniformConstant 161
- 163(g_tTex3di4):    162(ptr) Variable UniformConstant
-             164:             TypeImage 54(int) 3D sampled format:Unknown
+ 163(g_tTexcdf4):    162(ptr) Variable UniformConstant
+             164:             TypeImage 34(int) Cube sampled format:Unknown
              165:             TypePointer UniformConstant 164
- 166(g_tTex3du4):    165(ptr) Variable UniformConstant
-             167:             TypeImage 6(float) Cube sampled format:Unknown
+ 166(g_tTexcdi4):    165(ptr) Variable UniformConstant
+             167:             TypeImage 52(int) Cube sampled format:Unknown
              168:             TypePointer UniformConstant 167
- 169(g_tTexcdf4):    168(ptr) Variable UniformConstant
-             170:             TypeImage 35(int) Cube sampled format:Unknown
+ 169(g_tTexcdu4):    168(ptr) Variable UniformConstant
+             170:             TypeImage 6(float) Cube array sampled format:Unknown
              171:             TypePointer UniformConstant 170
- 172(g_tTexcdi4):    171(ptr) Variable UniformConstant
-             173:             TypeImage 54(int) Cube sampled format:Unknown
+172(g_tTexcdf4a):    171(ptr) Variable UniformConstant
+             173:             TypeImage 34(int) Cube array sampled format:Unknown
              174:             TypePointer UniformConstant 173
- 175(g_tTexcdu4):    174(ptr) Variable UniformConstant
-             176:             TypeImage 6(float) Cube array sampled format:Unknown
+175(g_tTexcdi4a):    174(ptr) Variable UniformConstant
+             176:             TypeImage 52(int) Cube array sampled format:Unknown
              177:             TypePointer UniformConstant 176
-178(g_tTexcdf4a):    177(ptr) Variable UniformConstant
-             179:             TypeImage 35(int) Cube array sampled format:Unknown
-             180:             TypePointer UniformConstant 179
-181(g_tTexcdi4a):    180(ptr) Variable UniformConstant
-             182:             TypeImage 54(int) Cube array sampled format:Unknown
-             183:             TypePointer UniformConstant 182
-184(g_tTexcdu4a):    183(ptr) Variable UniformConstant
+178(g_tTexcdu4a):    177(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
-130(flattenTemp):    118(ptr) Variable Function
-             131:8(PS_OUTPUT) FunctionCall 10(@main()
-                              Store 130(flattenTemp) 131
-             134:    123(ptr) AccessChain 130(flattenTemp) 120
-             135:    7(fvec4) Load 134
-                              Store 133(@entryPointOutput.Color) 135
-             138:     12(ptr) AccessChain 130(flattenTemp) 125
-             139:    6(float) Load 138
-                              Store 137(@entryPointOutput.Depth) 139
+124(flattenTemp):    112(ptr) Variable Function
+             125:8(PS_OUTPUT) FunctionCall 10(@main()
+                              Store 124(flattenTemp) 125
+             128:    117(ptr) AccessChain 124(flattenTemp) 114
+             129:    7(fvec4) Load 128
+                              Store 127(@entryPointOutput.Color) 129
+             132:     12(ptr) AccessChain 124(flattenTemp) 119
+             133:    6(float) Load 132
+                              Store 131(@entryPointOutput.Depth) 133
                               Return
                               FunctionEnd
       10(@main():8(PS_OUTPUT) Function None 9
               11:             Label
          13(r11):     12(ptr) Variable Function
-         39(r13):     12(ptr) Variable Function
-         53(r15):     12(ptr) Variable Function
-         68(r31):     12(ptr) Variable Function
-         88(r33):     12(ptr) Variable Function
-        103(r35):     12(ptr) Variable Function
-      119(psout):    118(ptr) Variable Function
+         38(r13):     12(ptr) Variable Function
+         51(r15):     12(ptr) Variable Function
+         65(r31):     12(ptr) Variable Function
+         84(r33):     12(ptr) Variable Function
+         98(r35):     12(ptr) Variable Function
+      113(psout):    112(ptr) Variable Function
               17:          14 Load 16(g_tTex1df4a)
               21:          18 Load 20(g_sSamp)
-              24:          23 SampledImage 17 21
-              31:    6(float) CompositeExtract 28 0
-              32:    6(float) CompositeExtract 28 1
-              33:   30(fvec3) CompositeConstruct 31 32 29
-              37:    6(float) CompositeExtract 33 2
-              38:    6(float) ImageSampleDrefExplicitLod 24 33 37 Lod ConstOffset 34 36
-                              Store 13(r11) 38
-              43:          40 Load 42(g_tTex1di4a)
-              44:          18 Load 20(g_sSamp)
-              47:          46 SampledImage 43 44
-              48:    6(float) CompositeExtract 28 0
-              49:    6(float) CompositeExtract 28 1
-              50:   30(fvec3) CompositeConstruct 48 49 29
-              51:    6(float) CompositeExtract 50 2
-              52:    6(float) ImageSampleDrefExplicitLod 47 50 51 Lod ConstOffset 34 36
-                              Store 39(r13) 52
-              58:          55 Load 57(g_tTex1du4a)
-              59:          18 Load 20(g_sSamp)
-              62:          61 SampledImage 58 59
-              63:    6(float) CompositeExtract 28 0
-              64:    6(float) CompositeExtract 28 1
-              65:   30(fvec3) CompositeConstruct 63 64 29
-              66:    6(float) CompositeExtract 65 2
-              67:    6(float) ImageSampleDrefExplicitLod 62 65 66 Lod ConstOffset 34 36
-                              Store 53(r15) 67
-              72:          69 Load 71(g_tTex2df4a)
-              73:          18 Load 20(g_sSamp)
-              76:          75 SampledImage 72 73
-              79:    6(float) CompositeExtract 78 0
-              80:    6(float) CompositeExtract 78 1
-              81:    6(float) CompositeExtract 78 2
-              82:    7(fvec4) CompositeConstruct 79 80 81 29
-              86:    6(float) CompositeExtract 82 3
-              87:    6(float) ImageSampleDrefExplicitLod 76 82 86 Lod ConstOffset 34 85
-                              Store 68(r31) 87
-              92:          89 Load 91(g_tTex2di4a)
-              93:          18 Load 20(g_sSamp)
-              96:          95 SampledImage 92 93
-              97:    6(float) CompositeExtract 78 0
-              98:    6(float) CompositeExtract 78 1
-              99:    6(float) CompositeExtract 78 2
-             100:    7(fvec4) CompositeConstruct 97 98 99 29
-             101:    6(float) CompositeExtract 100 3
-             102:    6(float) ImageSampleDrefExplicitLod 96 100 101 Lod ConstOffset 34 85
-                              Store 88(r33) 102
-             107:         104 Load 106(g_tTex2du4a)
-             108:          18 Load 20(g_sSamp)
-             111:         110 SampledImage 107 108
-             112:    6(float) CompositeExtract 78 0
-             113:    6(float) CompositeExtract 78 1
-             114:    6(float) CompositeExtract 78 2
-             115:    7(fvec4) CompositeConstruct 112 113 114 29
-             116:    6(float) CompositeExtract 115 3
-             117:    6(float) ImageSampleDrefExplicitLod 111 115 116 Lod ConstOffset 34 85
-                              Store 103(r35) 117
-             124:    123(ptr) AccessChain 119(psout) 120
-                              Store 124 122
-             126:     12(ptr) AccessChain 119(psout) 125
-                              Store 126 121
-             127:8(PS_OUTPUT) Load 119(psout)
-                              ReturnValue 127
+              23:          22 SampledImage 17 21
+              30:    6(float) CompositeExtract 27 0
+              31:    6(float) CompositeExtract 27 1
+              32:   29(fvec3) CompositeConstruct 30 31 28
+              36:    6(float) CompositeExtract 32 2
+              37:    6(float) ImageSampleDrefExplicitLod 23 32 36 Lod ConstOffset 33 35
+                              Store 13(r11) 37
+              42:          39 Load 41(g_tTex1di4a)
+              43:          18 Load 20(g_sSamp)
+              45:          44 SampledImage 42 43
+              46:    6(float) CompositeExtract 27 0
+              47:    6(float) CompositeExtract 27 1
+              48:   29(fvec3) CompositeConstruct 46 47 28
+              49:    6(float) CompositeExtract 48 2
+              50:    6(float) ImageSampleDrefExplicitLod 45 48 49 Lod ConstOffset 33 35
+                              Store 38(r13) 50
+              56:          53 Load 55(g_tTex1du4a)
+              57:          18 Load 20(g_sSamp)
+              59:          58 SampledImage 56 57
+              60:    6(float) CompositeExtract 27 0
+              61:    6(float) CompositeExtract 27 1
+              62:   29(fvec3) CompositeConstruct 60 61 28
+              63:    6(float) CompositeExtract 62 2
+              64:    6(float) ImageSampleDrefExplicitLod 59 62 63 Lod ConstOffset 33 35
+                              Store 51(r15) 64
+              69:          66 Load 68(g_tTex2df4a)
+              70:          18 Load 20(g_sSamp)
+              72:          71 SampledImage 69 70
+              75:    6(float) CompositeExtract 74 0
+              76:    6(float) CompositeExtract 74 1
+              77:    6(float) CompositeExtract 74 2
+              78:    7(fvec4) CompositeConstruct 75 76 77 28
+              82:    6(float) CompositeExtract 78 3
+              83:    6(float) ImageSampleDrefExplicitLod 72 78 82 Lod ConstOffset 33 81
+                              Store 65(r31) 83
+              88:          85 Load 87(g_tTex2di4a)
+              89:          18 Load 20(g_sSamp)
+              91:          90 SampledImage 88 89
+              92:    6(float) CompositeExtract 74 0
+              93:    6(float) CompositeExtract 74 1
+              94:    6(float) CompositeExtract 74 2
+              95:    7(fvec4) CompositeConstruct 92 93 94 28
+              96:    6(float) CompositeExtract 95 3
+              97:    6(float) ImageSampleDrefExplicitLod 91 95 96 Lod ConstOffset 33 81
+                              Store 84(r33) 97
+             102:          99 Load 101(g_tTex2du4a)
+             103:          18 Load 20(g_sSamp)
+             105:         104 SampledImage 102 103
+             106:    6(float) CompositeExtract 74 0
+             107:    6(float) CompositeExtract 74 1
+             108:    6(float) CompositeExtract 74 2
+             109:    7(fvec4) CompositeConstruct 106 107 108 28
+             110:    6(float) CompositeExtract 109 3
+             111:    6(float) ImageSampleDrefExplicitLod 105 109 110 Lod ConstOffset 33 81
+                              Store 98(r35) 111
+             118:    117(ptr) AccessChain 113(psout) 114
+                              Store 118 116
+             120:     12(ptr) AccessChain 113(psout) 119
+                              Store 120 115
+             121:8(PS_OUTPUT) Load 113(psout)
+                              ReturnValue 121
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.structbuffer.append.fn.frag.out b/Test/baseResults/hlsl.structbuffer.append.fn.frag.out
index 06a4f77..1f79b9b 100644
--- a/Test/baseResults/hlsl.structbuffer.append.fn.frag.out
+++ b/Test/baseResults/hlsl.structbuffer.append.fn.frag.out
@@ -151,12 +151,12 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 70
+// Id's are bound by 76
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 58 61
+                              EntryPoint Fragment 4  "main" 64 67
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -171,51 +171,55 @@
                               Name 18  "arg_c@count"
                               Name 25  "@main(u1;"
                               Name 24  "pos"
-                              Name 49  "sbuf_a"
-                              Name 50  "sbuf_a@count"
-                              Name 51  "sbuf_c"
-                              Name 52  "sbuf_c@count"
-                              Name 56  "pos"
-                              Name 58  "pos"
-                              Name 61  "@entryPointOutput"
-                              Name 62  "param"
-                              Name 65  "sbuf_a@count"
-                              MemberName 65(sbuf_a@count) 0  "@count"
-                              Name 67  "sbuf_a@count"
-                              Name 68  "sbuf_c@count"
-                              Name 69  "sbuf_unused"
+                              Name 50  "sbuf_a"
+                              Name 52  "sbuf_a@count"
+                              Name 53  "sbuf_c"
+                              Name 54  "sbuf_c@count"
+                              Name 55  "param"
+                              Name 56  "param"
+                              Name 57  "param"
+                              Name 58  "param"
+                              Name 62  "pos"
+                              Name 64  "pos"
+                              Name 67  "@entryPointOutput"
+                              Name 68  "param"
+                              Name 71  "sbuf_a@count"
+                              MemberName 71(sbuf_a@count) 0  "@count"
+                              Name 73  "sbuf_a@count"
+                              Name 74  "sbuf_c@count"
+                              Name 75  "sbuf_unused"
                               Decorate 8 ArrayStride 16
                               MemberDecorate 9 0 Offset 0
                               Decorate 9 BufferBlock
                               Decorate 12 BufferBlock
-                              Decorate 49(sbuf_a) DescriptorSet 0
-                              Decorate 50(sbuf_a@count) DescriptorSet 0
-                              Decorate 51(sbuf_c) DescriptorSet 0
-                              Decorate 52(sbuf_c@count) DescriptorSet 0
-                              Decorate 58(pos) Flat
-                              Decorate 58(pos) Location 0
-                              Decorate 61(@entryPointOutput) Location 0
-                              MemberDecorate 65(sbuf_a@count) 0 Offset 0
-                              Decorate 65(sbuf_a@count) BufferBlock
-                              Decorate 67(sbuf_a@count) DescriptorSet 0
-                              Decorate 68(sbuf_c@count) DescriptorSet 0
-                              Decorate 69(sbuf_unused) DescriptorSet 0
+                              Decorate 50(sbuf_a) DescriptorSet 0
+                              Decorate 52(sbuf_a@count) DescriptorSet 0
+                              Decorate 53(sbuf_c) DescriptorSet 0
+                              Decorate 54(sbuf_c@count) DescriptorSet 0
+                              Decorate 64(pos) Flat
+                              Decorate 64(pos) Location 0
+                              Decorate 67(@entryPointOutput) Location 0
+                              MemberDecorate 71(sbuf_a@count) 0 Offset 0
+                              Decorate 71(sbuf_a@count) BufferBlock
+                              Decorate 73(sbuf_a@count) DescriptorSet 0
+                              Decorate 74(sbuf_c@count) DescriptorSet 0
+                              Decorate 75(sbuf_unused) DescriptorSet 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
                7:             TypeVector 6(float) 4
                8:             TypeRuntimeArray 7(fvec4)
                9:             TypeStruct 8
-              10:             TypePointer Uniform 9(struct)
+              10:             TypePointer Function 9(struct)
               11:             TypeInt 32 1
               12:             TypeStruct 11(int)
-              13:             TypePointer Uniform 12(struct)
+              13:             TypePointer Function 12(struct)
               14:             TypeFunction 7(fvec4) 10(ptr) 13(ptr) 10(ptr) 13(ptr)
               21:             TypeInt 32 0
               22:             TypePointer Function 21(int)
               23:             TypeFunction 7(fvec4) 22(ptr)
               27:     11(int) Constant 0
-              28:             TypePointer Uniform 11(int)
+              28:             TypePointer Function 11(int)
               30:     11(int) Constant 1
               31:     21(int) Constant 1
               32:     21(int) Constant 0
@@ -224,31 +228,33 @@
               36:    6(float) Constant 1077936128
               37:    6(float) Constant 1082130432
               38:    7(fvec4) ConstantComposite 34 35 36 37
-              39:             TypePointer Uniform 7(fvec4)
+              39:             TypePointer Function 7(fvec4)
               42:     11(int) Constant 4294967295
-      49(sbuf_a):     10(ptr) Variable Uniform
-50(sbuf_a@count):     13(ptr) Variable Uniform
-      51(sbuf_c):     10(ptr) Variable Uniform
-52(sbuf_c@count):     13(ptr) Variable Uniform
-              57:             TypePointer Input 21(int)
-         58(pos):     57(ptr) Variable Input
-              60:             TypePointer Output 7(fvec4)
-61(@entryPointOutput):     60(ptr) Variable Output
-65(sbuf_a@count):             TypeStruct 11(int)
-              66:             TypePointer Uniform 65(sbuf_a@count)
-67(sbuf_a@count):     66(ptr) Variable Uniform
-68(sbuf_c@count):     66(ptr) Variable Uniform
- 69(sbuf_unused):     10(ptr) Variable Uniform
+              49:             TypePointer Uniform 9(struct)
+      50(sbuf_a):     49(ptr) Variable Uniform
+              51:             TypePointer Uniform 12(struct)
+52(sbuf_a@count):     51(ptr) Variable Uniform
+      53(sbuf_c):     49(ptr) Variable Uniform
+54(sbuf_c@count):     51(ptr) Variable Uniform
+              63:             TypePointer Input 21(int)
+         64(pos):     63(ptr) Variable Input
+              66:             TypePointer Output 7(fvec4)
+67(@entryPointOutput):     66(ptr) Variable Output
+71(sbuf_a@count):             TypeStruct 11(int)
+              72:             TypePointer Uniform 71(sbuf_a@count)
+73(sbuf_a@count):     72(ptr) Variable Uniform
+74(sbuf_c@count):     72(ptr) Variable Uniform
+ 75(sbuf_unused):     49(ptr) Variable Uniform
          4(main):           2 Function None 3
                5:             Label
-         56(pos):     22(ptr) Variable Function
-       62(param):     22(ptr) Variable Function
-              59:     21(int) Load 58(pos)
-                              Store 56(pos) 59
-              63:     21(int) Load 56(pos)
-                              Store 62(param) 63
-              64:    7(fvec4) FunctionCall 25(@main(u1;) 62(param)
-                              Store 61(@entryPointOutput) 64
+         62(pos):     22(ptr) Variable Function
+       68(param):     22(ptr) Variable Function
+              65:     21(int) Load 64(pos)
+                              Store 62(pos) 65
+              69:     21(int) Load 62(pos)
+                              Store 68(param) 69
+              70:    7(fvec4) FunctionCall 25(@main(u1;) 68(param)
+                              Store 67(@entryPointOutput) 70
                               Return
                               FunctionEnd
 19(Fn2(block--vf4[0]1;block--vf4[0]1;):    7(fvec4) Function None 14
@@ -271,6 +277,10 @@
    25(@main(u1;):    7(fvec4) Function None 23
          24(pos):     22(ptr) FunctionParameter
               26:             Label
-              53:    7(fvec4) FunctionCall 19(Fn2(block--vf4[0]1;block--vf4[0]1;) 49(sbuf_a) 50(sbuf_a@count) 51(sbuf_c) 52(sbuf_c@count)
-                              ReturnValue 53
+       55(param):     10(ptr) Variable Function
+       56(param):     13(ptr) Variable Function
+       57(param):     10(ptr) Variable Function
+       58(param):     13(ptr) Variable Function
+              59:    7(fvec4) FunctionCall 19(Fn2(block--vf4[0]1;block--vf4[0]1;) 55(param) 56(param) 57(param) 58(param)
+                              ReturnValue 59
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.structbuffer.fn.frag.out b/Test/baseResults/hlsl.structbuffer.fn.frag.out
index 6ec1381..e5e68f1 100644
--- a/Test/baseResults/hlsl.structbuffer.fn.frag.out
+++ b/Test/baseResults/hlsl.structbuffer.fn.frag.out
@@ -139,12 +139,12 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 78
+// Id's are bound by 83
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 63 66
+                              EntryPoint Fragment 4  "main" 68 71
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -165,21 +165,24 @@
                               Name 35  "@main(u1;"
                               Name 34  "pos"
                               Name 47  "sbuf2"
-                              Name 48  "sbuf2@count"
-                              Name 50  "sbuf"
-                              Name 52  "param"
+                              Name 49  "sbuf2@count"
+                              Name 52  "sbuf"
                               Name 54  "param"
                               Name 55  "param"
-                              Name 61  "pos"
-                              Name 63  "pos"
-                              Name 66  "@entryPointOutput"
-                              Name 67  "param"
-                              Name 70  "sbuf2@count"
-                              MemberName 70(sbuf2@count) 0  "@count"
-                              Name 72  "sbuf2@count"
-                              Name 75  "sbuf3"
-                              MemberName 75(sbuf3) 0  "@data"
-                              Name 77  "sbuf3"
+                              Name 57  "param"
+                              Name 58  "param"
+                              Name 59  "param"
+                              Name 60  "param"
+                              Name 66  "pos"
+                              Name 68  "pos"
+                              Name 71  "@entryPointOutput"
+                              Name 72  "param"
+                              Name 75  "sbuf2@count"
+                              MemberName 75(sbuf2@count) 0  "@count"
+                              Name 77  "sbuf2@count"
+                              Name 80  "sbuf3"
+                              MemberName 80(sbuf3) 0  "@data"
+                              Name 82  "sbuf3"
                               Decorate 8 ArrayStride 16
                               MemberDecorate 9 0 NonWritable
                               MemberDecorate 9 0 Offset 0
@@ -190,72 +193,74 @@
                               Decorate 18 BufferBlock
                               Decorate 21 BufferBlock
                               Decorate 47(sbuf2) DescriptorSet 0
-                              Decorate 48(sbuf2@count) DescriptorSet 0
-                              Decorate 50(sbuf) DescriptorSet 0
-                              Decorate 50(sbuf) Binding 10
-                              Decorate 63(pos) Flat
-                              Decorate 63(pos) Location 0
-                              Decorate 66(@entryPointOutput) Location 0
-                              MemberDecorate 70(sbuf2@count) 0 Offset 0
-                              Decorate 70(sbuf2@count) BufferBlock
-                              Decorate 72(sbuf2@count) DescriptorSet 0
-                              Decorate 74 ArrayStride 16
-                              MemberDecorate 75(sbuf3) 0 NonWritable
-                              MemberDecorate 75(sbuf3) 0 Offset 0
-                              Decorate 75(sbuf3) BufferBlock
-                              Decorate 77(sbuf3) DescriptorSet 0
-                              Decorate 77(sbuf3) Binding 12
+                              Decorate 49(sbuf2@count) DescriptorSet 0
+                              Decorate 52(sbuf) DescriptorSet 0
+                              Decorate 52(sbuf) Binding 10
+                              Decorate 68(pos) Flat
+                              Decorate 68(pos) Location 0
+                              Decorate 71(@entryPointOutput) Location 0
+                              MemberDecorate 75(sbuf2@count) 0 Offset 0
+                              Decorate 75(sbuf2@count) BufferBlock
+                              Decorate 77(sbuf2@count) DescriptorSet 0
+                              Decorate 79 ArrayStride 16
+                              MemberDecorate 80(sbuf3) 0 NonWritable
+                              MemberDecorate 80(sbuf3) 0 Offset 0
+                              Decorate 80(sbuf3) BufferBlock
+                              Decorate 82(sbuf3) DescriptorSet 0
+                              Decorate 82(sbuf3) Binding 12
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 0
                7:             TypeVector 6(int) 4
                8:             TypeRuntimeArray 7(ivec4)
                9:             TypeStruct 8
-              10:             TypePointer Uniform 9(struct)
+              10:             TypePointer Function 9(struct)
               11:             TypePointer Function 6(int)
               12:             TypeFunction 7(ivec4) 10(ptr) 11(ptr)
               17:             TypeRuntimeArray 7(ivec4)
               18:             TypeStruct 17
-              19:             TypePointer Uniform 18(struct)
+              19:             TypePointer Function 18(struct)
               20:             TypeInt 32 1
               21:             TypeStruct 20(int)
-              22:             TypePointer Uniform 21(struct)
+              22:             TypePointer Function 21(struct)
               23:             TypePointer Function 7(ivec4)
               24:             TypeFunction 2 19(ptr) 22(ptr) 11(ptr) 23(ptr)
               31:             TypeFloat 32
               32:             TypeVector 31(float) 4
               33:             TypeFunction 32(fvec4) 11(ptr)
               37:     20(int) Constant 0
-              39:             TypePointer Uniform 7(ivec4)
-       47(sbuf2):     19(ptr) Variable Uniform
- 48(sbuf2@count):     22(ptr) Variable Uniform
-              49:      6(int) Constant 2
-        50(sbuf):     10(ptr) Variable Uniform
-              51:      6(int) Constant 3
-              57:   31(float) Constant 0
-              58:   32(fvec4) ConstantComposite 57 57 57 57
-              62:             TypePointer Input 6(int)
-         63(pos):     62(ptr) Variable Input
-              65:             TypePointer Output 32(fvec4)
-66(@entryPointOutput):     65(ptr) Variable Output
- 70(sbuf2@count):             TypeStruct 20(int)
-              71:             TypePointer Uniform 70(sbuf2@count)
- 72(sbuf2@count):     71(ptr) Variable Uniform
-              73:             TypeVector 6(int) 3
-              74:             TypeRuntimeArray 73(ivec3)
-       75(sbuf3):             TypeStruct 74
-              76:             TypePointer Uniform 75(sbuf3)
-       77(sbuf3):     76(ptr) Variable Uniform
+              46:             TypePointer Uniform 18(struct)
+       47(sbuf2):     46(ptr) Variable Uniform
+              48:             TypePointer Uniform 21(struct)
+ 49(sbuf2@count):     48(ptr) Variable Uniform
+              50:      6(int) Constant 2
+              51:             TypePointer Uniform 9(struct)
+        52(sbuf):     51(ptr) Variable Uniform
+              53:      6(int) Constant 3
+              62:   31(float) Constant 0
+              63:   32(fvec4) ConstantComposite 62 62 62 62
+              67:             TypePointer Input 6(int)
+         68(pos):     67(ptr) Variable Input
+              70:             TypePointer Output 32(fvec4)
+71(@entryPointOutput):     70(ptr) Variable Output
+ 75(sbuf2@count):             TypeStruct 20(int)
+              76:             TypePointer Uniform 75(sbuf2@count)
+ 77(sbuf2@count):     76(ptr) Variable Uniform
+              78:             TypeVector 6(int) 3
+              79:             TypeRuntimeArray 78(ivec3)
+       80(sbuf3):             TypeStruct 79
+              81:             TypePointer Uniform 80(sbuf3)
+       82(sbuf3):     81(ptr) Variable Uniform
          4(main):           2 Function None 3
                5:             Label
-         61(pos):     11(ptr) Variable Function
-       67(param):     11(ptr) Variable Function
-              64:      6(int) Load 63(pos)
-                              Store 61(pos) 64
-              68:      6(int) Load 61(pos)
-                              Store 67(param) 68
-              69:   32(fvec4) FunctionCall 35(@main(u1;) 67(param)
-                              Store 66(@entryPointOutput) 69
+         66(pos):     11(ptr) Variable Function
+       72(param):     11(ptr) Variable Function
+              69:      6(int) Load 68(pos)
+                              Store 66(pos) 69
+              73:      6(int) Load 66(pos)
+                              Store 72(param) 73
+              74:   32(fvec4) FunctionCall 35(@main(u1;) 72(param)
+                              Store 71(@entryPointOutput) 74
                               Return
                               FunctionEnd
 15(get(block--vu4[0]1;u1;):    7(ivec4) Function None 12
@@ -263,9 +268,9 @@
 14(bufferOffset):     11(ptr) FunctionParameter
               16:             Label
               38:      6(int) Load 14(bufferOffset)
-              40:     39(ptr) AccessChain 13(sb) 37 38
-              41:    7(ivec4) Load 40
-                              ReturnValue 41
+              39:     23(ptr) AccessChain 13(sb) 37 38
+              40:    7(ivec4) Load 39
+                              ReturnValue 40
                               FunctionEnd
 29(set(block--vu4[0]1;u1;vu4;):           2 Function None 24
           25(sb):     19(ptr) FunctionParameter
@@ -273,22 +278,25 @@
 27(bufferOffset):     11(ptr) FunctionParameter
         28(data):     23(ptr) FunctionParameter
               30:             Label
-              44:      6(int) Load 27(bufferOffset)
-              45:    7(ivec4) Load 28(data)
-              46:     39(ptr) AccessChain 25(sb) 37 44
-                              Store 46 45
+              43:      6(int) Load 27(bufferOffset)
+              44:    7(ivec4) Load 28(data)
+              45:     23(ptr) AccessChain 25(sb) 37 43
+                              Store 45 44
                               Return
                               FunctionEnd
    35(@main(u1;):   32(fvec4) Function None 33
          34(pos):     11(ptr) FunctionParameter
               36:             Label
-       52(param):     11(ptr) Variable Function
-       54(param):     11(ptr) Variable Function
-       55(param):     23(ptr) Variable Function
-                              Store 52(param) 51
-              53:    7(ivec4) FunctionCall 15(get(block--vu4[0]1;u1;) 50(sbuf) 52(param)
-                              Store 54(param) 49
+       54(param):     10(ptr) Variable Function
+       55(param):     11(ptr) Variable Function
+       57(param):     19(ptr) Variable Function
+       58(param):     22(ptr) Variable Function
+       59(param):     11(ptr) Variable Function
+       60(param):     23(ptr) Variable Function
                               Store 55(param) 53
-              56:           2 FunctionCall 29(set(block--vu4[0]1;u1;vu4;) 47(sbuf2) 48(sbuf2@count) 54(param) 55(param)
-                              ReturnValue 58
+              56:    7(ivec4) FunctionCall 15(get(block--vu4[0]1;u1;) 54(param) 55(param)
+                              Store 59(param) 50
+                              Store 60(param) 56
+              61:           2 FunctionCall 29(set(block--vu4[0]1;u1;vu4;) 57(param) 58(param) 59(param) 60(param)
+                              ReturnValue 63
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.structbuffer.fn2.comp.out b/Test/baseResults/hlsl.structbuffer.fn2.comp.out
index 2f335f0..bb84b99 100644
--- a/Test/baseResults/hlsl.structbuffer.fn2.comp.out
+++ b/Test/baseResults/hlsl.structbuffer.fn2.comp.out
@@ -135,14 +135,14 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 61
+// Id's are bound by 62
 
                               Capability Shader
                               Capability ImageBuffer
                               Capability StorageImageExtendedFormats
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint GLCompute 4  "main" 56
+                              EntryPoint GLCompute 4  "main" 57
                               ExecutionMode 4 LocalSize 256 1 1
                               Source HLSL 500
                               Name 4  "main"
@@ -155,13 +155,14 @@
                               Name 18  "dispatchId"
                               Name 22  "result"
                               Name 25  "byteAddrTemp"
-                              Name 43  "result"
+                              Name 42  "result"
                               Name 44  "g_input"
                               Name 45  "param"
-                              Name 50  "g_output"
-                              Name 54  "dispatchId"
-                              Name 56  "dispatchId"
-                              Name 58  "param"
+                              Name 47  "param"
+                              Name 51  "g_output"
+                              Name 55  "dispatchId"
+                              Name 57  "dispatchId"
+                              Name 59  "param"
                               Decorate 8 ArrayStride 4
                               MemberDecorate 9 0 NonWritable
                               MemberDecorate 9 0 Offset 0
@@ -169,16 +170,16 @@
                               Decorate 14(buffer) NonWritable
                               Decorate 44(g_input) DescriptorSet 0
                               Decorate 44(g_input) Binding 0
-                              Decorate 50(g_output) DescriptorSet 0
-                              Decorate 50(g_output) Binding 1
-                              Decorate 56(dispatchId) BuiltIn GlobalInvocationId
+                              Decorate 51(g_output) DescriptorSet 0
+                              Decorate 51(g_output) Binding 1
+                              Decorate 57(dispatchId) BuiltIn GlobalInvocationId
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 0
                7:             TypePointer Function 6(int)
                8:             TypeRuntimeArray 6(int)
                9:             TypeStruct 8
-              10:             TypePointer Uniform 9(struct)
+              10:             TypePointer Function 9(struct)
               11:             TypeVector 6(int) 2
               12:             TypeFunction 11(ivec2) 7(ptr) 10(ptr)
               17:             TypeFunction 2 7(ptr)
@@ -187,23 +188,23 @@
               24:             TypePointer Function 23(int)
               27:     23(int) Constant 2
               29:     23(int) Constant 0
-              31:             TypePointer Uniform 6(int)
-              35:     23(int) Constant 1
-     44(g_input):     10(ptr) Variable Uniform
-              48:             TypeImage 6(int) Buffer nonsampled format:Rg32ui
-              49:             TypePointer UniformConstant 48
-    50(g_output):     49(ptr) Variable UniformConstant
-              55:             TypePointer Input 6(int)
-  56(dispatchId):     55(ptr) Variable Input
+              34:     23(int) Constant 1
+              43:             TypePointer Uniform 9(struct)
+     44(g_input):     43(ptr) Variable Uniform
+              49:             TypeImage 6(int) Buffer nonsampled format:Rg32ui
+              50:             TypePointer UniformConstant 49
+    51(g_output):     50(ptr) Variable UniformConstant
+              56:             TypePointer Input 6(int)
+  57(dispatchId):     56(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
-  54(dispatchId):      7(ptr) Variable Function
-       58(param):      7(ptr) Variable Function
-              57:      6(int) Load 56(dispatchId)
-                              Store 54(dispatchId) 57
-              59:      6(int) Load 54(dispatchId)
-                              Store 58(param) 59
-              60:           2 FunctionCall 19(@main(u1;) 58(param)
+  55(dispatchId):      7(ptr) Variable Function
+       59(param):      7(ptr) Variable Function
+              58:      6(int) Load 57(dispatchId)
+                              Store 55(dispatchId) 58
+              60:      6(int) Load 55(dispatchId)
+                              Store 59(param) 60
+              61:           2 FunctionCall 19(@main(u1;) 59(param)
                               Return
                               FunctionEnd
 15(testLoad(u1;block--u1[0]1;):   11(ivec2) Function None 12
@@ -216,29 +217,30 @@
               28:     23(int) ShiftRightLogical 26 27
                               Store 25(byteAddrTemp) 28
               30:     23(int) Load 25(byteAddrTemp)
-              32:     31(ptr) AccessChain 14(buffer) 29 30
-              33:      6(int) Load 32
-              34:     23(int) Load 25(byteAddrTemp)
-              36:     23(int) IAdd 34 35
-              37:     31(ptr) AccessChain 14(buffer) 29 36
-              38:      6(int) Load 37
-              39:   11(ivec2) CompositeConstruct 33 38
-                              Store 22(result) 39
-              40:   11(ivec2) Load 22(result)
-                              ReturnValue 40
+              31:      7(ptr) AccessChain 14(buffer) 29 30
+              32:      6(int) Load 31
+              33:     23(int) Load 25(byteAddrTemp)
+              35:     23(int) IAdd 33 34
+              36:      7(ptr) AccessChain 14(buffer) 29 35
+              37:      6(int) Load 36
+              38:   11(ivec2) CompositeConstruct 32 37
+                              Store 22(result) 38
+              39:   11(ivec2) Load 22(result)
+                              ReturnValue 39
                               FunctionEnd
    19(@main(u1;):           2 Function None 17
   18(dispatchId):      7(ptr) FunctionParameter
               20:             Label
-      43(result):     21(ptr) Variable Function
+      42(result):     21(ptr) Variable Function
        45(param):      7(ptr) Variable Function
+       47(param):     10(ptr) Variable Function
               46:      6(int) Load 18(dispatchId)
                               Store 45(param) 46
-              47:   11(ivec2) FunctionCall 15(testLoad(u1;block--u1[0]1;) 45(param) 44(g_input)
-                              Store 43(result) 47
-              51:          48 Load 50(g_output)
-              52:      6(int) Load 18(dispatchId)
-              53:   11(ivec2) Load 43(result)
-                              ImageWrite 51 52 53
+              48:   11(ivec2) FunctionCall 15(testLoad(u1;block--u1[0]1;) 45(param) 47(param)
+                              Store 42(result) 48
+              52:          49 Load 51(g_output)
+              53:      6(int) Load 18(dispatchId)
+              54:   11(ivec2) Load 42(result)
+                              ImageWrite 52 53 54
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.subpass.frag.out b/Test/baseResults/hlsl.subpass.frag.out
new file mode 100644
index 0000000..4eb6337
--- /dev/null
+++ b/Test/baseResults/hlsl.subpass.frag.out
@@ -0,0 +1,778 @@
+hlsl.subpass.frag
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:68  Function Definition: @main( ( temp 4-component vector of float)
+0:68    Function Parameters: 
+0:?     Sequence
+0:69      Sequence
+0:69        move second child to first child ( temp 4-component vector of float)
+0:69          'result00' ( temp 4-component vector of float)
+0:69          subpassLoad ( temp 4-component vector of float)
+0:69            'subpass_f4' (layout( binding=1 input_attachment_index=1) uniform subpassInput)
+0:70      Sequence
+0:70        move second child to first child ( temp 4-component vector of int)
+0:70          'result01' ( temp 4-component vector of int)
+0:70          subpassLoad ( temp 4-component vector of int)
+0:70            'subpass_i4' ( uniform isubpassInput)
+0:71      Sequence
+0:71        move second child to first child ( temp 4-component vector of uint)
+0:71          'result02' ( temp 4-component vector of uint)
+0:71          subpassLoad ( temp 4-component vector of uint)
+0:71            'subpass_u4' ( uniform usubpassInput)
+0:73      Sequence
+0:73        move second child to first child ( temp 4-component vector of float)
+0:73          'result10' ( temp 4-component vector of float)
+0:73          subpassLoadMS ( temp 4-component vector of float)
+0:73            'subpass_ms_f4' ( uniform subpassInputMS)
+0:73            Constant:
+0:73              3 (const int)
+0:74      Sequence
+0:74        move second child to first child ( temp 4-component vector of int)
+0:74          'result11' ( temp 4-component vector of int)
+0:74          subpassLoadMS ( temp 4-component vector of int)
+0:74            'subpass_ms_i4' ( uniform isubpassInputMS)
+0:74            Constant:
+0:74              3 (const int)
+0:75      Sequence
+0:75        move second child to first child ( temp 4-component vector of uint)
+0:75          'result12' ( temp 4-component vector of uint)
+0:75          subpassLoadMS ( temp 4-component vector of uint)
+0:75            'subpass_ms_u4' ( uniform usubpassInputMS)
+0:75            Constant:
+0:75              3 (const int)
+0:77      Sequence
+0:77        move second child to first child ( temp 3-component vector of float)
+0:77          'result20' ( temp 3-component vector of float)
+0:77          Construct vec3 ( temp 3-component vector of float)
+0:77            subpassLoad ( temp 4-component vector of float)
+0:77              'subpass_f3' ( uniform subpassInput)
+0:78      Sequence
+0:78        move second child to first child ( temp 3-component vector of int)
+0:78          'result21' ( temp 3-component vector of int)
+0:78          Construct ivec3 ( temp 3-component vector of int)
+0:78            subpassLoad ( temp 4-component vector of int)
+0:78              'subpass_i3' ( uniform isubpassInput)
+0:79      Sequence
+0:79        move second child to first child ( temp 3-component vector of uint)
+0:79          'result22' ( temp 3-component vector of uint)
+0:79          Construct uvec3 ( temp 3-component vector of uint)
+0:79            subpassLoad ( temp 4-component vector of uint)
+0:79              'subpass_u3' ( uniform usubpassInput)
+0:81      Sequence
+0:81        move second child to first child ( temp 3-component vector of float)
+0:81          'result30' ( temp 3-component vector of float)
+0:81          Construct vec3 ( temp 3-component vector of float)
+0:81            subpassLoadMS ( temp 4-component vector of float)
+0:81              'subpass_ms_f3' ( uniform subpassInputMS)
+0:81              Constant:
+0:81                3 (const int)
+0:82      Sequence
+0:82        move second child to first child ( temp 3-component vector of int)
+0:82          'result31' ( temp 3-component vector of int)
+0:82          Construct ivec3 ( temp 3-component vector of int)
+0:82            subpassLoadMS ( temp 4-component vector of int)
+0:82              'subpass_ms_i3' ( uniform isubpassInputMS)
+0:82              Constant:
+0:82                3 (const int)
+0:83      Sequence
+0:83        move second child to first child ( temp 3-component vector of uint)
+0:83          'result32' ( temp 3-component vector of uint)
+0:83          Construct uvec3 ( temp 3-component vector of uint)
+0:83            subpassLoadMS ( temp 4-component vector of uint)
+0:83              'subpass_ms_u3' ( uniform usubpassInputMS)
+0:83              Constant:
+0:83                3 (const int)
+0:85      Sequence
+0:85        move second child to first child ( temp 2-component vector of float)
+0:85          'result40' ( temp 2-component vector of float)
+0:85          Construct vec2 ( temp 2-component vector of float)
+0:85            subpassLoad ( temp 4-component vector of float)
+0:85              'subpass_f2' ( uniform subpassInput)
+0:86      Sequence
+0:86        move second child to first child ( temp 2-component vector of int)
+0:86          'result41' ( temp 2-component vector of int)
+0:86          Construct ivec2 ( temp 2-component vector of int)
+0:86            subpassLoad ( temp 4-component vector of int)
+0:86              'subpass_i2' ( uniform isubpassInput)
+0:87      Sequence
+0:87        move second child to first child ( temp 2-component vector of uint)
+0:87          'result42' ( temp 2-component vector of uint)
+0:87          Construct uvec2 ( temp 2-component vector of uint)
+0:87            subpassLoad ( temp 4-component vector of uint)
+0:87              'subpass_u2' ( uniform usubpassInput)
+0:89      Sequence
+0:89        move second child to first child ( temp 2-component vector of float)
+0:89          'result50' ( temp 2-component vector of float)
+0:89          Construct vec2 ( temp 2-component vector of float)
+0:89            subpassLoadMS ( temp 4-component vector of float)
+0:89              'subpass_ms_f2' ( uniform subpassInputMS)
+0:89              Constant:
+0:89                2 (const int)
+0:90      Sequence
+0:90        move second child to first child ( temp 2-component vector of int)
+0:90          'result51' ( temp 2-component vector of int)
+0:90          Construct ivec2 ( temp 2-component vector of int)
+0:90            subpassLoadMS ( temp 4-component vector of int)
+0:90              'subpass_ms_i2' ( uniform isubpassInputMS)
+0:90              Constant:
+0:90                2 (const int)
+0:91      Sequence
+0:91        move second child to first child ( temp 2-component vector of uint)
+0:91          'result52' ( temp 2-component vector of uint)
+0:91          Construct uvec2 ( temp 2-component vector of uint)
+0:91            subpassLoadMS ( temp 4-component vector of uint)
+0:91              'subpass_ms_u2' ( uniform usubpassInputMS)
+0:91              Constant:
+0:91                2 (const int)
+0:93      Sequence
+0:93        move second child to first child ( temp float)
+0:93          'result60' ( temp float)
+0:93          Construct float ( temp float)
+0:93            subpassLoad ( temp 4-component vector of float)
+0:93              'subpass_f' ( uniform subpassInput)
+0:94      Sequence
+0:94        move second child to first child ( temp int)
+0:94          'result61' ( temp int)
+0:94          Construct int ( temp int)
+0:94            subpassLoad ( temp 4-component vector of int)
+0:94              'subpass_i' ( uniform isubpassInput)
+0:95      Sequence
+0:95        move second child to first child ( temp uint)
+0:95          'result62' ( temp uint)
+0:95          Construct uint ( temp uint)
+0:95            subpassLoad ( temp 4-component vector of uint)
+0:95              'subpass_u' ( uniform usubpassInput)
+0:97      Sequence
+0:97        move second child to first child ( temp float)
+0:97          'result70' ( temp float)
+0:97          Construct float ( temp float)
+0:97            subpassLoadMS ( temp 4-component vector of float)
+0:97              'subpass_ms_f' ( uniform subpassInputMS)
+0:97              Constant:
+0:97                2 (const int)
+0:98      Sequence
+0:98        move second child to first child ( temp int)
+0:98          'result71' ( temp int)
+0:98          Construct int ( temp int)
+0:98            subpassLoadMS ( temp 4-component vector of int)
+0:98              'subpass_ms_i' ( uniform isubpassInputMS)
+0:98              Constant:
+0:98                2 (const int)
+0:99      Sequence
+0:99        move second child to first child ( temp uint)
+0:99          'result72' ( temp uint)
+0:99          Construct uint ( temp uint)
+0:99            subpassLoadMS ( temp 4-component vector of uint)
+0:99              'subpass_ms_u' ( uniform usubpassInputMS)
+0:99              Constant:
+0:99                2 (const int)
+0:101      Sequence
+0:101        move second child to first child ( temp 4-component vector of float)
+0:101          'result73' ( temp 4-component vector of float)
+0:101          subpassLoad ( temp 4-component vector of float)
+0:101            'subpass_2' ( uniform subpassInput)
+0:112      Branch: Return with expression
+0:112        Constant:
+0:112          0.000000
+0:112          0.000000
+0:112          0.000000
+0:112          0.000000
+0:68  Function Definition: main( ( temp void)
+0:68    Function Parameters: 
+0:?     Sequence
+0:68      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:68        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'subpass_f4' (layout( binding=1 input_attachment_index=1) uniform subpassInput)
+0:?     'subpass_i4' ( uniform isubpassInput)
+0:?     'subpass_u4' ( uniform usubpassInput)
+0:?     'subpass_ms_f4' ( uniform subpassInputMS)
+0:?     'subpass_ms_i4' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u4' ( uniform usubpassInputMS)
+0:?     'subpass_f3' ( uniform subpassInput)
+0:?     'subpass_i3' ( uniform isubpassInput)
+0:?     'subpass_u3' ( uniform usubpassInput)
+0:?     'subpass_ms_f3' ( uniform subpassInputMS)
+0:?     'subpass_ms_i3' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u3' ( uniform usubpassInputMS)
+0:?     'subpass_f2' ( uniform subpassInput)
+0:?     'subpass_i2' ( uniform isubpassInput)
+0:?     'subpass_u2' ( uniform usubpassInput)
+0:?     'subpass_ms_f2' ( uniform subpassInputMS)
+0:?     'subpass_ms_i2' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u2' ( uniform usubpassInputMS)
+0:?     'subpass_f' ( uniform subpassInput)
+0:?     'subpass_i' ( uniform isubpassInput)
+0:?     'subpass_u' ( uniform usubpassInput)
+0:?     'subpass_ms_f' ( uniform subpassInputMS)
+0:?     'subpass_ms_i' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u' ( uniform usubpassInputMS)
+0:?     'subpass_2' ( uniform subpassInput)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 500
+gl_FragCoord origin is upper left
+0:? Sequence
+0:68  Function Definition: @main( ( temp 4-component vector of float)
+0:68    Function Parameters: 
+0:?     Sequence
+0:69      Sequence
+0:69        move second child to first child ( temp 4-component vector of float)
+0:69          'result00' ( temp 4-component vector of float)
+0:69          subpassLoad ( temp 4-component vector of float)
+0:69            'subpass_f4' (layout( binding=1 input_attachment_index=1) uniform subpassInput)
+0:70      Sequence
+0:70        move second child to first child ( temp 4-component vector of int)
+0:70          'result01' ( temp 4-component vector of int)
+0:70          subpassLoad ( temp 4-component vector of int)
+0:70            'subpass_i4' ( uniform isubpassInput)
+0:71      Sequence
+0:71        move second child to first child ( temp 4-component vector of uint)
+0:71          'result02' ( temp 4-component vector of uint)
+0:71          subpassLoad ( temp 4-component vector of uint)
+0:71            'subpass_u4' ( uniform usubpassInput)
+0:73      Sequence
+0:73        move second child to first child ( temp 4-component vector of float)
+0:73          'result10' ( temp 4-component vector of float)
+0:73          subpassLoadMS ( temp 4-component vector of float)
+0:73            'subpass_ms_f4' ( uniform subpassInputMS)
+0:73            Constant:
+0:73              3 (const int)
+0:74      Sequence
+0:74        move second child to first child ( temp 4-component vector of int)
+0:74          'result11' ( temp 4-component vector of int)
+0:74          subpassLoadMS ( temp 4-component vector of int)
+0:74            'subpass_ms_i4' ( uniform isubpassInputMS)
+0:74            Constant:
+0:74              3 (const int)
+0:75      Sequence
+0:75        move second child to first child ( temp 4-component vector of uint)
+0:75          'result12' ( temp 4-component vector of uint)
+0:75          subpassLoadMS ( temp 4-component vector of uint)
+0:75            'subpass_ms_u4' ( uniform usubpassInputMS)
+0:75            Constant:
+0:75              3 (const int)
+0:77      Sequence
+0:77        move second child to first child ( temp 3-component vector of float)
+0:77          'result20' ( temp 3-component vector of float)
+0:77          Construct vec3 ( temp 3-component vector of float)
+0:77            subpassLoad ( temp 4-component vector of float)
+0:77              'subpass_f3' ( uniform subpassInput)
+0:78      Sequence
+0:78        move second child to first child ( temp 3-component vector of int)
+0:78          'result21' ( temp 3-component vector of int)
+0:78          Construct ivec3 ( temp 3-component vector of int)
+0:78            subpassLoad ( temp 4-component vector of int)
+0:78              'subpass_i3' ( uniform isubpassInput)
+0:79      Sequence
+0:79        move second child to first child ( temp 3-component vector of uint)
+0:79          'result22' ( temp 3-component vector of uint)
+0:79          Construct uvec3 ( temp 3-component vector of uint)
+0:79            subpassLoad ( temp 4-component vector of uint)
+0:79              'subpass_u3' ( uniform usubpassInput)
+0:81      Sequence
+0:81        move second child to first child ( temp 3-component vector of float)
+0:81          'result30' ( temp 3-component vector of float)
+0:81          Construct vec3 ( temp 3-component vector of float)
+0:81            subpassLoadMS ( temp 4-component vector of float)
+0:81              'subpass_ms_f3' ( uniform subpassInputMS)
+0:81              Constant:
+0:81                3 (const int)
+0:82      Sequence
+0:82        move second child to first child ( temp 3-component vector of int)
+0:82          'result31' ( temp 3-component vector of int)
+0:82          Construct ivec3 ( temp 3-component vector of int)
+0:82            subpassLoadMS ( temp 4-component vector of int)
+0:82              'subpass_ms_i3' ( uniform isubpassInputMS)
+0:82              Constant:
+0:82                3 (const int)
+0:83      Sequence
+0:83        move second child to first child ( temp 3-component vector of uint)
+0:83          'result32' ( temp 3-component vector of uint)
+0:83          Construct uvec3 ( temp 3-component vector of uint)
+0:83            subpassLoadMS ( temp 4-component vector of uint)
+0:83              'subpass_ms_u3' ( uniform usubpassInputMS)
+0:83              Constant:
+0:83                3 (const int)
+0:85      Sequence
+0:85        move second child to first child ( temp 2-component vector of float)
+0:85          'result40' ( temp 2-component vector of float)
+0:85          Construct vec2 ( temp 2-component vector of float)
+0:85            subpassLoad ( temp 4-component vector of float)
+0:85              'subpass_f2' ( uniform subpassInput)
+0:86      Sequence
+0:86        move second child to first child ( temp 2-component vector of int)
+0:86          'result41' ( temp 2-component vector of int)
+0:86          Construct ivec2 ( temp 2-component vector of int)
+0:86            subpassLoad ( temp 4-component vector of int)
+0:86              'subpass_i2' ( uniform isubpassInput)
+0:87      Sequence
+0:87        move second child to first child ( temp 2-component vector of uint)
+0:87          'result42' ( temp 2-component vector of uint)
+0:87          Construct uvec2 ( temp 2-component vector of uint)
+0:87            subpassLoad ( temp 4-component vector of uint)
+0:87              'subpass_u2' ( uniform usubpassInput)
+0:89      Sequence
+0:89        move second child to first child ( temp 2-component vector of float)
+0:89          'result50' ( temp 2-component vector of float)
+0:89          Construct vec2 ( temp 2-component vector of float)
+0:89            subpassLoadMS ( temp 4-component vector of float)
+0:89              'subpass_ms_f2' ( uniform subpassInputMS)
+0:89              Constant:
+0:89                2 (const int)
+0:90      Sequence
+0:90        move second child to first child ( temp 2-component vector of int)
+0:90          'result51' ( temp 2-component vector of int)
+0:90          Construct ivec2 ( temp 2-component vector of int)
+0:90            subpassLoadMS ( temp 4-component vector of int)
+0:90              'subpass_ms_i2' ( uniform isubpassInputMS)
+0:90              Constant:
+0:90                2 (const int)
+0:91      Sequence
+0:91        move second child to first child ( temp 2-component vector of uint)
+0:91          'result52' ( temp 2-component vector of uint)
+0:91          Construct uvec2 ( temp 2-component vector of uint)
+0:91            subpassLoadMS ( temp 4-component vector of uint)
+0:91              'subpass_ms_u2' ( uniform usubpassInputMS)
+0:91              Constant:
+0:91                2 (const int)
+0:93      Sequence
+0:93        move second child to first child ( temp float)
+0:93          'result60' ( temp float)
+0:93          Construct float ( temp float)
+0:93            subpassLoad ( temp 4-component vector of float)
+0:93              'subpass_f' ( uniform subpassInput)
+0:94      Sequence
+0:94        move second child to first child ( temp int)
+0:94          'result61' ( temp int)
+0:94          Construct int ( temp int)
+0:94            subpassLoad ( temp 4-component vector of int)
+0:94              'subpass_i' ( uniform isubpassInput)
+0:95      Sequence
+0:95        move second child to first child ( temp uint)
+0:95          'result62' ( temp uint)
+0:95          Construct uint ( temp uint)
+0:95            subpassLoad ( temp 4-component vector of uint)
+0:95              'subpass_u' ( uniform usubpassInput)
+0:97      Sequence
+0:97        move second child to first child ( temp float)
+0:97          'result70' ( temp float)
+0:97          Construct float ( temp float)
+0:97            subpassLoadMS ( temp 4-component vector of float)
+0:97              'subpass_ms_f' ( uniform subpassInputMS)
+0:97              Constant:
+0:97                2 (const int)
+0:98      Sequence
+0:98        move second child to first child ( temp int)
+0:98          'result71' ( temp int)
+0:98          Construct int ( temp int)
+0:98            subpassLoadMS ( temp 4-component vector of int)
+0:98              'subpass_ms_i' ( uniform isubpassInputMS)
+0:98              Constant:
+0:98                2 (const int)
+0:99      Sequence
+0:99        move second child to first child ( temp uint)
+0:99          'result72' ( temp uint)
+0:99          Construct uint ( temp uint)
+0:99            subpassLoadMS ( temp 4-component vector of uint)
+0:99              'subpass_ms_u' ( uniform usubpassInputMS)
+0:99              Constant:
+0:99                2 (const int)
+0:101      Sequence
+0:101        move second child to first child ( temp 4-component vector of float)
+0:101          'result73' ( temp 4-component vector of float)
+0:101          subpassLoad ( temp 4-component vector of float)
+0:101            'subpass_2' ( uniform subpassInput)
+0:112      Branch: Return with expression
+0:112        Constant:
+0:112          0.000000
+0:112          0.000000
+0:112          0.000000
+0:112          0.000000
+0:68  Function Definition: main( ( temp void)
+0:68    Function Parameters: 
+0:?     Sequence
+0:68      move second child to first child ( temp 4-component vector of float)
+0:?         '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+0:68        Function Call: @main( ( temp 4-component vector of float)
+0:?   Linker Objects
+0:?     'subpass_f4' (layout( binding=1 input_attachment_index=1) uniform subpassInput)
+0:?     'subpass_i4' ( uniform isubpassInput)
+0:?     'subpass_u4' ( uniform usubpassInput)
+0:?     'subpass_ms_f4' ( uniform subpassInputMS)
+0:?     'subpass_ms_i4' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u4' ( uniform usubpassInputMS)
+0:?     'subpass_f3' ( uniform subpassInput)
+0:?     'subpass_i3' ( uniform isubpassInput)
+0:?     'subpass_u3' ( uniform usubpassInput)
+0:?     'subpass_ms_f3' ( uniform subpassInputMS)
+0:?     'subpass_ms_i3' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u3' ( uniform usubpassInputMS)
+0:?     'subpass_f2' ( uniform subpassInput)
+0:?     'subpass_i2' ( uniform isubpassInput)
+0:?     'subpass_u2' ( uniform usubpassInput)
+0:?     'subpass_ms_f2' ( uniform subpassInputMS)
+0:?     'subpass_ms_i2' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u2' ( uniform usubpassInputMS)
+0:?     'subpass_f' ( uniform subpassInput)
+0:?     'subpass_i' ( uniform isubpassInput)
+0:?     'subpass_u' ( uniform usubpassInput)
+0:?     'subpass_ms_f' ( uniform subpassInputMS)
+0:?     'subpass_ms_i' ( uniform isubpassInputMS)
+0:?     'subpass_ms_u' ( uniform usubpassInputMS)
+0:?     'subpass_2' ( uniform subpassInput)
+0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 204
+
+                              Capability Shader
+                              Capability StorageImageMultisample
+                              Capability InputAttachment
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 202
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 9  "@main("
+                              Name 12  "result00"
+                              Name 15  "subpass_f4"
+                              Name 24  "result01"
+                              Name 27  "subpass_i4"
+                              Name 33  "result02"
+                              Name 36  "subpass_u4"
+                              Name 39  "result10"
+                              Name 42  "subpass_ms_f4"
+                              Name 46  "result11"
+                              Name 49  "subpass_ms_i4"
+                              Name 52  "result12"
+                              Name 55  "subpass_ms_u4"
+                              Name 60  "result20"
+                              Name 61  "subpass_f3"
+                              Name 70  "result21"
+                              Name 71  "subpass_i3"
+                              Name 80  "result22"
+                              Name 81  "subpass_u3"
+                              Name 88  "result30"
+                              Name 89  "subpass_ms_f3"
+                              Name 96  "result31"
+                              Name 97  "subpass_ms_i3"
+                              Name 104  "result32"
+                              Name 105  "subpass_ms_u3"
+                              Name 114  "result40"
+                              Name 115  "subpass_f2"
+                              Name 122  "result41"
+                              Name 123  "subpass_i2"
+                              Name 131  "result42"
+                              Name 132  "subpass_u2"
+                              Name 138  "result50"
+                              Name 139  "subpass_ms_f2"
+                              Name 146  "result51"
+                              Name 147  "subpass_ms_i2"
+                              Name 153  "result52"
+                              Name 154  "subpass_ms_u2"
+                              Name 161  "result60"
+                              Name 162  "subpass_f"
+                              Name 167  "result61"
+                              Name 168  "subpass_i"
+                              Name 173  "result62"
+                              Name 174  "subpass_u"
+                              Name 178  "result70"
+                              Name 179  "subpass_ms_f"
+                              Name 183  "result71"
+                              Name 184  "subpass_ms_i"
+                              Name 188  "result72"
+                              Name 189  "subpass_ms_u"
+                              Name 193  "result73"
+                              Name 194  "subpass_2"
+                              Name 202  "@entryPointOutput"
+                              Decorate 15(subpass_f4) DescriptorSet 0
+                              Decorate 15(subpass_f4) Binding 1
+                              Decorate 15(subpass_f4) InputAttachmentIndex 1
+                              Decorate 27(subpass_i4) DescriptorSet 0
+                              Decorate 27(subpass_i4) InputAttachmentIndex 2
+                              Decorate 36(subpass_u4) DescriptorSet 0
+                              Decorate 36(subpass_u4) InputAttachmentIndex 3
+                              Decorate 42(subpass_ms_f4) DescriptorSet 0
+                              Decorate 42(subpass_ms_f4) InputAttachmentIndex 4
+                              Decorate 49(subpass_ms_i4) DescriptorSet 0
+                              Decorate 49(subpass_ms_i4) InputAttachmentIndex 5
+                              Decorate 55(subpass_ms_u4) DescriptorSet 0
+                              Decorate 55(subpass_ms_u4) InputAttachmentIndex 6
+                              Decorate 61(subpass_f3) DescriptorSet 0
+                              Decorate 61(subpass_f3) InputAttachmentIndex 1
+                              Decorate 71(subpass_i3) DescriptorSet 0
+                              Decorate 71(subpass_i3) InputAttachmentIndex 2
+                              Decorate 81(subpass_u3) DescriptorSet 0
+                              Decorate 81(subpass_u3) InputAttachmentIndex 3
+                              Decorate 89(subpass_ms_f3) DescriptorSet 0
+                              Decorate 89(subpass_ms_f3) InputAttachmentIndex 4
+                              Decorate 97(subpass_ms_i3) DescriptorSet 0
+                              Decorate 97(subpass_ms_i3) InputAttachmentIndex 5
+                              Decorate 105(subpass_ms_u3) DescriptorSet 0
+                              Decorate 105(subpass_ms_u3) InputAttachmentIndex 6
+                              Decorate 115(subpass_f2) DescriptorSet 0
+                              Decorate 115(subpass_f2) InputAttachmentIndex 1
+                              Decorate 123(subpass_i2) DescriptorSet 0
+                              Decorate 123(subpass_i2) InputAttachmentIndex 2
+                              Decorate 132(subpass_u2) DescriptorSet 0
+                              Decorate 132(subpass_u2) InputAttachmentIndex 3
+                              Decorate 139(subpass_ms_f2) DescriptorSet 0
+                              Decorate 139(subpass_ms_f2) InputAttachmentIndex 4
+                              Decorate 147(subpass_ms_i2) DescriptorSet 0
+                              Decorate 147(subpass_ms_i2) InputAttachmentIndex 5
+                              Decorate 154(subpass_ms_u2) DescriptorSet 0
+                              Decorate 154(subpass_ms_u2) InputAttachmentIndex 6
+                              Decorate 162(subpass_f) DescriptorSet 0
+                              Decorate 162(subpass_f) InputAttachmentIndex 1
+                              Decorate 168(subpass_i) DescriptorSet 0
+                              Decorate 168(subpass_i) InputAttachmentIndex 2
+                              Decorate 174(subpass_u) DescriptorSet 0
+                              Decorate 174(subpass_u) InputAttachmentIndex 3
+                              Decorate 179(subpass_ms_f) DescriptorSet 0
+                              Decorate 179(subpass_ms_f) InputAttachmentIndex 4
+                              Decorate 184(subpass_ms_i) DescriptorSet 0
+                              Decorate 184(subpass_ms_i) InputAttachmentIndex 5
+                              Decorate 189(subpass_ms_u) DescriptorSet 0
+                              Decorate 189(subpass_ms_u) InputAttachmentIndex 6
+                              Decorate 194(subpass_2) DescriptorSet 0
+                              Decorate 194(subpass_2) InputAttachmentIndex 7
+                              Decorate 202(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+              11:             TypePointer Function 7(fvec4)
+              13:             TypeImage 6(float) SubpassData nonsampled format:Unknown
+              14:             TypePointer UniformConstant 13
+  15(subpass_f4):     14(ptr) Variable UniformConstant
+              17:             TypeInt 32 1
+              18:     17(int) Constant 0
+              19:             TypeVector 17(int) 2
+              20:   19(ivec2) ConstantComposite 18 18
+              22:             TypeVector 17(int) 4
+              23:             TypePointer Function 22(ivec4)
+              25:             TypeImage 17(int) SubpassData nonsampled format:Unknown
+              26:             TypePointer UniformConstant 25
+  27(subpass_i4):     26(ptr) Variable UniformConstant
+              30:             TypeInt 32 0
+              31:             TypeVector 30(int) 4
+              32:             TypePointer Function 31(ivec4)
+              34:             TypeImage 30(int) SubpassData nonsampled format:Unknown
+              35:             TypePointer UniformConstant 34
+  36(subpass_u4):     35(ptr) Variable UniformConstant
+              40:             TypeImage 6(float) SubpassData multi-sampled nonsampled format:Unknown
+              41:             TypePointer UniformConstant 40
+42(subpass_ms_f4):     41(ptr) Variable UniformConstant
+              44:     17(int) Constant 3
+              47:             TypeImage 17(int) SubpassData multi-sampled nonsampled format:Unknown
+              48:             TypePointer UniformConstant 47
+49(subpass_ms_i4):     48(ptr) Variable UniformConstant
+              53:             TypeImage 30(int) SubpassData multi-sampled nonsampled format:Unknown
+              54:             TypePointer UniformConstant 53
+55(subpass_ms_u4):     54(ptr) Variable UniformConstant
+              58:             TypeVector 6(float) 3
+              59:             TypePointer Function 58(fvec3)
+  61(subpass_f3):     14(ptr) Variable UniformConstant
+              68:             TypeVector 17(int) 3
+              69:             TypePointer Function 68(ivec3)
+  71(subpass_i3):     26(ptr) Variable UniformConstant
+              78:             TypeVector 30(int) 3
+              79:             TypePointer Function 78(ivec3)
+  81(subpass_u3):     35(ptr) Variable UniformConstant
+89(subpass_ms_f3):     41(ptr) Variable UniformConstant
+97(subpass_ms_i3):     48(ptr) Variable UniformConstant
+105(subpass_ms_u3):     54(ptr) Variable UniformConstant
+             112:             TypeVector 6(float) 2
+             113:             TypePointer Function 112(fvec2)
+ 115(subpass_f2):     14(ptr) Variable UniformConstant
+             121:             TypePointer Function 19(ivec2)
+ 123(subpass_i2):     26(ptr) Variable UniformConstant
+             129:             TypeVector 30(int) 2
+             130:             TypePointer Function 129(ivec2)
+ 132(subpass_u2):     35(ptr) Variable UniformConstant
+139(subpass_ms_f2):     41(ptr) Variable UniformConstant
+             141:     17(int) Constant 2
+147(subpass_ms_i2):     48(ptr) Variable UniformConstant
+154(subpass_ms_u2):     54(ptr) Variable UniformConstant
+             160:             TypePointer Function 6(float)
+  162(subpass_f):     14(ptr) Variable UniformConstant
+             166:             TypePointer Function 17(int)
+  168(subpass_i):     26(ptr) Variable UniformConstant
+             172:             TypePointer Function 30(int)
+  174(subpass_u):     35(ptr) Variable UniformConstant
+179(subpass_ms_f):     41(ptr) Variable UniformConstant
+184(subpass_ms_i):     48(ptr) Variable UniformConstant
+189(subpass_ms_u):     54(ptr) Variable UniformConstant
+  194(subpass_2):     14(ptr) Variable UniformConstant
+             197:    6(float) Constant 0
+             198:    7(fvec4) ConstantComposite 197 197 197 197
+             201:             TypePointer Output 7(fvec4)
+202(@entryPointOutput):    201(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+             203:    7(fvec4) FunctionCall 9(@main()
+                              Store 202(@entryPointOutput) 203
+                              Return
+                              FunctionEnd
+       9(@main():    7(fvec4) Function None 8
+              10:             Label
+    12(result00):     11(ptr) Variable Function
+    24(result01):     23(ptr) Variable Function
+    33(result02):     32(ptr) Variable Function
+    39(result10):     11(ptr) Variable Function
+    46(result11):     23(ptr) Variable Function
+    52(result12):     32(ptr) Variable Function
+    60(result20):     59(ptr) Variable Function
+    70(result21):     69(ptr) Variable Function
+    80(result22):     79(ptr) Variable Function
+    88(result30):     59(ptr) Variable Function
+    96(result31):     69(ptr) Variable Function
+   104(result32):     79(ptr) Variable Function
+   114(result40):    113(ptr) Variable Function
+   122(result41):    121(ptr) Variable Function
+   131(result42):    130(ptr) Variable Function
+   138(result50):    113(ptr) Variable Function
+   146(result51):    121(ptr) Variable Function
+   153(result52):    130(ptr) Variable Function
+   161(result60):    160(ptr) Variable Function
+   167(result61):    166(ptr) Variable Function
+   173(result62):    172(ptr) Variable Function
+   178(result70):    160(ptr) Variable Function
+   183(result71):    166(ptr) Variable Function
+   188(result72):    172(ptr) Variable Function
+   193(result73):     11(ptr) Variable Function
+              16:          13 Load 15(subpass_f4)
+              21:    7(fvec4) ImageRead 16 20
+                              Store 12(result00) 21
+              28:          25 Load 27(subpass_i4)
+              29:   22(ivec4) ImageRead 28 20
+                              Store 24(result01) 29
+              37:          34 Load 36(subpass_u4)
+              38:   31(ivec4) ImageRead 37 20
+                              Store 33(result02) 38
+              43:          40 Load 42(subpass_ms_f4)
+              45:    7(fvec4) ImageRead 43 20 Sample 44
+                              Store 39(result10) 45
+              50:          47 Load 49(subpass_ms_i4)
+              51:   22(ivec4) ImageRead 50 20 Sample 44
+                              Store 46(result11) 51
+              56:          53 Load 55(subpass_ms_u4)
+              57:   31(ivec4) ImageRead 56 20 Sample 44
+                              Store 52(result12) 57
+              62:          13 Load 61(subpass_f3)
+              63:    7(fvec4) ImageRead 62 20
+              64:    6(float) CompositeExtract 63 0
+              65:    6(float) CompositeExtract 63 1
+              66:    6(float) CompositeExtract 63 2
+              67:   58(fvec3) CompositeConstruct 64 65 66
+                              Store 60(result20) 67
+              72:          25 Load 71(subpass_i3)
+              73:   22(ivec4) ImageRead 72 20
+              74:     17(int) CompositeExtract 73 0
+              75:     17(int) CompositeExtract 73 1
+              76:     17(int) CompositeExtract 73 2
+              77:   68(ivec3) CompositeConstruct 74 75 76
+                              Store 70(result21) 77
+              82:          34 Load 81(subpass_u3)
+              83:   31(ivec4) ImageRead 82 20
+              84:     30(int) CompositeExtract 83 0
+              85:     30(int) CompositeExtract 83 1
+              86:     30(int) CompositeExtract 83 2
+              87:   78(ivec3) CompositeConstruct 84 85 86
+                              Store 80(result22) 87
+              90:          40 Load 89(subpass_ms_f3)
+              91:    7(fvec4) ImageRead 90 20 Sample 44
+              92:    6(float) CompositeExtract 91 0
+              93:    6(float) CompositeExtract 91 1
+              94:    6(float) CompositeExtract 91 2
+              95:   58(fvec3) CompositeConstruct 92 93 94
+                              Store 88(result30) 95
+              98:          47 Load 97(subpass_ms_i3)
+              99:   22(ivec4) ImageRead 98 20 Sample 44
+             100:     17(int) CompositeExtract 99 0
+             101:     17(int) CompositeExtract 99 1
+             102:     17(int) CompositeExtract 99 2
+             103:   68(ivec3) CompositeConstruct 100 101 102
+                              Store 96(result31) 103
+             106:          53 Load 105(subpass_ms_u3)
+             107:   31(ivec4) ImageRead 106 20 Sample 44
+             108:     30(int) CompositeExtract 107 0
+             109:     30(int) CompositeExtract 107 1
+             110:     30(int) CompositeExtract 107 2
+             111:   78(ivec3) CompositeConstruct 108 109 110
+                              Store 104(result32) 111
+             116:          13 Load 115(subpass_f2)
+             117:    7(fvec4) ImageRead 116 20
+             118:    6(float) CompositeExtract 117 0
+             119:    6(float) CompositeExtract 117 1
+             120:  112(fvec2) CompositeConstruct 118 119
+                              Store 114(result40) 120
+             124:          25 Load 123(subpass_i2)
+             125:   22(ivec4) ImageRead 124 20
+             126:     17(int) CompositeExtract 125 0
+             127:     17(int) CompositeExtract 125 1
+             128:   19(ivec2) CompositeConstruct 126 127
+                              Store 122(result41) 128
+             133:          34 Load 132(subpass_u2)
+             134:   31(ivec4) ImageRead 133 20
+             135:     30(int) CompositeExtract 134 0
+             136:     30(int) CompositeExtract 134 1
+             137:  129(ivec2) CompositeConstruct 135 136
+                              Store 131(result42) 137
+             140:          40 Load 139(subpass_ms_f2)
+             142:    7(fvec4) ImageRead 140 20 Sample 141
+             143:    6(float) CompositeExtract 142 0
+             144:    6(float) CompositeExtract 142 1
+             145:  112(fvec2) CompositeConstruct 143 144
+                              Store 138(result50) 145
+             148:          47 Load 147(subpass_ms_i2)
+             149:   22(ivec4) ImageRead 148 20 Sample 141
+             150:     17(int) CompositeExtract 149 0
+             151:     17(int) CompositeExtract 149 1
+             152:   19(ivec2) CompositeConstruct 150 151
+                              Store 146(result51) 152
+             155:          53 Load 154(subpass_ms_u2)
+             156:   31(ivec4) ImageRead 155 20 Sample 141
+             157:     30(int) CompositeExtract 156 0
+             158:     30(int) CompositeExtract 156 1
+             159:  129(ivec2) CompositeConstruct 157 158
+                              Store 153(result52) 159
+             163:          13 Load 162(subpass_f)
+             164:    7(fvec4) ImageRead 163 20
+             165:    6(float) CompositeExtract 164 0
+                              Store 161(result60) 165
+             169:          25 Load 168(subpass_i)
+             170:   22(ivec4) ImageRead 169 20
+             171:     17(int) CompositeExtract 170 0
+                              Store 167(result61) 171
+             175:          34 Load 174(subpass_u)
+             176:   31(ivec4) ImageRead 175 20
+             177:     30(int) CompositeExtract 176 0
+                              Store 173(result62) 177
+             180:          40 Load 179(subpass_ms_f)
+             181:    7(fvec4) ImageRead 180 20 Sample 141
+             182:    6(float) CompositeExtract 181 0
+                              Store 178(result70) 182
+             185:          47 Load 184(subpass_ms_i)
+             186:   22(ivec4) ImageRead 185 20 Sample 141
+             187:     17(int) CompositeExtract 186 0
+                              Store 183(result71) 187
+             190:          53 Load 189(subpass_ms_u)
+             191:   31(ivec4) ImageRead 190 20 Sample 141
+             192:     30(int) CompositeExtract 191 0
+                              Store 188(result72) 192
+             195:          13 Load 194(subpass_2)
+             196:    7(fvec4) ImageRead 195 20
+                              Store 193(result73) 196
+                              ReturnValue 198
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.texture.struct.frag.out b/Test/baseResults/hlsl.texture.struct.frag.out
index 75b9f84..2aa7bd2 100644
--- a/Test/baseResults/hlsl.texture.struct.frag.out
+++ b/Test/baseResults/hlsl.texture.struct.frag.out
@@ -839,12 +839,12 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 233
+// Id's are bound by 240
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 231
+                              EntryPoint Fragment 4  "main" 238
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -867,52 +867,55 @@
                               Name 71  "@sampleStructTemp"
                               Name 87  "s1"
                               Name 88  "@sampleResultShadow"
-                              Name 89  "g_tTex2s1"
-                              Name 97  "@sampleStructTemp"
-                              Name 111  "s2"
-                              Name 112  "@sampleResultShadow"
-                              Name 113  "g_tTex2s2"
-                              Name 121  "@sampleStructTemp"
-                              Name 135  "s3_t"
-                              MemberName 135(s3_t) 0  "c0"
-                              MemberName 135(s3_t) 1  "c1"
-                              Name 137  "s3"
-                              Name 138  "@sampleResultShadow"
-                              Name 139  "g_tTex2s3"
-                              Name 147  "@sampleStructTemp"
-                              Name 159  "s4_t"
-                              MemberName 159(s4_t) 0  "c0"
-                              MemberName 159(s4_t) 1  "c1"
-                              MemberName 159(s4_t) 2  "c2"
-                              Name 161  "s4"
-                              Name 164  "@sampleResultShadow"
-                              Name 167  "g_tTex2s4"
-                              Name 176  "@sampleStructTemp"
-                              Name 193  "s5_t"
-                              MemberName 193(s5_t) 0  "c0"
-                              MemberName 193(s5_t) 1  "c1"
-                              Name 195  "s5"
-                              Name 198  "@sampleResultShadow"
-                              Name 201  "g_tTex2s5"
-                              Name 210  "@sampleStructTemp"
-                              Name 219  "r0"
-                              Name 221  "r1"
-                              Name 223  "r2"
-                              Name 224  "g_tTex2s1a"
-                              Name 231  "@entryPointOutput"
+                              Name 90  "g_tTex2s1"
+                              Name 98  "@sampleStructTemp"
+                              Name 112  "s2"
+                              Name 113  "@sampleResultShadow"
+                              Name 114  "g_tTex2s2"
+                              Name 122  "@sampleStructTemp"
+                              Name 136  "s3_t"
+                              MemberName 136(s3_t) 0  "c0"
+                              MemberName 136(s3_t) 1  "c1"
+                              Name 138  "s3"
+                              Name 139  "@sampleResultShadow"
+                              Name 140  "g_tTex2s3"
+                              Name 148  "@sampleStructTemp"
+                              Name 160  "s4_t"
+                              MemberName 160(s4_t) 0  "c0"
+                              MemberName 160(s4_t) 1  "c1"
+                              MemberName 160(s4_t) 2  "c2"
+                              Name 162  "s4"
+                              Name 165  "@sampleResultShadow"
+                              Name 168  "g_tTex2s4"
+                              Name 177  "@sampleStructTemp"
+                              Name 194  "s5_t"
+                              MemberName 194(s5_t) 0  "c0"
+                              MemberName 194(s5_t) 1  "c1"
+                              Name 196  "s5"
+                              Name 199  "@sampleResultShadow"
+                              Name 202  "g_tTex2s5"
+                              Name 211  "@sampleStructTemp"
+                              Name 220  "r0"
+                              Name 221  "param"
+                              Name 224  "r1"
+                              Name 225  "param"
+                              Name 228  "r2"
+                              Name 229  "g_tTex2s1a"
+                              Name 230  "param"
+                              Name 238  "@entryPointOutput"
                               Decorate 30(g_sSamp) DescriptorSet 0
-                              Decorate 89(g_tTex2s1) DescriptorSet 0
-                              Decorate 113(g_tTex2s2) DescriptorSet 0
-                              Decorate 139(g_tTex2s3) DescriptorSet 0
-                              Decorate 167(g_tTex2s4) DescriptorSet 0
-                              Decorate 201(g_tTex2s5) DescriptorSet 0
-                              Decorate 224(g_tTex2s1a) DescriptorSet 0
-                              Decorate 231(@entryPointOutput) Location 0
+                              Decorate 90(g_tTex2s1) DescriptorSet 0
+                              Decorate 114(g_tTex2s2) DescriptorSet 0
+                              Decorate 140(g_tTex2s3) DescriptorSet 0
+                              Decorate 168(g_tTex2s4) DescriptorSet 0
+                              Decorate 202(g_tTex2s5) DescriptorSet 0
+                              Decorate 229(g_tTex2s1a) DescriptorSet 0
+                              Decorate 238(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
                7:             TypeImage 6(float) 2D sampled format:Unknown
-               8:             TypePointer UniformConstant 7
+               8:             TypePointer Function 7
                9:             TypeVector 6(float) 2
         10(s1_t):             TypeStruct 6(float) 9(fvec2) 6(float)
               11:             TypeFunction 10(s1_t) 8(ptr)
@@ -941,54 +944,55 @@
               57:     40(int) Constant 2
               58:     42(int) Constant 3
               70:             TypePointer Function 16(s2_t)
-   89(g_tTex2s1):      8(ptr) Variable UniformConstant
-              93:    6(float) Constant 1036831949
-              94:    6(float) Constant 1038174126
-              95:    9(fvec2) ConstantComposite 93 94
-  113(g_tTex2s2):      8(ptr) Variable UniformConstant
-             117:    6(float) Constant 1045220557
-             118:    6(float) Constant 1045891645
-             119:    9(fvec2) ConstantComposite 117 118
-       135(s3_t):             TypeStruct 9(fvec2) 6(float)
-             136:             TypePointer Function 135(s3_t)
-  139(g_tTex2s3):      8(ptr) Variable UniformConstant
-             143:    6(float) Constant 1050253722
-             144:    6(float) Constant 1050589266
-             145:    9(fvec2) ConstantComposite 143 144
-             158:             TypeVector 40(int) 2
-       159(s4_t):             TypeStruct 40(int) 158(ivec2) 40(int)
-             160:             TypePointer Function 159(s4_t)
-             162:             TypeVector 40(int) 4
-             163:             TypePointer Function 162(ivec4)
-             165:             TypeImage 40(int) 2D sampled format:Unknown
-             166:             TypePointer UniformConstant 165
-  167(g_tTex2s4):    166(ptr) Variable UniformConstant
-             170:             TypeSampledImage 165
-             172:    6(float) Constant 1053609165
-             173:    6(float) Constant 1053944709
-             174:    9(fvec2) ConstantComposite 172 173
-             177:             TypePointer Function 40(int)
-       193(s5_t):             TypeStruct 42(int) 42(int)
-             194:             TypePointer Function 193(s5_t)
-             196:             TypeVector 42(int) 4
-             197:             TypePointer Function 196(ivec4)
-             199:             TypeImage 42(int) 2D sampled format:Unknown
-             200:             TypePointer UniformConstant 199
-  201(g_tTex2s5):    200(ptr) Variable UniformConstant
-             204:             TypeSampledImage 199
-             206:    6(float) Constant 1056964608
-             207:    6(float) Constant 1057132380
-             208:    9(fvec2) ConstantComposite 206 207
-             211:             TypePointer Function 42(int)
- 224(g_tTex2s1a):      8(ptr) Variable UniformConstant
-             226:    6(float) Constant 0
-             227:   21(fvec4) ConstantComposite 226 226 226 226
-             230:             TypePointer Output 21(fvec4)
-231(@entryPointOutput):    230(ptr) Variable Output
+              89:             TypePointer UniformConstant 7
+   90(g_tTex2s1):     89(ptr) Variable UniformConstant
+              94:    6(float) Constant 1036831949
+              95:    6(float) Constant 1038174126
+              96:    9(fvec2) ConstantComposite 94 95
+  114(g_tTex2s2):     89(ptr) Variable UniformConstant
+             118:    6(float) Constant 1045220557
+             119:    6(float) Constant 1045891645
+             120:    9(fvec2) ConstantComposite 118 119
+       136(s3_t):             TypeStruct 9(fvec2) 6(float)
+             137:             TypePointer Function 136(s3_t)
+  140(g_tTex2s3):     89(ptr) Variable UniformConstant
+             144:    6(float) Constant 1050253722
+             145:    6(float) Constant 1050589266
+             146:    9(fvec2) ConstantComposite 144 145
+             159:             TypeVector 40(int) 2
+       160(s4_t):             TypeStruct 40(int) 159(ivec2) 40(int)
+             161:             TypePointer Function 160(s4_t)
+             163:             TypeVector 40(int) 4
+             164:             TypePointer Function 163(ivec4)
+             166:             TypeImage 40(int) 2D sampled format:Unknown
+             167:             TypePointer UniformConstant 166
+  168(g_tTex2s4):    167(ptr) Variable UniformConstant
+             171:             TypeSampledImage 166
+             173:    6(float) Constant 1053609165
+             174:    6(float) Constant 1053944709
+             175:    9(fvec2) ConstantComposite 173 174
+             178:             TypePointer Function 40(int)
+       194(s5_t):             TypeStruct 42(int) 42(int)
+             195:             TypePointer Function 194(s5_t)
+             197:             TypeVector 42(int) 4
+             198:             TypePointer Function 197(ivec4)
+             200:             TypeImage 42(int) 2D sampled format:Unknown
+             201:             TypePointer UniformConstant 200
+  202(g_tTex2s5):    201(ptr) Variable UniformConstant
+             205:             TypeSampledImage 200
+             207:    6(float) Constant 1056964608
+             208:    6(float) Constant 1057132380
+             209:    9(fvec2) ConstantComposite 207 208
+             212:             TypePointer Function 42(int)
+ 229(g_tTex2s1a):     89(ptr) Variable UniformConstant
+             233:    6(float) Constant 0
+             234:   21(fvec4) ConstantComposite 233 233 233 233
+             237:             TypePointer Output 21(fvec4)
+238(@entryPointOutput):    237(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-             232:   21(fvec4) FunctionCall 23(@main()
-                              Store 231(@entryPointOutput) 232
+             239:   21(fvec4) FunctionCall 23(@main()
+                              Store 238(@entryPointOutput) 239
                               Return
                               FunctionEnd
 13(fn1(t2-tx-struct0-1;):    10(s1_t) Function None 11
@@ -1053,132 +1057,141 @@
               24:             Label
           87(s1):     38(ptr) Variable Function
 88(@sampleResultShadow):     25(ptr) Variable Function
-97(@sampleStructTemp):     38(ptr) Variable Function
-         111(s2):     70(ptr) Variable Function
-112(@sampleResultShadow):     25(ptr) Variable Function
-121(@sampleStructTemp):     70(ptr) Variable Function
-         137(s3):    136(ptr) Variable Function
-138(@sampleResultShadow):     25(ptr) Variable Function
-147(@sampleStructTemp):    136(ptr) Variable Function
-         161(s4):    160(ptr) Variable Function
-164(@sampleResultShadow):    163(ptr) Variable Function
-176(@sampleStructTemp):    160(ptr) Variable Function
-         195(s5):    194(ptr) Variable Function
-198(@sampleResultShadow):    197(ptr) Variable Function
-210(@sampleStructTemp):    194(ptr) Variable Function
-         219(r0):     38(ptr) Variable Function
-         221(r1):     70(ptr) Variable Function
-         223(r2):     38(ptr) Variable Function
-              90:           7 Load 89(g_tTex2s1)
-              91:          28 Load 30(g_sSamp)
-              92:          32 SampledImage 90 91
-              96:   21(fvec4) ImageSampleImplicitLod 92 95
-                              Store 88(@sampleResultShadow) 96
-              98:     44(ptr) AccessChain 88(@sampleResultShadow) 43
-              99:    6(float) Load 98
-             100:     44(ptr) AccessChain 97(@sampleStructTemp) 41
-                              Store 100 99
-             101:     44(ptr) AccessChain 88(@sampleResultShadow) 49
-             102:    6(float) Load 101
-             103:     44(ptr) AccessChain 97(@sampleStructTemp) 48 43
-                              Store 103 102
-             104:     44(ptr) AccessChain 88(@sampleResultShadow) 53
-             105:    6(float) Load 104
-             106:     44(ptr) AccessChain 97(@sampleStructTemp) 48 49
-                              Store 106 105
-             107:     44(ptr) AccessChain 88(@sampleResultShadow) 58
-             108:    6(float) Load 107
-             109:     44(ptr) AccessChain 97(@sampleStructTemp) 57
-                              Store 109 108
-             110:    10(s1_t) Load 97(@sampleStructTemp)
-                              Store 87(s1) 110
-             114:           7 Load 113(g_tTex2s2)
-             115:          28 Load 30(g_sSamp)
-             116:          32 SampledImage 114 115
-             120:   21(fvec4) ImageSampleImplicitLod 116 119
-                              Store 112(@sampleResultShadow) 120
-             122:     44(ptr) AccessChain 112(@sampleResultShadow) 43
-             123:    6(float) Load 122
-             124:     44(ptr) AccessChain 121(@sampleStructTemp) 41
-                              Store 124 123
-             125:     44(ptr) AccessChain 112(@sampleResultShadow) 49
-             126:    6(float) Load 125
-             127:     44(ptr) AccessChain 121(@sampleStructTemp) 48 43
-                              Store 127 126
-             128:     44(ptr) AccessChain 112(@sampleResultShadow) 53
-             129:    6(float) Load 128
-             130:     44(ptr) AccessChain 121(@sampleStructTemp) 48 49
-                              Store 130 129
-             131:     44(ptr) AccessChain 112(@sampleResultShadow) 58
-             132:    6(float) Load 131
-             133:     44(ptr) AccessChain 121(@sampleStructTemp) 48 53
-                              Store 133 132
-             134:    16(s2_t) Load 121(@sampleStructTemp)
-                              Store 111(s2) 134
-             140:           7 Load 139(g_tTex2s3)
-             141:          28 Load 30(g_sSamp)
-             142:          32 SampledImage 140 141
-             146:   21(fvec4) ImageSampleImplicitLod 142 145
-                              Store 138(@sampleResultShadow) 146
-             148:     44(ptr) AccessChain 138(@sampleResultShadow) 43
-             149:    6(float) Load 148
-             150:     44(ptr) AccessChain 147(@sampleStructTemp) 41 43
-                              Store 150 149
-             151:     44(ptr) AccessChain 138(@sampleResultShadow) 49
-             152:    6(float) Load 151
-             153:     44(ptr) AccessChain 147(@sampleStructTemp) 41 49
-                              Store 153 152
-             154:     44(ptr) AccessChain 138(@sampleResultShadow) 53
-             155:    6(float) Load 154
-             156:     44(ptr) AccessChain 147(@sampleStructTemp) 48
-                              Store 156 155
-             157:   135(s3_t) Load 147(@sampleStructTemp)
-                              Store 137(s3) 157
-             168:         165 Load 167(g_tTex2s4)
-             169:          28 Load 30(g_sSamp)
-             171:         170 SampledImage 168 169
-             175:  162(ivec4) ImageSampleImplicitLod 171 174
-                              Store 164(@sampleResultShadow) 175
-             178:    177(ptr) AccessChain 164(@sampleResultShadow) 43
-             179:     40(int) Load 178
-             180:    177(ptr) AccessChain 176(@sampleStructTemp) 41
-                              Store 180 179
-             181:    177(ptr) AccessChain 164(@sampleResultShadow) 49
-             182:     40(int) Load 181
-             183:    6(float) ConvertSToF 182
-             184:    177(ptr) AccessChain 176(@sampleStructTemp) 48 43
-                              Store 184 183
-             185:    177(ptr) AccessChain 164(@sampleResultShadow) 53
-             186:     40(int) Load 185
-             187:    6(float) ConvertSToF 186
-             188:    177(ptr) AccessChain 176(@sampleStructTemp) 48 49
-                              Store 188 187
-             189:    177(ptr) AccessChain 164(@sampleResultShadow) 58
-             190:     40(int) Load 189
-             191:    177(ptr) AccessChain 176(@sampleStructTemp) 57
-                              Store 191 190
-             192:   159(s4_t) Load 176(@sampleStructTemp)
-                              Store 161(s4) 192
-             202:         199 Load 201(g_tTex2s5)
-             203:          28 Load 30(g_sSamp)
-             205:         204 SampledImage 202 203
-             209:  196(ivec4) ImageSampleImplicitLod 205 208
-                              Store 198(@sampleResultShadow) 209
-             212:    211(ptr) AccessChain 198(@sampleResultShadow) 43
-             213:     42(int) Load 212
-             214:    211(ptr) AccessChain 210(@sampleStructTemp) 41
-                              Store 214 213
-             215:    211(ptr) AccessChain 198(@sampleResultShadow) 49
-             216:     42(int) Load 215
-             217:    211(ptr) AccessChain 210(@sampleStructTemp) 48
-                              Store 217 216
-             218:   193(s5_t) Load 210(@sampleStructTemp)
-                              Store 195(s5) 218
-             220:    10(s1_t) FunctionCall 13(fn1(t2-tx-struct0-1;) 89(g_tTex2s1)
-                              Store 219(r0) 220
-             222:    16(s2_t) FunctionCall 19(fn1(t2-tx-struct1-1;) 113(g_tTex2s2)
-                              Store 221(r1) 222
-             225:    10(s1_t) FunctionCall 13(fn1(t2-tx-struct0-1;) 224(g_tTex2s1a)
-                              Store 223(r2) 225
-                              ReturnValue 227
+98(@sampleStructTemp):     38(ptr) Variable Function
+         112(s2):     70(ptr) Variable Function
+113(@sampleResultShadow):     25(ptr) Variable Function
+122(@sampleStructTemp):     70(ptr) Variable Function
+         138(s3):    137(ptr) Variable Function
+139(@sampleResultShadow):     25(ptr) Variable Function
+148(@sampleStructTemp):    137(ptr) Variable Function
+         162(s4):    161(ptr) Variable Function
+165(@sampleResultShadow):    164(ptr) Variable Function
+177(@sampleStructTemp):    161(ptr) Variable Function
+         196(s5):    195(ptr) Variable Function
+199(@sampleResultShadow):    198(ptr) Variable Function
+211(@sampleStructTemp):    195(ptr) Variable Function
+         220(r0):     38(ptr) Variable Function
+      221(param):      8(ptr) Variable Function
+         224(r1):     70(ptr) Variable Function
+      225(param):      8(ptr) Variable Function
+         228(r2):     38(ptr) Variable Function
+      230(param):      8(ptr) Variable Function
+              91:           7 Load 90(g_tTex2s1)
+              92:          28 Load 30(g_sSamp)
+              93:          32 SampledImage 91 92
+              97:   21(fvec4) ImageSampleImplicitLod 93 96
+                              Store 88(@sampleResultShadow) 97
+              99:     44(ptr) AccessChain 88(@sampleResultShadow) 43
+             100:    6(float) Load 99
+             101:     44(ptr) AccessChain 98(@sampleStructTemp) 41
+                              Store 101 100
+             102:     44(ptr) AccessChain 88(@sampleResultShadow) 49
+             103:    6(float) Load 102
+             104:     44(ptr) AccessChain 98(@sampleStructTemp) 48 43
+                              Store 104 103
+             105:     44(ptr) AccessChain 88(@sampleResultShadow) 53
+             106:    6(float) Load 105
+             107:     44(ptr) AccessChain 98(@sampleStructTemp) 48 49
+                              Store 107 106
+             108:     44(ptr) AccessChain 88(@sampleResultShadow) 58
+             109:    6(float) Load 108
+             110:     44(ptr) AccessChain 98(@sampleStructTemp) 57
+                              Store 110 109
+             111:    10(s1_t) Load 98(@sampleStructTemp)
+                              Store 87(s1) 111
+             115:           7 Load 114(g_tTex2s2)
+             116:          28 Load 30(g_sSamp)
+             117:          32 SampledImage 115 116
+             121:   21(fvec4) ImageSampleImplicitLod 117 120
+                              Store 113(@sampleResultShadow) 121
+             123:     44(ptr) AccessChain 113(@sampleResultShadow) 43
+             124:    6(float) Load 123
+             125:     44(ptr) AccessChain 122(@sampleStructTemp) 41
+                              Store 125 124
+             126:     44(ptr) AccessChain 113(@sampleResultShadow) 49
+             127:    6(float) Load 126
+             128:     44(ptr) AccessChain 122(@sampleStructTemp) 48 43
+                              Store 128 127
+             129:     44(ptr) AccessChain 113(@sampleResultShadow) 53
+             130:    6(float) Load 129
+             131:     44(ptr) AccessChain 122(@sampleStructTemp) 48 49
+                              Store 131 130
+             132:     44(ptr) AccessChain 113(@sampleResultShadow) 58
+             133:    6(float) Load 132
+             134:     44(ptr) AccessChain 122(@sampleStructTemp) 48 53
+                              Store 134 133
+             135:    16(s2_t) Load 122(@sampleStructTemp)
+                              Store 112(s2) 135
+             141:           7 Load 140(g_tTex2s3)
+             142:          28 Load 30(g_sSamp)
+             143:          32 SampledImage 141 142
+             147:   21(fvec4) ImageSampleImplicitLod 143 146
+                              Store 139(@sampleResultShadow) 147
+             149:     44(ptr) AccessChain 139(@sampleResultShadow) 43
+             150:    6(float) Load 149
+             151:     44(ptr) AccessChain 148(@sampleStructTemp) 41 43
+                              Store 151 150
+             152:     44(ptr) AccessChain 139(@sampleResultShadow) 49
+             153:    6(float) Load 152
+             154:     44(ptr) AccessChain 148(@sampleStructTemp) 41 49
+                              Store 154 153
+             155:     44(ptr) AccessChain 139(@sampleResultShadow) 53
+             156:    6(float) Load 155
+             157:     44(ptr) AccessChain 148(@sampleStructTemp) 48
+                              Store 157 156
+             158:   136(s3_t) Load 148(@sampleStructTemp)
+                              Store 138(s3) 158
+             169:         166 Load 168(g_tTex2s4)
+             170:          28 Load 30(g_sSamp)
+             172:         171 SampledImage 169 170
+             176:  163(ivec4) ImageSampleImplicitLod 172 175
+                              Store 165(@sampleResultShadow) 176
+             179:    178(ptr) AccessChain 165(@sampleResultShadow) 43
+             180:     40(int) Load 179
+             181:    178(ptr) AccessChain 177(@sampleStructTemp) 41
+                              Store 181 180
+             182:    178(ptr) AccessChain 165(@sampleResultShadow) 49
+             183:     40(int) Load 182
+             184:    6(float) ConvertSToF 183
+             185:    178(ptr) AccessChain 177(@sampleStructTemp) 48 43
+                              Store 185 184
+             186:    178(ptr) AccessChain 165(@sampleResultShadow) 53
+             187:     40(int) Load 186
+             188:    6(float) ConvertSToF 187
+             189:    178(ptr) AccessChain 177(@sampleStructTemp) 48 49
+                              Store 189 188
+             190:    178(ptr) AccessChain 165(@sampleResultShadow) 58
+             191:     40(int) Load 190
+             192:    178(ptr) AccessChain 177(@sampleStructTemp) 57
+                              Store 192 191
+             193:   160(s4_t) Load 177(@sampleStructTemp)
+                              Store 162(s4) 193
+             203:         200 Load 202(g_tTex2s5)
+             204:          28 Load 30(g_sSamp)
+             206:         205 SampledImage 203 204
+             210:  197(ivec4) ImageSampleImplicitLod 206 209
+                              Store 199(@sampleResultShadow) 210
+             213:    212(ptr) AccessChain 199(@sampleResultShadow) 43
+             214:     42(int) Load 213
+             215:    212(ptr) AccessChain 211(@sampleStructTemp) 41
+                              Store 215 214
+             216:    212(ptr) AccessChain 199(@sampleResultShadow) 49
+             217:     42(int) Load 216
+             218:    212(ptr) AccessChain 211(@sampleStructTemp) 48
+                              Store 218 217
+             219:   194(s5_t) Load 211(@sampleStructTemp)
+                              Store 196(s5) 219
+             222:           7 Load 90(g_tTex2s1)
+                              Store 221(param) 222
+             223:    10(s1_t) FunctionCall 13(fn1(t2-tx-struct0-1;) 221(param)
+                              Store 220(r0) 223
+             226:           7 Load 114(g_tTex2s2)
+                              Store 225(param) 226
+             227:    16(s2_t) FunctionCall 19(fn1(t2-tx-struct1-1;) 225(param)
+                              Store 224(r1) 227
+             231:           7 Load 229(g_tTex2s1a)
+                              Store 230(param) 231
+             232:    10(s1_t) FunctionCall 13(fn1(t2-tx-struct0-1;) 230(param)
+                              Store 228(r2) 232
+                              ReturnValue 234
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.tx.overload.frag.out b/Test/baseResults/hlsl.tx.overload.frag.out
index 588b910..6e6bef0 100644
--- a/Test/baseResults/hlsl.tx.overload.frag.out
+++ b/Test/baseResults/hlsl.tx.overload.frag.out
@@ -135,12 +135,12 @@
 
 // Module Version 10000
 // Generated by (magic number): 80002
-// Id's are bound by 62
+// Id's are bound by 73
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 60
+                              EntryPoint Fragment 4  "main" 71
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -153,44 +153,51 @@
                               Name 28  "Func(I21;"
                               Name 27  "DummyTex"
                               Name 31  "@main("
-                              Name 44  "tf1"
-                              Name 46  "tf4"
-                              Name 50  "twf1"
-                              Name 54  "twf4"
-                              Name 60  "@entryPointOutput"
-                              Decorate 44(tf1) DescriptorSet 0
-                              Decorate 46(tf4) DescriptorSet 0
-                              Decorate 50(twf1) DescriptorSet 0
-                              Decorate 54(twf4) DescriptorSet 0
-                              Decorate 60(@entryPointOutput) Location 0
+                              Name 45  "tf1"
+                              Name 46  "param"
+                              Name 49  "tf4"
+                              Name 50  "param"
+                              Name 56  "twf1"
+                              Name 57  "param"
+                              Name 63  "twf4"
+                              Name 64  "param"
+                              Name 71  "@entryPointOutput"
+                              Decorate 45(tf1) DescriptorSet 0
+                              Decorate 49(tf4) DescriptorSet 0
+                              Decorate 56(twf1) DescriptorSet 0
+                              Decorate 63(twf4) DescriptorSet 0
+                              Decorate 71(@entryPointOutput) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
                7:             TypeImage 6(float) 2D sampled format:Unknown
-               8:             TypePointer UniformConstant 7
+               8:             TypePointer Function 7
                9:             TypeFunction 6(float) 8(ptr)
               13:             TypeVector 6(float) 4
               14:             TypeFunction 13(fvec4) 8(ptr)
               18:             TypeImage 6(float) 2D nonsampled format:R32f
-              19:             TypePointer UniformConstant 18
+              19:             TypePointer Function 18
               20:             TypeFunction 6(float) 19(ptr)
               24:             TypeImage 6(float) 2D nonsampled format:Rgba32f
-              25:             TypePointer UniformConstant 24
+              25:             TypePointer Function 24
               26:             TypeFunction 13(fvec4) 25(ptr)
               30:             TypeFunction 13(fvec4)
               33:    6(float) Constant 1065353216
               36:    6(float) Constant 0
               37:   13(fvec4) ConstantComposite 36 36 36 36
-         44(tf1):      8(ptr) Variable UniformConstant
-         46(tf4):      8(ptr) Variable UniformConstant
-        50(twf1):     19(ptr) Variable UniformConstant
-        54(twf4):     25(ptr) Variable UniformConstant
-              59:             TypePointer Output 13(fvec4)
-60(@entryPointOutput):     59(ptr) Variable Output
+              44:             TypePointer UniformConstant 7
+         45(tf1):     44(ptr) Variable UniformConstant
+         49(tf4):     44(ptr) Variable UniformConstant
+              55:             TypePointer UniformConstant 18
+        56(twf1):     55(ptr) Variable UniformConstant
+              62:             TypePointer UniformConstant 24
+        63(twf4):     62(ptr) Variable UniformConstant
+              70:             TypePointer Output 13(fvec4)
+71(@entryPointOutput):     70(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
-              61:   13(fvec4) FunctionCall 31(@main()
-                              Store 60(@entryPointOutput) 61
+              72:   13(fvec4) FunctionCall 31(@main()
+                              Store 71(@entryPointOutput) 72
                               Return
                               FunctionEnd
   11(Func(t211;):    6(float) Function None 9
@@ -215,14 +222,26 @@
                               FunctionEnd
       31(@main():   13(fvec4) Function None 30
               32:             Label
-              45:    6(float) FunctionCall 11(Func(t211;) 44(tf1)
-              47:   13(fvec4) FunctionCall 16(Func(t21;) 46(tf4)
-              48:   13(fvec4) CompositeConstruct 45 45 45 45
-              49:   13(fvec4) FAdd 48 47
-              51:    6(float) FunctionCall 22(Func(I211;) 50(twf1)
-              52:   13(fvec4) CompositeConstruct 51 51 51 51
-              53:   13(fvec4) FAdd 49 52
-              55:   13(fvec4) FunctionCall 28(Func(I21;) 54(twf4)
-              56:   13(fvec4) FAdd 53 55
-                              ReturnValue 56
+       46(param):      8(ptr) Variable Function
+       50(param):      8(ptr) Variable Function
+       57(param):     19(ptr) Variable Function
+       64(param):     25(ptr) Variable Function
+              47:           7 Load 45(tf1)
+                              Store 46(param) 47
+              48:    6(float) FunctionCall 11(Func(t211;) 46(param)
+              51:           7 Load 49(tf4)
+                              Store 50(param) 51
+              52:   13(fvec4) FunctionCall 16(Func(t21;) 50(param)
+              53:   13(fvec4) CompositeConstruct 48 48 48 48
+              54:   13(fvec4) FAdd 53 52
+              58:          18 Load 56(twf1)
+                              Store 57(param) 58
+              59:    6(float) FunctionCall 22(Func(I211;) 57(param)
+              60:   13(fvec4) CompositeConstruct 59 59 59 59
+              61:   13(fvec4) FAdd 54 60
+              65:          24 Load 63(twf4)
+                              Store 64(param) 65
+              66:   13(fvec4) FunctionCall 28(Func(I21;) 64(param)
+              67:   13(fvec4) FAdd 61 66
+                              ReturnValue 67
                               FunctionEnd
diff --git a/Test/baseResults/remap.invalid-spirv-1.out b/Test/baseResults/remap.invalid-spirv-1.out
new file mode 100644
index 0000000..91b4b6d
--- /dev/null
+++ b/Test/baseResults/remap.invalid-spirv-1.out
@@ -0,0 +1 @@
+ID out of range: 4160749568
diff --git a/Test/baseResults/remap.invalid-spirv-2.out b/Test/baseResults/remap.invalid-spirv-2.out
new file mode 100644
index 0000000..808b9b8
--- /dev/null
+++ b/Test/baseResults/remap.invalid-spirv-2.out
@@ -0,0 +1 @@
+ID not found
diff --git a/Test/baseResults/spv.atomicInt64.comp.out b/Test/baseResults/spv.atomicInt64.comp.out
new file mode 100644
index 0000000..cbd7c1c
--- /dev/null
+++ b/Test/baseResults/spv.atomicInt64.comp.out
@@ -0,0 +1,215 @@
+spv.atomicInt64.comp
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 149
+
+                              Capability Shader
+                              Capability Int64
+                              Capability Int64Atomics
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint GLCompute 4  "main"
+                              ExecutionMode 4 LocalSize 16 16 1
+                              Source GLSL 450
+                              SourceExtension  "GL_ARB_gpu_shader_int64"
+                              SourceExtension  "GL_NV_shader_atomic_int64"
+                              Name 4  "main"
+                              Name 8  "i64"
+                              Name 12  "u64"
+                              Name 14  "Buffer"
+                              MemberName 14(Buffer) 0  "i64"
+                              MemberName 14(Buffer) 1  "u64"
+                              Name 16  "buf"
+                              Name 84  "Struct"
+                              MemberName 84(Struct) 0  "i64"
+                              MemberName 84(Struct) 1  "u64"
+                              Name 86  "s"
+                              MemberDecorate 14(Buffer) 0 Offset 0
+                              MemberDecorate 14(Buffer) 1 Offset 8
+                              Decorate 14(Buffer) BufferBlock
+                              Decorate 16(buf) DescriptorSet 0
+                              Decorate 16(buf) Binding 0
+                              Decorate 148 BuiltIn WorkgroupSize
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeInt 64 1
+               7:             TypePointer Function 6(int)
+               9:      6(int) Constant 0 0
+              10:             TypeInt 64 0
+              11:             TypePointer Function 10(int)
+              13:     10(int) Constant 0 0
+      14(Buffer):             TypeStruct 6(int) 10(int)
+              15:             TypePointer Uniform 14(Buffer)
+         16(buf):     15(ptr) Variable Uniform
+              17:             TypeInt 32 1
+              18:     17(int) Constant 0
+              19:             TypePointer Uniform 6(int)
+              21:      6(int) Constant 4294967272 4294967295
+              22:             TypeInt 32 0
+              23:     22(int) Constant 1
+              24:     22(int) Constant 0
+              28:     17(int) Constant 1
+              29:             TypePointer Uniform 10(int)
+              31:     10(int) Constant 15 0
+      84(Struct):             TypeStruct 6(int) 10(int)
+              85:             TypePointer Workgroup 84(Struct)
+           86(s):     85(ptr) Variable Workgroup
+              87:             TypePointer Workgroup 6(int)
+              92:             TypePointer Workgroup 10(int)
+             146:             TypeVector 22(int) 3
+             147:     22(int) Constant 16
+             148:  146(ivec3) ConstantComposite 147 147 23
+         4(main):           2 Function None 3
+               5:             Label
+          8(i64):      7(ptr) Variable Function
+         12(u64):     11(ptr) Variable Function
+                              Store 8(i64) 9
+                              Store 12(u64) 13
+              20:     19(ptr) AccessChain 16(buf) 18
+              25:      6(int) AtomicSMin 20 23 24 21
+              26:      6(int) Load 8(i64)
+              27:      6(int) IAdd 26 25
+                              Store 8(i64) 27
+              30:     29(ptr) AccessChain 16(buf) 28
+              32:     10(int) AtomicUMin 30 23 24 31
+              33:     10(int) Load 12(u64)
+              34:     10(int) IAdd 33 32
+                              Store 12(u64) 34
+              35:     19(ptr) AccessChain 16(buf) 18
+              36:      6(int) AtomicSMax 35 23 24 21
+              37:      6(int) Load 8(i64)
+              38:      6(int) IAdd 37 36
+                              Store 8(i64) 38
+              39:     29(ptr) AccessChain 16(buf) 28
+              40:     10(int) AtomicUMax 39 23 24 31
+              41:     10(int) Load 12(u64)
+              42:     10(int) IAdd 41 40
+                              Store 12(u64) 42
+              43:     19(ptr) AccessChain 16(buf) 18
+              44:      6(int) AtomicAnd 43 23 24 21
+              45:      6(int) Load 8(i64)
+              46:      6(int) IAdd 45 44
+                              Store 8(i64) 46
+              47:     29(ptr) AccessChain 16(buf) 28
+              48:     10(int) AtomicAnd 47 23 24 31
+              49:     10(int) Load 12(u64)
+              50:     10(int) IAdd 49 48
+                              Store 12(u64) 50
+              51:     19(ptr) AccessChain 16(buf) 18
+              52:      6(int) AtomicOr 51 23 24 21
+              53:      6(int) Load 8(i64)
+              54:      6(int) IAdd 53 52
+                              Store 8(i64) 54
+              55:     29(ptr) AccessChain 16(buf) 28
+              56:     10(int) AtomicOr 55 23 24 31
+              57:     10(int) Load 12(u64)
+              58:     10(int) IAdd 57 56
+                              Store 12(u64) 58
+              59:     19(ptr) AccessChain 16(buf) 18
+              60:      6(int) AtomicXor 59 23 24 21
+              61:      6(int) Load 8(i64)
+              62:      6(int) IAdd 61 60
+                              Store 8(i64) 62
+              63:     29(ptr) AccessChain 16(buf) 28
+              64:     10(int) AtomicXor 63 23 24 31
+              65:     10(int) Load 12(u64)
+              66:     10(int) IAdd 65 64
+                              Store 12(u64) 66
+              67:     19(ptr) AccessChain 16(buf) 18
+              68:      6(int) AtomicIAdd 67 23 24 21
+              69:      6(int) Load 8(i64)
+              70:      6(int) IAdd 69 68
+                              Store 8(i64) 70
+              71:     19(ptr) AccessChain 16(buf) 18
+              72:      6(int) AtomicExchange 71 23 24 21
+              73:      6(int) Load 8(i64)
+              74:      6(int) IAdd 73 72
+                              Store 8(i64) 74
+              75:     19(ptr) AccessChain 16(buf) 18
+              76:      6(int) Load 8(i64)
+              77:      6(int) AtomicCompareExchange 75 23 24 24 76 21
+              78:      6(int) Load 8(i64)
+              79:      6(int) IAdd 78 77
+                              Store 8(i64) 79
+              80:      6(int) Load 8(i64)
+              81:     19(ptr) AccessChain 16(buf) 18
+                              Store 81 80
+              82:     10(int) Load 12(u64)
+              83:     29(ptr) AccessChain 16(buf) 28
+                              Store 83 82
+                              Store 8(i64) 9
+                              Store 12(u64) 13
+              88:     87(ptr) AccessChain 86(s) 18
+              89:      6(int) AtomicSMin 88 23 24 21
+              90:      6(int) Load 8(i64)
+              91:      6(int) IAdd 90 89
+                              Store 8(i64) 91
+              93:     92(ptr) AccessChain 86(s) 28
+              94:     10(int) AtomicUMin 93 23 24 31
+              95:     10(int) Load 12(u64)
+              96:     10(int) IAdd 95 94
+                              Store 12(u64) 96
+              97:     87(ptr) AccessChain 86(s) 18
+              98:      6(int) AtomicSMax 97 23 24 21
+              99:      6(int) Load 8(i64)
+             100:      6(int) IAdd 99 98
+                              Store 8(i64) 100
+             101:     92(ptr) AccessChain 86(s) 28
+             102:     10(int) AtomicUMax 101 23 24 31
+             103:     10(int) Load 12(u64)
+             104:     10(int) IAdd 103 102
+                              Store 12(u64) 104
+             105:     87(ptr) AccessChain 86(s) 18
+             106:      6(int) AtomicAnd 105 23 24 21
+             107:      6(int) Load 8(i64)
+             108:      6(int) IAdd 107 106
+                              Store 8(i64) 108
+             109:     92(ptr) AccessChain 86(s) 28
+             110:     10(int) AtomicAnd 109 23 24 31
+             111:     10(int) Load 12(u64)
+             112:     10(int) IAdd 111 110
+                              Store 12(u64) 112
+             113:     87(ptr) AccessChain 86(s) 18
+             114:      6(int) AtomicOr 113 23 24 21
+             115:      6(int) Load 8(i64)
+             116:      6(int) IAdd 115 114
+                              Store 8(i64) 116
+             117:     92(ptr) AccessChain 86(s) 28
+             118:     10(int) AtomicOr 117 23 24 31
+             119:     10(int) Load 12(u64)
+             120:     10(int) IAdd 119 118
+                              Store 12(u64) 120
+             121:     87(ptr) AccessChain 86(s) 18
+             122:      6(int) AtomicXor 121 23 24 21
+             123:      6(int) Load 8(i64)
+             124:      6(int) IAdd 123 122
+                              Store 8(i64) 124
+             125:     92(ptr) AccessChain 86(s) 28
+             126:     10(int) AtomicXor 125 23 24 31
+             127:     10(int) Load 12(u64)
+             128:     10(int) IAdd 127 126
+                              Store 12(u64) 128
+             129:     87(ptr) AccessChain 86(s) 18
+             130:      6(int) AtomicIAdd 129 23 24 21
+             131:      6(int) Load 8(i64)
+             132:      6(int) IAdd 131 130
+                              Store 8(i64) 132
+             133:     87(ptr) AccessChain 86(s) 18
+             134:      6(int) AtomicExchange 133 23 24 21
+             135:      6(int) Load 8(i64)
+             136:      6(int) IAdd 135 134
+                              Store 8(i64) 136
+             137:     87(ptr) AccessChain 86(s) 18
+             138:      6(int) Load 8(i64)
+             139:      6(int) AtomicCompareExchange 137 23 24 24 138 21
+             140:      6(int) Load 8(i64)
+             141:      6(int) IAdd 140 139
+                              Store 8(i64) 141
+             142:      6(int) Load 8(i64)
+             143:     87(ptr) AccessChain 86(s) 18
+                              Store 143 142
+             144:     10(int) Load 12(u64)
+             145:     92(ptr) AccessChain 86(s) 28
+                              Store 145 144
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/spv.register.subpass.frag.out b/Test/baseResults/spv.register.subpass.frag.out
new file mode 100644
index 0000000..8b7c292
--- /dev/null
+++ b/Test/baseResults/spv.register.subpass.frag.out
@@ -0,0 +1,76 @@
+spv.register.subpass.frag
+// Module Version 10000
+// Generated by (magic number): 80002
+// Id's are bound by 40
+
+                              Capability Shader
+                              Capability StorageImageMultisample
+                              Capability InputAttachment
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 38
+                              ExecutionMode 4 OriginUpperLeft
+                              Source HLSL 500
+                              Name 4  "main"
+                              Name 9  "@main("
+                              Name 12  "result00"
+                              Name 15  "subpass_f4"
+                              Name 22  "result10"
+                              Name 25  "subpass_ms_f4"
+                              Name 29  "result73"
+                              Name 30  "subpass_2"
+                              Name 38  "@entryPointOutput"
+                              Decorate 15(subpass_f4) DescriptorSet 0
+                              Decorate 15(subpass_f4) Binding 21
+                              Decorate 15(subpass_f4) InputAttachmentIndex 1
+                              Decorate 25(subpass_ms_f4) DescriptorSet 0
+                              Decorate 25(subpass_ms_f4) Binding 20
+                              Decorate 25(subpass_ms_f4) InputAttachmentIndex 4
+                              Decorate 30(subpass_2) DescriptorSet 0
+                              Decorate 30(subpass_2) Binding 22
+                              Decorate 30(subpass_2) InputAttachmentIndex 7
+                              Decorate 38(@entryPointOutput) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypeVector 6(float) 4
+               8:             TypeFunction 7(fvec4)
+              11:             TypePointer Function 7(fvec4)
+              13:             TypeImage 6(float) SubpassData nonsampled format:Unknown
+              14:             TypePointer UniformConstant 13
+  15(subpass_f4):     14(ptr) Variable UniformConstant
+              17:             TypeInt 32 1
+              18:     17(int) Constant 0
+              19:             TypeVector 17(int) 2
+              20:   19(ivec2) ConstantComposite 18 18
+              23:             TypeImage 6(float) SubpassData multi-sampled nonsampled format:Unknown
+              24:             TypePointer UniformConstant 23
+25(subpass_ms_f4):     24(ptr) Variable UniformConstant
+              27:     17(int) Constant 3
+   30(subpass_2):     14(ptr) Variable UniformConstant
+              33:    6(float) Constant 0
+              34:    7(fvec4) ConstantComposite 33 33 33 33
+              37:             TypePointer Output 7(fvec4)
+38(@entryPointOutput):     37(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+              39:    7(fvec4) FunctionCall 9(@main()
+                              Store 38(@entryPointOutput) 39
+                              Return
+                              FunctionEnd
+       9(@main():    7(fvec4) Function None 8
+              10:             Label
+    12(result00):     11(ptr) Variable Function
+    22(result10):     11(ptr) Variable Function
+    29(result73):     11(ptr) Variable Function
+              16:          13 Load 15(subpass_f4)
+              21:    7(fvec4) ImageRead 16 20
+                              Store 12(result00) 21
+              26:          23 Load 25(subpass_ms_f4)
+              28:    7(fvec4) ImageRead 26 20 Sample 27
+                              Store 22(result10) 28
+              31:          13 Load 30(subpass_2)
+              32:    7(fvec4) ImageRead 31 20
+                              Store 29(result73) 32
+                              ReturnValue 34
+                              FunctionEnd
diff --git a/Test/hlsl.array.frag b/Test/hlsl.array.frag
index 1abba89..ff0004f 100644
--- a/Test/hlsl.array.frag
+++ b/Test/hlsl.array.frag
@@ -4,8 +4,15 @@
     float4 m[7];
 } s[11];
 
-float4 PixelShaderFunction(int i, float4 input[3]) : COLOR0
+static float4 C = float4(1,2,3,4);
+float4 a1[1] = { float4(1,2,3,4) };
+float4 a2[2] = { float4(1,2,3,4), float4(5,2,3,4), };
+const float4 c1[1] = { float4(1,2,3,4) };
+static const float4 c2[2] = { C, float4(1,2,3,4), };
+
+float4 PixelShaderFunction(int i : sem1, float4 input[3] : sem2) : SV_TARGET0
 {
-    float4 b[10];
-    return a[1] + a[i] + input[2] + input[i] + b[5] + b[i] + s[i].m[i];
-}
\ No newline at end of file
+    float4 b[10] = { C, C, C, C, C, C, C, C, C, C };
+    float4 tmp = C + a1[0] + c1[0] + a2[i] + c2[i];
+    return a[1] + a[i] + input[2] + input[i] + b[5] + b[i] + s[i].m[i] + tmp;
+}
diff --git a/Test/hlsl.attributeC11.frag b/Test/hlsl.attributeC11.frag
new file mode 100644
index 0000000..4fe663a
--- /dev/null
+++ b/Test/hlsl.attributeC11.frag
@@ -0,0 +1,18 @@
+struct S {

+    float2 f;

+};

+

+[[vk::binding(1)]]

+StructuredBuffer<S> buffer1;

+

+[[vk::binding(3, 2)]]

+StructuredBuffer<S> buffer3;

+

+[[vk::input_attachment_index(4)]]

+Texture2D<float4> attach;

+

+[[vk::location(7)]] float4

+main([[vk::location(8)]] float4 input: A) : B

+{

+    return input + attach.Load(float2(0.5));

+}

diff --git a/Test/hlsl.constantbuffer.frag b/Test/hlsl.constantbuffer.frag
index d7a6ef5..c2b3a00 100644
--- a/Test/hlsl.constantbuffer.frag
+++ b/Test/hlsl.constantbuffer.frag
@@ -21,6 +21,6 @@
     if (cb3[1][2].x)
         return cb1.x + cb2[1].y + c1;
     else
-        return cb3[2][3].y;
+        return cb3[1][3].y;
 }
 
diff --git a/Test/hlsl.flattenOpaqueInit.vert b/Test/hlsl.flattenOpaqueInit.vert
index 75d28a9..bcf39ce 100644
--- a/Test/hlsl.flattenOpaqueInit.vert
+++ b/Test/hlsl.flattenOpaqueInit.vert
@@ -18,5 +18,6 @@
 {

     FxaaTex tex1 = { g_tInputTexture_sampler, g_tInputTexture };

     FxaaTex tex2 = fillOpaque();

-    return lookUp(tex1);

-}
\ No newline at end of file
+    FxaaTex tex3 = tex1;
+    return lookUp(tex3);

+}
diff --git a/Test/hlsl.flattenSubset.frag b/Test/hlsl.flattenSubset.frag
new file mode 100755
index 0000000..c80e093
--- /dev/null
+++ b/Test/hlsl.flattenSubset.frag
@@ -0,0 +1,36 @@
+struct S0

+{

+    int x;

+    int y;

+    SamplerState ss;

+};

+

+struct S1

+{

+    float b;

+    SamplerState samplerState;

+    S0 s0;

+    int a;

+};

+

+struct S2

+{

+    int a1;

+    int a2;

+    int a3;

+    int a4;

+    int a5;

+    S1 resources;

+};

+

+SamplerState samp;

+Texture2D tex;

+

+float4 main(float4 vpos : VPOS) : COLOR0

+{

+    S1 s1;

+    S2 s2;

+    s1.s0.ss = samp;

+    s2.resources = s1;

+    return tex.Sample(s2.resources.s0.ss, float2(0.5));

+}

diff --git a/Test/hlsl.flattenSubset2.frag b/Test/hlsl.flattenSubset2.frag
new file mode 100755
index 0000000..753475d
--- /dev/null
+++ b/Test/hlsl.flattenSubset2.frag
@@ -0,0 +1,24 @@
+struct Nested { float y; Texture2D texNested; };

+struct A { Nested n; float x; };

+struct B { Nested n; Texture2D tex; };

+

+Texture2D someTex;

+

+float4 main(float4 vpos : VPOS) : COLOR0

+{

+    A a1, a2;

+    B b;

+

+    // Assignment of nested structs to nested structs

+    a1.n = a2.n;

+    b .n = a1.n;

+

+    // Assignment of nested struct to standalone

+    Nested n = b.n; 

+

+    // Assignment to nestested struct members

+    a2.n.texNested = someTex;

+    a1.n.y = 1.0;

+

+    return float4(0,0,0,0);

+}

diff --git a/Test/hlsl.hull.4.tesc b/Test/hlsl.hull.4.tesc
new file mode 100644
index 0000000..cd2b094
--- /dev/null
+++ b/Test/hlsl.hull.4.tesc
@@ -0,0 +1,43 @@
+
+// Test mixed InputPatch structure: user and builtin members.  Hull shaders involve extra
+// logic in this case due to patch constant function call synthesis.
+
+// This example tests the main EP and the PCF EP both having an input patch.
+
+struct HS_Main_Output
+{ 
+    float4 m_Position : SV_POSITION ; 
+}; 
+
+struct HS_Output 
+{ 
+    float fTessFactor [ 3 ] : SV_TessFactor ; 
+    float fInsideTessFactor : SV_InsideTessFactor ; 
+}; 
+
+struct HS_Input 
+{ 
+    float4 m_Position : SV_POSITION; 
+    float4 m_Normal   : TEXCOORD2; 
+}; 
+
+HS_Output HS_ConstFunc ( InputPatch < HS_Input , 3 > I ) 
+{ 
+    HS_Output O = (HS_Output)0;
+
+    O.fInsideTessFactor = I [ 0 ].m_Position.w + I [ 0 ].m_Normal.w;
+
+    return O;
+} 
+
+[ domain ( "tri" ) ] 
+[ partitioning ( "fractional_odd" ) ] 
+[ outputtopology ( "triangle_cw" ) ] 
+[ patchconstantfunc ( "HS_ConstFunc" ) ] 
+[ outputcontrolpoints ( 3 ) ] 
+HS_Main_Output main( InputPatch < HS_Input , 3 > I , uint cpid : SV_OutputControlPointID ) 
+{ 
+    HS_Main_Output output = ( HS_Main_Output ) 0 ; 
+    output.m_Position = 0;
+    return output ; 
+}
diff --git a/Test/hlsl.hull.5.tesc b/Test/hlsl.hull.5.tesc
new file mode 100644
index 0000000..c9e511e
--- /dev/null
+++ b/Test/hlsl.hull.5.tesc
@@ -0,0 +1,43 @@
+
+// Test mixed InputPatch structure: user and builtin members.  Hull shaders involve extra
+// logic in this case due to patch constant function call synthesis.
+
+// This example tests the PCF EP having an InputPatch, but the main EP does not.
+
+struct HS_Main_Output
+{ 
+    float4 m_Position : SV_POSITION ; 
+}; 
+
+struct HS_Output 
+{ 
+    float fTessFactor [ 3 ] : SV_TessFactor ; 
+    float fInsideTessFactor : SV_InsideTessFactor ; 
+}; 
+
+struct HS_Input 
+{ 
+    float4 m_Position : SV_POSITION; 
+    float4 m_Normal   : TEXCOORD2; 
+}; 
+
+HS_Output HS_ConstFunc ( InputPatch < HS_Input , 3 > I ) 
+{ 
+    HS_Output O = (HS_Output)0;
+
+    O.fInsideTessFactor = I [ 0 ].m_Position.w + I [ 0 ].m_Normal.w;
+
+    return O;
+} 
+
+[ domain ( "tri" ) ] 
+[ partitioning ( "fractional_odd" ) ] 
+[ outputtopology ( "triangle_cw" ) ] 
+[ patchconstantfunc ( "HS_ConstFunc" ) ] 
+[ outputcontrolpoints ( 3 ) ] 
+HS_Main_Output main( uint cpid : SV_OutputControlPointID ) 
+{ 
+    HS_Main_Output output = ( HS_Main_Output ) 0 ; 
+    output.m_Position = 0;
+    return output ; 
+}
diff --git a/Test/hlsl.localStructuredBuffer.comp b/Test/hlsl.localStructuredBuffer.comp
new file mode 100644
index 0000000..34e06e0
--- /dev/null
+++ b/Test/hlsl.localStructuredBuffer.comp
@@ -0,0 +1,4 @@
+RWStructuredBuffer<uint> srt0;

+void main() {

+    RWStructuredBuffer<uint> srt0Local = srt0;

+}
\ No newline at end of file
diff --git a/Test/hlsl.samplecmp.dualmode.frag b/Test/hlsl.samplecmp.dualmode.frag
new file mode 100644
index 0000000..5b600f3
--- /dev/null
+++ b/Test/hlsl.samplecmp.dualmode.frag
@@ -0,0 +1,14 @@
+SamplerState g_sSamp : register(s0);
+SamplerComparisonState g_sSampCmp : register(s1);
+
+uniform Texture1D <float4> g_tTex : register(t3);
+
+float4 main() : SV_Target0
+{
+    // This texture is used with both shadow modes.  It will need post-compilation
+    // legalization.
+    g_tTex.SampleCmp(g_sSampCmp, 0.1, 0.75);
+    g_tTex.Sample(g_sSamp, 0.1);
+
+    return 0;
+}
diff --git a/Test/hlsl.samplecmp.negative.frag b/Test/hlsl.samplecmp.negative.frag
index cea87bd..8851982 100644
--- a/Test/hlsl.samplecmp.negative.frag
+++ b/Test/hlsl.samplecmp.negative.frag
@@ -1,4 +1,5 @@
 
+Texture2D g_nonShadowTex;
 Texture2D g_shadowTex;
 SamplerState g_shadowSampler;
 SamplerComparisonState g_shadowSamplerComp;
@@ -6,7 +7,7 @@
 float4 main() : SV_Target0
 {
     g_shadowTex.SampleCmp(g_shadowSamplerComp, float2(0,0), 0); // OK
-    g_shadowTex.SampleCmp(g_shadowSampler, float2(0,0), 0);     // ERROR (should be comparison sampler)
+    g_nonShadowTex.SampleCmp(g_shadowSampler, float2(0,0), 0);     // ERROR (should be comparison sampler)
 
     return 0;
 }
diff --git a/Test/hlsl.subpass.frag b/Test/hlsl.subpass.frag
new file mode 100644
index 0000000..20a717f
--- /dev/null
+++ b/Test/hlsl.subpass.frag
@@ -0,0 +1,113 @@
+
+layout(input_attachment_index = 1) SubpassInput<float4> subpass_f4 : register(t1);
+layout(input_attachment_index = 2) SubpassInput<int4>   subpass_i4;
+layout(input_attachment_index = 3) SubpassInput<uint4>  subpass_u4;
+
+layout(input_attachment_index = 4) SubpassInputMS<float4> subpass_ms_f4;
+layout(input_attachment_index = 5) SubpassInputMS<int4>   subpass_ms_i4;
+layout(input_attachment_index = 6) SubpassInputMS<uint4>  subpass_ms_u4;
+
+layout(input_attachment_index = 1) SubpassInput<float3> subpass_f3;
+layout(input_attachment_index = 2) SubpassInput<int3>   subpass_i3;
+layout(input_attachment_index = 3) SubpassInput<uint3>  subpass_u3;
+
+layout(input_attachment_index = 4) SubpassInputMS<float3> subpass_ms_f3;
+layout(input_attachment_index = 5) SubpassInputMS<int3>   subpass_ms_i3;
+layout(input_attachment_index = 6) SubpassInputMS<uint3>  subpass_ms_u3;
+
+layout(input_attachment_index = 1) SubpassInput<float2> subpass_f2;
+layout(input_attachment_index = 2) SubpassInput<int2>   subpass_i2;
+layout(input_attachment_index = 3) SubpassInput<uint2>  subpass_u2;
+
+layout(input_attachment_index = 4) SubpassInputMS<float2> subpass_ms_f2;
+layout(input_attachment_index = 5) SubpassInputMS<int2>   subpass_ms_i2;
+layout(input_attachment_index = 6) SubpassInputMS<uint2>  subpass_ms_u2;
+
+layout(input_attachment_index = 1) SubpassInput<float> subpass_f;
+layout(input_attachment_index = 2) SubpassInput<int>   subpass_i;
+layout(input_attachment_index = 3) SubpassInput<uint>  subpass_u;
+
+layout(input_attachment_index = 4) SubpassInputMS<float> subpass_ms_f;
+layout(input_attachment_index = 5) SubpassInputMS<int>   subpass_ms_i;
+layout(input_attachment_index = 6) SubpassInputMS<uint>  subpass_ms_u;
+
+[[vk::input_attachment_index(7)]] SubpassInput subpass_2;
+
+struct mystruct_f_t
+{
+    float  c0;
+    float2 c1;
+    float  c2;
+};
+
+struct mystruct_i_t
+{
+    int  c0;
+    int2 c1;
+    int  c2;
+};
+
+struct mystruct_u_t
+{
+    uint  c0;
+    uint2 c1;
+    uint  c2;
+};
+
+// TODO: ...
+// layout(input_attachment_index = 7) SubpassInput<mystruct_f_t>    subpass_fs;
+// layout(input_attachment_index = 8) SubpassInputMS<mystruct_f_t>  subpass_ms_fs;
+
+// layout(input_attachment_index = 7) SubpassInput<mystruct_i_t>    subpass_is;
+// layout(input_attachment_index = 8) SubpassInputMS<mystruct_i_t>  subpass_ms_is;
+
+// layout(input_attachment_index = 7) SubpassInput<mystruct_u_t>    subpass_us;
+// layout(input_attachment_index = 8) SubpassInputMS<mystruct_u_t>  subpass_ms_us;
+
+float4 main() : SV_Target0
+{
+    float4 result00 = subpass_f4.SubpassLoad();
+    int4   result01 = subpass_i4.SubpassLoad();
+    uint4  result02 = subpass_u4.SubpassLoad();
+
+    float4 result10 = subpass_ms_f4.SubpassLoad(3);
+    int4   result11 = subpass_ms_i4.SubpassLoad(3);
+    uint4  result12 = subpass_ms_u4.SubpassLoad(3);
+
+    float3 result20 = subpass_f3.SubpassLoad();
+    int3   result21 = subpass_i3.SubpassLoad();
+    uint3  result22 = subpass_u3.SubpassLoad();
+
+    float3 result30 = subpass_ms_f3.SubpassLoad(3);
+    int3   result31 = subpass_ms_i3.SubpassLoad(3);
+    uint3  result32 = subpass_ms_u3.SubpassLoad(3);
+
+    float2 result40 = subpass_f2.SubpassLoad();
+    int2   result41 = subpass_i2.SubpassLoad();
+    uint2  result42 = subpass_u2.SubpassLoad();
+
+    float2 result50 = subpass_ms_f2.SubpassLoad(2);
+    int2   result51 = subpass_ms_i2.SubpassLoad(2);
+    uint2  result52 = subpass_ms_u2.SubpassLoad(2);
+
+    float  result60 = subpass_f.SubpassLoad();
+    int    result61 = subpass_i.SubpassLoad();
+    uint   result62 = subpass_u.SubpassLoad();
+
+    float  result70 = subpass_ms_f.SubpassLoad(2);
+    int    result71 = subpass_ms_i.SubpassLoad(2);
+    uint   result72 = subpass_ms_u.SubpassLoad(2);
+
+    float4 result73 = subpass_2.SubpassLoad();
+
+    // TODO: 
+    // mystruct_f_t result80 = subpass_fs.SubpassLoad();
+    // mystruct_i_t result81 = subpass_is.SubpassLoad();
+    // mystruct_u_t result82 = subpass_us.SubpassLoad();
+
+    // mystruct_f_t result90 = subpass_ms_sf.SubpassLoad(2);
+    // mystruct_i_t result91 = subpass_ms_if.SubpassLoad(2);
+    // mystruct_u_t result92 = subpass_ms_uf.SubpassLoad(2);
+
+    return 0;
+}
diff --git a/Test/remap.invalid-spirv-1.spv b/Test/remap.invalid-spirv-1.spv
new file mode 100644
index 0000000..e5d59d4
--- /dev/null
+++ b/Test/remap.invalid-spirv-1.spv
Binary files differ
diff --git a/Test/remap.invalid-spirv-2.spv b/Test/remap.invalid-spirv-2.spv
new file mode 100644
index 0000000..df8c96d
--- /dev/null
+++ b/Test/remap.invalid-spirv-2.spv
Binary files differ
diff --git a/Test/runtests b/Test/runtests
index 353ba6b..24d4004 100755
--- a/Test/runtests
+++ b/Test/runtests
@@ -3,6 +3,7 @@
 TARGETDIR=localResults
 BASEDIR=baseResults
 EXE=../build/install/bin/glslangValidator
+REMAPEXE=../build/install/bin/spirv-remap
 HASERROR=0
 mkdir -p localResults
 
@@ -31,11 +32,11 @@
 echo Running reflection...
 $EXE -l -q -C reflection.vert > $TARGETDIR/reflection.vert.out
 diff -b $BASEDIR/reflection.vert.out $TARGETDIR/reflection.vert.out || HASERROR=1
-$EXE -D -e flizv -l -q -C -V hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out
+$EXE -D -e flizv -l -q -C -V -Od hlsl.reflection.vert > $TARGETDIR/hlsl.reflection.vert.out
 diff -b $BASEDIR/hlsl.reflection.vert.out $TARGETDIR/hlsl.reflection.vert.out || HASERROR=1
-$EXE -D -e main -l -q -C -V hlsl.reflection.binding.frag > $TARGETDIR/hlsl.reflection.binding.frag.out
+$EXE -D -e main -l -q -C -V -Od hlsl.reflection.binding.frag > $TARGETDIR/hlsl.reflection.binding.frag.out
 diff -b $BASEDIR/hlsl.reflection.binding.frag.out $TARGETDIR/hlsl.reflection.binding.frag.out || HASERROR=1
-$EXE -D -e main -l -q --hlsl-iomap --auto-map-bindings --stb 10 --sbb 20 --ssb 30 --suavb 40 --scb 50 -D -V -e main hlsl.automap.frag > $TARGETDIR/hlsl.automap.frag.out
+$EXE -D -e main -l -q --hlsl-iomap --auto-map-bindings --stb 10 --sbb 20 --ssb 30 --suavb 40 --scb 50 -D -V -e main -Od hlsl.automap.frag > $TARGETDIR/hlsl.automap.frag.out
 diff -b $BASEDIR/hlsl.automap.frag.out $TARGETDIR/hlsl.automap.frag.out || HASERROR=1
 
 #
@@ -55,14 +56,14 @@
 # entry point renaming tests
 #
 echo Running entry-point renaming tests
-$EXE -i -H -V -D -e main_in_spv --ku --source-entrypoint main hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out
+$EXE -i -H -V -D -e main_in_spv --ku --source-entrypoint main -Od hlsl.entry.rename.frag > $TARGETDIR/hlsl.entry.rename.frag.out
 diff -b $BASEDIR/hlsl.entry.rename.frag.out $TARGETDIR/hlsl.entry.rename.frag.out || HASERROR=1
 
 #
 # Testing ill-defined uncalled function
 #
 echo Running ill-defined uncalled function
-$EXE -D -e main -H hlsl.deadFunctionMissingBody.vert > $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out
+$EXE -D -e main -H -Od hlsl.deadFunctionMissingBody.vert > $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out
 diff -b $BASEDIR/hlsl.deadFunctionMissingBody.vert.out $TARGETDIR/hlsl.deadFunctionMissingBody.vert.out || HASERROR=1
 
 if [ $HASERROR -eq 0 ]
@@ -87,20 +88,20 @@
 diff -b $BASEDIR/spv.hlslOffsets.vert.out $TARGETDIR/spv.hlslOffsets.vert.out || HASERROR=1
 
 echo Running hlsl offsets
-$EXE -i  --hlsl-offsets -D -e main -H hlsl.hlslOffset.vert > $TARGETDIR/hlsl.hlslOffset.vert.out
+$EXE -i  --hlsl-offsets -D -e main -H -Od hlsl.hlslOffset.vert > $TARGETDIR/hlsl.hlslOffset.vert.out
 diff -b $BASEDIR/hlsl.hlslOffset.vert.out $TARGETDIR/hlsl.hlslOffset.vert.out || HASERROR=1
 
 #
 # Testing --resource-set-binding
 #
 echo Configuring HLSL descriptor set and binding number manually
-$EXE -V -D -e main -H hlsl.multiDescriptorSet.frag --rsb frag t0 0 0 t1 1 0 s0 0 1 s1 1 1 b0 2 0 b1 2 1 b2 2 2 > $TARGETDIR/hlsl.multiDescriptorSet.frag.out
+$EXE -V -D -e main -H -Od hlsl.multiDescriptorSet.frag --rsb frag t0 0 0 t1 1 0 s0 0 1 s1 1 1 b0 2 0 b1 2 1 b2 2 2 > $TARGETDIR/hlsl.multiDescriptorSet.frag.out
 diff -b $BASEDIR/hlsl.multiDescriptorSet.frag.out $TARGETDIR/hlsl.multiDescriptorSet.frag.out || HASERROR=1
 
-$EXE -V -D -e main -H hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb 4 > $TARGETDIR/hlsl.explicitDescriptorSet.frag.out
+$EXE -V -D -e main -H -Od hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb 4 > $TARGETDIR/hlsl.explicitDescriptorSet.frag.out
 diff -b $BASEDIR/hlsl.explicitDescriptorSet.frag.out $TARGETDIR/hlsl.explicitDescriptorSet.frag.out || HASERROR=1
 
-$EXE -V -D -e main -H hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb frag 3 > $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out
+$EXE -V -D -e main -H -Od hlsl.explicitDescriptorSet.frag --hlsl-iomap --amb --ssb 10 --stb 20 --rsb frag 3 > $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out
 diff -b $BASEDIR/hlsl.explicitDescriptorSet-2.frag.out $TARGETDIR/hlsl.explicitDescriptorSet-2.frag.out || HASERROR=1
 
 #
@@ -125,33 +126,35 @@
      -G -H spv.debugInfo.frag --rsb frag 3 > $TARGETDIR/spv.debugInfo.1.1.frag.out
 diff -b $BASEDIR/spv.debugInfo.1.1.frag.out $TARGETDIR/spv.debugInfo.1.1.frag.out || HASERROR=1
 $EXE -g -D -e newMain -g --amb --aml --fua --hlsl-iomap --nsf --sib 1 --ssb 2 --sbb 3 --stb 4 --suavb 5 --sub 6 \
-     --sep origMain -H spv.hlslDebugInfo.vert --rsb vert t0 0 0 > $TARGETDIR/spv.hlslDebugInfo.frag.out
+     --sep origMain -H -Od spv.hlslDebugInfo.vert --rsb vert t0 0 0 > $TARGETDIR/spv.hlslDebugInfo.frag.out
 diff -b $BASEDIR/spv.hlslDebugInfo.frag.out $TARGETDIR/spv.hlslDebugInfo.frag.out || HASERROR=1
 
 #
 # Testing Includer
 #
 echo Testing Includer
-$EXE -D -e main -H ../Test/hlsl.include.vert > $TARGETDIR/hlsl.include.vert.out
+$EXE -D -e main -H -Od ../Test/hlsl.include.vert > $TARGETDIR/hlsl.include.vert.out
 diff -b $BASEDIR/hlsl.include.vert.out $TARGETDIR/hlsl.include.vert.out || HASERROR=1
-$EXE -D -e main -H hlsl.includeNegative.vert > $TARGETDIR/hlsl.includeNegative.vert.out
+$EXE -D -e main -H -Od hlsl.includeNegative.vert > $TARGETDIR/hlsl.includeNegative.vert.out
 diff -b $BASEDIR/hlsl.includeNegative.vert.out $TARGETDIR/hlsl.includeNegative.vert.out || HASERROR=1
 $EXE -l -i include.vert > $TARGETDIR/include.vert.out
 diff -b $BASEDIR/include.vert.out $TARGETDIR/include.vert.out || HASERROR=1
-$EXE -D -e main -H -Iinc1/path1 -Iinc1/path2 hlsl.dashI.vert > $TARGETDIR/hlsl.dashI.vert.out
+$EXE -D -e main -H -Od -Iinc1/path1 -Iinc1/path2 hlsl.dashI.vert > $TARGETDIR/hlsl.dashI.vert.out
 diff -b $BASEDIR/hlsl.dashI.vert.out $TARGETDIR/hlsl.dashI.vert.out || HASERROR=1
 
 #
 # Testing -D and -U
 #
+echo "Testing -D and -U"
 $EXE -DUNDEFED -UIN_SHADER -DFOO=200 -i -l -UUNDEFED -DMUL=FOO*2 glsl.-D-U.frag > $TARGETDIR/glsl.-D-U.frag.out
 diff -b $BASEDIR/glsl.-D-U.frag.out $TARGETDIR/glsl.-D-U.frag.out || HASERROR=1
-$EXE -D -e main -V -i -DUNDEFED -UIN_SHADER -DFOO=200 -UUNDEFED hlsl.-D-U.frag > $TARGETDIR/hlsl.-D-U.frag.out
+$EXE -D -e main -V -i -DUNDEFED -UIN_SHADER -DFOO=200 -UUNDEFED -Od hlsl.-D-U.frag > $TARGETDIR/hlsl.-D-U.frag.out
 diff -b $BASEDIR/hlsl.-D-U.frag.out $TARGETDIR/hlsl.-D-U.frag.out || HASERROR=1
 
 #
 # Test --client and --target-env
 #
+echo "Testing --client and --target-env"
 $EXE --client vulkan100      spv.targetVulkan.vert || HASERROR=1
 $EXE --client opengl100      spv.targetOpenGL.vert || HASERROR=1
 $EXE --target-env vulkan1.0  spv.targetVulkan.vert || HASERROR=1
@@ -163,6 +166,7 @@
 #
 # Testing GLSL entry point rename
 #
+echo "Testing GLSL entry point rename"
 $EXE -H -e foo --source-entrypoint main glsl.entryPointRename.vert > $TARGETDIR/glsl.entryPointRename.vert.out
 diff -b $BASEDIR/glsl.entryPointRename.vert.out $TARGETDIR/glsl.entryPointRename.vert.out || HASERROR=1
 $EXE -H -e foo --source-entrypoint bar glsl.entryPointRename.vert > $TARGETDIR/glsl.entryPointRename.vert.bad.out
@@ -171,6 +175,15 @@
 diff -b $BASEDIR/glsl.entryPointRename2.vert.out $TARGETDIR/glsl.entryPointRename2.vert.out || HASERROR=1
 
 #
+# Testing remapper error handling
+#
+echo "Testing remapper error handling"
+$REMAPEXE --do-everything -i remap.invalid-spirv-1.spv -o $TARGETDIR > $TARGETDIR/remap.invalid-spirv-1.out && HASERROR=1
+diff -b $BASEDIR/remap.invalid-spirv-1.out $TARGETDIR/remap.invalid-spirv-1.out || HASERROR=1
+$REMAPEXE --do-everything -i remap.invalid-spirv-2.spv -o $TARGETDIR > $TARGETDIR/remap.invalid-spirv-2.out && HASERROR=1
+diff -b $BASEDIR/remap.invalid-spirv-2.out $TARGETDIR/remap.invalid-spirv-2.out || HASERROR=1
+
+#
 # Final checking
 #
 if [ $HASERROR -eq 0 ]
diff --git a/Test/spv.atomicInt64.comp b/Test/spv.atomicInt64.comp
new file mode 100644
index 0000000..a56c7ec
--- /dev/null
+++ b/Test/spv.atomicInt64.comp
@@ -0,0 +1,79 @@
+#version 450 core

+

+#extension GL_ARB_gpu_shader_int64: enable

+#extension GL_NV_shader_atomic_int64: enable

+

+layout(local_size_x = 16, local_size_y = 16) in;

+

+layout(binding = 0) buffer Buffer

+{

+    int64_t  i64;

+    uint64_t u64;

+} buf;

+

+struct Struct

+{

+    int64_t  i64;

+    uint64_t u64;

+};

+

+shared Struct s;

+

+void main()

+{

+    const int64_t  i64c = -24;

+    const uint64_t u64c = 0xF00000000F; 

+

+    // Test shader storage block

+    int64_t  i64 = 0;

+    uint64_t u64 = 0;

+

+    i64 += atomicMin(buf.i64, i64c);

+    u64 += atomicMin(buf.u64, u64c);

+

+    i64 += atomicMax(buf.i64, i64c);

+    u64 += atomicMax(buf.u64, u64c);

+

+    i64 += atomicAnd(buf.i64, i64c);

+    u64 += atomicAnd(buf.u64, u64c);

+

+    i64 += atomicOr(buf.i64, i64c);

+    u64 += atomicOr(buf.u64, u64c);

+

+    i64 += atomicXor(buf.i64, i64c);

+    u64 += atomicXor(buf.u64, u64c);

+

+    i64 += atomicAdd(buf.i64, i64c);

+    i64 += atomicExchange(buf.i64, i64c);

+    i64 += atomicCompSwap(buf.i64, i64c, i64);

+

+    buf.i64 = i64;

+    buf.u64 = u64;

+

+    // Test shared variable

+    i64 = 0;

+    u64 = 0;

+

+    i64 += atomicMin(s.i64, i64c);

+    u64 += atomicMin(s.u64, u64c);

+

+    i64 += atomicMax(s.i64, i64c);

+    u64 += atomicMax(s.u64, u64c);

+

+    i64 += atomicAnd(s.i64, i64c);

+    u64 += atomicAnd(s.u64, u64c);

+

+    i64 += atomicOr(s.i64, i64c);

+    u64 += atomicOr(s.u64, u64c);

+

+    i64 += atomicXor(s.i64, i64c);

+    u64 += atomicXor(s.u64, u64c);

+

+    i64 += atomicAdd(s.i64, i64c);

+    i64 += atomicExchange(s.i64, i64c);

+    i64 += atomicCompSwap(s.i64, i64c, i64);

+

+    s.i64 = i64;

+    s.u64 = u64;

+}

+

diff --git a/Test/spv.register.subpass.frag b/Test/spv.register.subpass.frag
new file mode 100644
index 0000000..281c2f7
--- /dev/null
+++ b/Test/spv.register.subpass.frag
@@ -0,0 +1,15 @@
+
+// Test binding autoassignment and offset for SubpassInput objects
+
+layout(input_attachment_index = 1) SubpassInput<float4> subpass_f4 : register(t1);
+layout(input_attachment_index = 4) SubpassInputMS<float4> subpass_ms_f4;
+[[vk::input_attachment_index(7)]] SubpassInput subpass_2;
+
+float4 main() : SV_Target0
+{
+    float4 result00 = subpass_f4.SubpassLoad();
+    float4 result10 = subpass_ms_f4.SubpassLoad(3);
+    float4 result73 = subpass_2.SubpassLoad();
+
+    return 0;
+}
diff --git a/glslang/Include/intermediate.h b/glslang/Include/intermediate.h
index 1d98d01..f0cda5f 100644
--- a/glslang/Include/intermediate.h
+++ b/glslang/Include/intermediate.h
@@ -1133,6 +1133,7 @@
         constSubtree(nullptr)
           { name = n; }
     virtual int getId() const { return id; }
+    virtual void setId(int newId) { id = newId; }
     virtual const TString& getName() const { return name; }
     virtual void traverse(TIntermTraverser*);
     virtual       TIntermSymbol* getAsSymbolNode()       { return this; }
@@ -1440,7 +1441,7 @@
 };
 
 typedef TVector<TIntermNode*> TIntermSequence;
-typedef TVector<int> TQualifierList;
+typedef TVector<TStorageQualifier> TQualifierList;
 //
 // Nodes that operate on an arbitrary sized set of children.
 //
diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp
index 24d070b..bad9244 100644
--- a/glslang/MachineIndependent/Initialize.cpp
+++ b/glslang/MachineIndependent/Initialize.cpp
@@ -927,6 +927,32 @@
             "\n");
     }
 
+#ifdef NV_EXTENSIONS
+    if (profile != EEsProfile && version >= 440) {
+        commonBuiltins.append(
+            "uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t);"
+            " int64_t atomicMin(coherent volatile inout  int64_t,  int64_t);"
+
+            "uint64_t atomicMax(coherent volatile inout uint64_t, uint64_t);"
+            " int64_t atomicMax(coherent volatile inout  int64_t,  int64_t);"
+
+            "uint64_t atomicAnd(coherent volatile inout uint64_t, uint64_t);"
+            " int64_t atomicAnd(coherent volatile inout  int64_t,  int64_t);"
+
+            "uint64_t atomicOr (coherent volatile inout uint64_t, uint64_t);"
+            " int64_t atomicOr (coherent volatile inout  int64_t,  int64_t);"
+
+            "uint64_t atomicXor(coherent volatile inout uint64_t, uint64_t);"
+            " int64_t atomicXor(coherent volatile inout  int64_t,  int64_t);"
+
+            " int64_t atomicAdd(coherent volatile inout int64_t, int64_t);"
+            " int64_t atomicExchange(coherent volatile inout int64_t, int64_t);"
+            " int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t);"
+
+            "\n");
+    }
+#endif
+
     if ((profile == EEsProfile && version >= 310) ||
         (profile != EEsProfile && version >= 450)) {
         commonBuiltins.append(
@@ -1328,10 +1354,25 @@
 
     if (profile == EEsProfile) {
         if (spvVersion.spv == 0) {
+            if (version < 300) {
+                commonBuiltins.append(
+                    "vec4 texture2D(samplerExternalOES, vec2 coord);" // GL_OES_EGL_image_external
+                    "vec4 texture2DProj(samplerExternalOES, vec3);"   // GL_OES_EGL_image_external
+                    "vec4 texture2DProj(samplerExternalOES, vec4);"   // GL_OES_EGL_image_external
+                "\n");
+            } else {
+                commonBuiltins.append(
+                    "highp ivec2 textureSize(samplerExternalOES, int lod);"   // GL_OES_EGL_image_external_essl3
+                    "vec4 texture(samplerExternalOES, vec2);"                 // GL_OES_EGL_image_external_essl3
+                    "vec4 texture(samplerExternalOES, vec2, float bias);"     // GL_OES_EGL_image_external_essl3
+                    "vec4 textureProj(samplerExternalOES, vec3);"             // GL_OES_EGL_image_external_essl3
+                    "vec4 textureProj(samplerExternalOES, vec3, float bias);" // GL_OES_EGL_image_external_essl3
+                    "vec4 textureProj(samplerExternalOES, vec4);"             // GL_OES_EGL_image_external_essl3
+                    "vec4 textureProj(samplerExternalOES, vec4, float bias);" // GL_OES_EGL_image_external_essl3
+                    "vec4 texelFetch(samplerExternalOES, ivec2, int lod);"    // GL_OES_EGL_image_external_essl3
+                "\n");
+            }
             commonBuiltins.append(
-                "vec4 texture2D(samplerExternalOES, vec2 coord);"  // GL_OES_EGL_image_external, caught by keyword check
-                "vec4 texture2DProj(samplerExternalOES, vec3);"    // GL_OES_EGL_image_external, caught by keyword check
-                "vec4 texture2DProj(samplerExternalOES, vec4);"    // GL_OES_EGL_image_external, caught by keyword check
                 "vec4 texture2DGradEXT(sampler2D, vec2, vec2, vec2);"      // GL_EXT_shader_texture_lod
                 "vec4 texture2DProjGradEXT(sampler2D, vec3, vec2, vec2);"  // GL_EXT_shader_texture_lod
                 "vec4 texture2DProjGradEXT(sampler2D, vec4, vec2, vec2);"  // GL_EXT_shader_texture_lod
diff --git a/glslang/MachineIndependent/ParseContextBase.cpp b/glslang/MachineIndependent/ParseContextBase.cpp
index 44fc0b4..447c038 100644
--- a/glslang/MachineIndependent/ParseContextBase.cpp
+++ b/glslang/MachineIndependent/ParseContextBase.cpp
@@ -234,6 +234,31 @@
         linkageSymbols.push_back(&symbol);
 }
 
+// Ensure index is in bounds, correct if necessary.
+// Give an error if not.
+void TParseContextBase::checkIndex(const TSourceLoc& loc, const TType& type, int& index)
+{
+    if (index < 0) {
+        error(loc, "", "[", "index out of range '%d'", index);
+        index = 0;
+    } else if (type.isArray()) {
+        if (type.isExplicitlySizedArray() && index >= type.getOuterArraySize()) {
+            error(loc, "", "[", "array index out of range '%d'", index);
+            index = type.getOuterArraySize() - 1;
+        }
+    } else if (type.isVector()) {
+        if (index >= type.getVectorSize()) {
+            error(loc, "", "[", "vector index out of range '%d'", index);
+            index = type.getVectorSize() - 1;
+        }
+    } else if (type.isMatrix()) {
+        if (index >= type.getMatrixCols()) {
+            error(loc, "", "[", "matrix index out of range '%d'", index);
+            index = type.getMatrixCols() - 1;
+        }
+    }
+}
+
 // Make a shared symbol have a non-shared version that can be edited by the current
 // compile, such that editing its type will not change the shared version and will
 // effect all nodes already sharing it (non-shallow type),
diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp
index de1e5c6..c03ba93 100644
--- a/glslang/MachineIndependent/ParseHelper.cpp
+++ b/glslang/MachineIndependent/ParseHelper.cpp
@@ -430,29 +430,6 @@
     return result;
 }
 
-void TParseContext::checkIndex(const TSourceLoc& loc, const TType& type, int& index)
-{
-    if (index < 0) {
-        error(loc, "", "[", "index out of range '%d'", index);
-        index = 0;
-    } else if (type.isArray()) {
-        if (type.isExplicitlySizedArray() && index >= type.getOuterArraySize()) {
-            error(loc, "", "[", "array index out of range '%d'", index);
-            index = type.getOuterArraySize() - 1;
-        }
-    } else if (type.isVector()) {
-        if (index >= type.getVectorSize()) {
-            error(loc, "", "[", "vector index out of range '%d'", index);
-            index = type.getVectorSize() - 1;
-        }
-    } else if (type.isMatrix()) {
-        if (index >= type.getMatrixCols()) {
-            error(loc, "", "[", "matrix index out of range '%d'", index);
-            index = type.getMatrixCols() - 1;
-        }
-    }
-}
-
 // for ES 2.0 (version 100) limitations for almost all index operations except vertex-shader uniforms
 void TParseContext::handleIndexLimits(const TSourceLoc& /*loc*/, TIntermTyped* base, TIntermTyped* index)
 {
@@ -1575,6 +1552,23 @@
         break;
     }
 
+#ifdef NV_EXTENSIONS
+    case EOpAtomicAdd:
+    case EOpAtomicMin:
+    case EOpAtomicMax:
+    case EOpAtomicAnd:
+    case EOpAtomicOr:
+    case EOpAtomicXor:
+    case EOpAtomicExchange:
+    case EOpAtomicCompSwap:
+    {
+        if (arg0->getType().getBasicType() == EbtInt64 || arg0->getType().getBasicType() == EbtUint64)
+            requireExtensions(loc, 1, &E_GL_NV_shader_atomic_int64, fnCandidate.getName().c_str());
+
+        break;
+    }
+#endif
+
     case EOpInterpolateAtCentroid:
     case EOpInterpolateAtSample:
     case EOpInterpolateAtOffset:
@@ -2464,6 +2458,16 @@
 
 void TParseContext::samplerCheck(const TSourceLoc& loc, const TType& type, const TString& identifier, TIntermTyped* /*initializer*/)
 {
+    // Check that the appropriate extension is enabled if external sampler is used.
+    // There are two extensions. The correct one must be used based on GLSL version.
+    if (type.getBasicType() == EbtSampler && type.getSampler().external) {
+        if (version < 300) {
+            requireExtensions(loc, 1, &E_GL_OES_EGL_image_external, "samplerExternalOES");
+        } else {
+            requireExtensions(loc, 1, &E_GL_OES_EGL_image_external_essl3, "samplerExternalOES");
+        }
+    }
+
     if (type.getQualifier().storage == EvqUniform)
         return;
 
@@ -5581,7 +5585,7 @@
 
     bool singleArg;
     if (aggrNode) {
-        if (aggrNode->getOp() != EOpNull || aggrNode->getSequence().size() == 1)
+        if (aggrNode->getOp() != EOpNull)
             singleArg = true;
         else
             singleArg = false;
diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h
index 2088d63..6e87266 100644
--- a/glslang/MachineIndependent/ParseHelper.h
+++ b/glslang/MachineIndependent/ParseHelper.h
@@ -102,6 +102,8 @@
 
     virtual void setLimits(const TBuiltInResource&) = 0;
 
+    void checkIndex(const TSourceLoc&, const TType&, int& index);
+
     EShLanguage getLanguage() const { return language; }
     void setScanContext(TScanContext* c) { scanContext = c; }
     TScanContext* getScanContext() const { return scanContext; }
@@ -150,7 +152,7 @@
     {
         // Replace the entry point name given in the shader with the real entry point name,
         // if there is a substitution.
-        if (name != nullptr && *name == sourceEntryPointName)
+        if (name != nullptr && *name == sourceEntryPointName && intermediate.getEntryPointName().size() > 0)
             name = NewPoolTString(intermediate.getEntryPointName().c_str());
     }
 
@@ -283,7 +285,6 @@
     void handlePragma(const TSourceLoc&, const TVector<TString>&) override;
     TIntermTyped* handleVariable(const TSourceLoc&, TSymbol* symbol, const TString* string);
     TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
-    void checkIndex(const TSourceLoc&, const TType&, int& index);
     void handleIndexLimits(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
 
     void makeEditable(TSymbol*&) override;
diff --git a/glslang/MachineIndependent/Scan.cpp b/glslang/MachineIndependent/Scan.cpp
index fce2e15..10b3d9e 100644
--- a/glslang/MachineIndependent/Scan.cpp
+++ b/glslang/MachineIndependent/Scan.cpp
@@ -1287,7 +1287,9 @@
 
     case SAMPLEREXTERNALOES:
         afterType = true;
-        if (parseContext.symbolTable.atBuiltInLevel() || parseContext.extensionTurnedOn(E_GL_OES_EGL_image_external))
+        if (parseContext.symbolTable.atBuiltInLevel() ||
+            parseContext.extensionTurnedOn(E_GL_OES_EGL_image_external) ||
+            parseContext.extensionTurnedOn(E_GL_OES_EGL_image_external_essl3))
             return keyword;
         return identifierOrType();
 
diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp
index a1c1dc4..daf2dc1 100644
--- a/glslang/MachineIndependent/Versions.cpp
+++ b/glslang/MachineIndependent/Versions.cpp
@@ -155,6 +155,7 @@
     extensionBehavior[E_GL_OES_standard_derivatives]         = EBhDisable;
     extensionBehavior[E_GL_EXT_frag_depth]                   = EBhDisable;
     extensionBehavior[E_GL_OES_EGL_image_external]           = EBhDisable;
+    extensionBehavior[E_GL_OES_EGL_image_external_essl3]     = EBhDisable;
     extensionBehavior[E_GL_EXT_shader_texture_lod]           = EBhDisable;
     extensionBehavior[E_GL_EXT_shadow_samplers]              = EBhDisable;
     extensionBehavior[E_GL_ARB_texture_rectangle]            = EBhDisable;
@@ -220,6 +221,7 @@
     extensionBehavior[E_GL_NV_viewport_array2]                       = EBhDisable;
     extensionBehavior[E_GL_NV_stereo_view_rendering]                 = EBhDisable;
     extensionBehavior[E_GL_NVX_multiview_per_view_attributes]        = EBhDisable;
+    extensionBehavior[E_GL_NV_shader_atomic_int64]                   = EBhDisable;
 #endif
 
     // AEP
@@ -281,6 +283,7 @@
             "#define GL_OES_standard_derivatives 1\n"
             "#define GL_EXT_frag_depth 1\n"
             "#define GL_OES_EGL_image_external 1\n"
+            "#define GL_OES_EGL_image_external_essl3 1\n"
             "#define GL_EXT_shader_texture_lod 1\n"
             "#define GL_EXT_shadow_samplers 1\n"
 
@@ -371,6 +374,7 @@
             "#define GL_NV_sample_mask_override_coverage 1\n"
             "#define GL_NV_geometry_shader_passthrough 1\n"
             "#define GL_NV_viewport_array2 1\n"
+            "#define GL_NV_shader_atomic_int64 1\n"
 #endif
             "#define GL_KHX_shader_explicit_arithmetic_types 1\n"
             "#define GL_KHX_shader_explicit_arithmetic_types_int8 1\n"
diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h
index 12e733a..ead9075 100644
--- a/glslang/MachineIndependent/Versions.h
+++ b/glslang/MachineIndependent/Versions.h
@@ -108,6 +108,7 @@
 const char* const E_GL_OES_standard_derivatives         = "GL_OES_standard_derivatives";
 const char* const E_GL_EXT_frag_depth                   = "GL_EXT_frag_depth";
 const char* const E_GL_OES_EGL_image_external           = "GL_OES_EGL_image_external";
+const char* const E_GL_OES_EGL_image_external_essl3     = "GL_OES_EGL_image_external_essl3";
 const char* const E_GL_EXT_shader_texture_lod           = "GL_EXT_shader_texture_lod";
 const char* const E_GL_EXT_shadow_samplers              = "GL_EXT_shadow_samplers";
 
@@ -191,6 +192,7 @@
 const char* const E_GL_NV_viewport_array2                       = "GL_NV_viewport_array2";
 const char* const E_GL_NV_stereo_view_rendering                 = "GL_NV_stereo_view_rendering";
 const char* const E_GL_NVX_multiview_per_view_attributes        = "GL_NVX_multiview_per_view_attributes";
+const char* const E_GL_NV_shader_atomic_int64                   = "GL_NV_shader_atomic_int64";
 
 // Arrays of extensions for the above viewportEXTs duplications
 
diff --git a/glslang/MachineIndependent/intermOut.cpp b/glslang/MachineIndependent/intermOut.cpp
index 4f78e68..fcea4d5 100644
--- a/glslang/MachineIndependent/intermOut.cpp
+++ b/glslang/MachineIndependent/intermOut.cpp
@@ -197,6 +197,7 @@
     case EOpLogicalOr:  out.debug << "logical-or";   break;
     case EOpLogicalXor: out.debug << "logical-xor"; break;
     case EOpLogicalAnd: out.debug << "logical-and"; break;
+
     default: out.debug << "<unknown op>";
     }
 
@@ -637,6 +638,9 @@
     case EOpCubeFaceCoord:          out.debug << "cubeFaceCoord";               break;
 #endif
 
+    case EOpSubpassLoad:   out.debug << "subpassLoad";   break;
+    case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
+
     default: out.debug.message(EPrefixError, "Bad unary op");
     }
 
@@ -936,9 +940,9 @@
     case EOpSinCos:                     out.debug << "sincos";                break;
     case EOpGenMul:                     out.debug << "mul";                   break;
 
-    case EOpAllMemoryBarrierWithGroupSync:    out.debug << "AllMemoryBarrierWithGroupSync";    break;
-    case EOpGroupMemoryBarrierWithGroupSync: out.debug << "GroupMemoryBarrierWithGroupSync"; break;
-    case EOpWorkgroupMemoryBarrier:           out.debug << "WorkgroupMemoryBarrier";           break;
+    case EOpAllMemoryBarrierWithGroupSync:       out.debug << "AllMemoryBarrierWithGroupSync";    break;
+    case EOpGroupMemoryBarrierWithGroupSync:     out.debug << "GroupMemoryBarrierWithGroupSync"; break;
+    case EOpWorkgroupMemoryBarrier:              out.debug << "WorkgroupMemoryBarrier";           break;
     case EOpWorkgroupMemoryBarrierWithGroupSync: out.debug << "WorkgroupMemoryBarrierWithGroupSync"; break;
 
     case EOpSubgroupBarrier:                 out.debug << "subgroupBarrier"; break;
@@ -997,6 +1001,9 @@
     case EOpSubgroupQuadSwapVertical:        out.debug << "subgroupQuadSwapVertical"; break;
     case EOpSubgroupQuadSwapDiagonal:        out.debug << "subgroupQuadSwapDiagonal"; break;
 
+    case EOpSubpassLoad:   out.debug << "subpassLoad";   break;
+    case EOpSubpassLoadMS: out.debug << "subpassLoadMS"; break;
+
     default: out.debug.message(EPrefixError, "Bad aggregation op");
     }
 
diff --git a/glslang/MachineIndependent/iomapper.cpp b/glslang/MachineIndependent/iomapper.cpp
index 1758d00..4926cf8 100644
--- a/glslang/MachineIndependent/iomapper.cpp
+++ b/glslang/MachineIndependent/iomapper.cpp
@@ -497,7 +497,8 @@
     }
 
     static bool isTextureType(const glslang::TType& type) {
-        return type.getBasicType() == glslang::EbtSampler && type.getSampler().isTexture();
+        return (type.getBasicType() == glslang::EbtSampler && 
+                (type.getSampler().isTexture() || type.getSampler().isSubpass()));
     }
 
     static bool isUboType(const glslang::TType& type) {
diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h
index 66dbc5d..1e62e9b 100644
--- a/glslang/MachineIndependent/localintermediate.h
+++ b/glslang/MachineIndependent/localintermediate.h
@@ -235,7 +235,8 @@
         hlslOffsets(false),
         useStorageBuffer(false),
         hlslIoMapping(false),
-        textureSamplerTransformMode(EShTexSampTransKeep)
+        textureSamplerTransformMode(EShTexSampTransKeep),
+        needToLegalize(false)
     {
         localSize[0] = 1;
         localSize[1] = 1;
@@ -616,6 +617,9 @@
     void addProcessArgument(const std::string& arg) { processes.addArgument(arg); }
     const std::vector<std::string>& getProcesses() const { return processes.getProcesses(); }
 
+    void setNeedsLegalization() { needToLegalize = true; }
+    bool needsLegalization() const { return needToLegalize; }
+
     const char* const implicitThisName;
 
 protected:
@@ -717,6 +721,8 @@
     // for OpModuleProcessed, or equivalent
     TProcesses processes;
 
+    bool needToLegalize;
+
 private:
     void operator=(TIntermediate&); // prevent assignments
 };
diff --git a/gtests/AST.FromFile.cpp b/gtests/AST.FromFile.cpp
index 6175239..c4cb3c5 100644
--- a/gtests/AST.FromFile.cpp
+++ b/gtests/AST.FromFile.cpp
@@ -62,6 +62,7 @@
         "versionsErrors.frag",
         "versionsErrors.vert",
         "100.frag",
+        "100samplerExternal.frag",
         "120.vert",
         "120.frag",
         "130.vert",
@@ -93,6 +94,7 @@
         "300layout.frag",
         "300operations.frag",
         "300block.frag",
+        "300samplerExternal.frag",
         "310.comp",
         "310.vert",
         "310.geom",
diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp
index bc04f7f..a96dbbf 100644
--- a/gtests/Hlsl.FromFile.cpp
+++ b/gtests/Hlsl.FromFile.cpp
@@ -59,9 +59,10 @@
 
 using HlslCompileTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
 using HlslCompileAndFlattenTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
+using HlslLegalizeTest = GlslangTest<::testing::TestWithParam<FileNameEntryPointPair>>;
 
-// Compiling HLSL to SPIR-V under Vulkan semantics. Expected to successfully
-// generate both AST and SPIR-V.
+// Compiling HLSL to pre-legalized SPIR-V under Vulkan semantics. Expected
+// to successfully generate both AST and SPIR-V.
 TEST_P(HlslCompileTest, FromFile)
 {
     loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
@@ -76,6 +77,16 @@
                                            Target::BothASTAndSpv, GetParam().entryPoint);
 }
 
+// Compiling HLSL to legal SPIR-V under Vulkan semantics. Expected to
+// successfully generate SPIR-V.
+TEST_P(HlslLegalizeTest, FromFile)
+{
+    loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam().fileName,
+                            Source::HLSL, Semantics::Vulkan,
+                            Target::Spv, GetParam().entryPoint,
+                            "/baseLegalResults/", false);
+}
+
 // clang-format off
 INSTANTIATE_TEST_CASE_P(
     ToSpirv, HlslCompileTest,
@@ -88,6 +99,7 @@
         {"hlsl.assoc.frag", "PixelShaderFunction"},
         {"hlsl.attribute.frag", "PixelShaderFunction"},
         {"hlsl.attribute.expression.comp", "main"},
+        {"hlsl.attributeC11.frag", "main"},
         {"hlsl.basic.comp", "main"},
         {"hlsl.basic.geom", "main"},
         {"hlsl.boolConv.vert", "main"},
@@ -141,6 +153,8 @@
         {"hlsl.flattenOpaque.frag", "main"},
         {"hlsl.flattenOpaqueInit.vert", "main"},
         {"hlsl.flattenOpaqueInitMix.vert", "main"},
+        {"hlsl.flattenSubset.frag", "main"},
+        {"hlsl.flattenSubset2.frag", "main"},
         {"hlsl.forLoop.frag", "PixelShaderFunction"},
         {"hlsl.gather.array.dx10.frag", "main"},
         {"hlsl.gather.basic.dx10.frag", "main"},
@@ -164,6 +178,8 @@
         {"hlsl.hull.1.tesc", "main"},
         {"hlsl.hull.2.tesc", "main"},
         {"hlsl.hull.3.tesc", "main"},
+        {"hlsl.hull.4.tesc", "main"},
+        {"hlsl.hull.5.tesc", "main"},
         {"hlsl.hull.void.tesc", "main"},
         {"hlsl.hull.ctrlpt-1.tesc", "main"},
         {"hlsl.hull.ctrlpt-2.tesc", "main"},
@@ -203,6 +219,7 @@
         {"hlsl.load.rwtexture.array.dx10.frag", "main"},
         {"hlsl.load.offset.dx10.frag", "main"},
         {"hlsl.load.offsetarray.dx10.frag", "main"},
+        {"hlsl.localStructuredBuffer.comp", "main"},
         {"hlsl.logical.binary.frag", "main"},
         {"hlsl.logical.binary.vec.frag", "main"},
         {"hlsl.logicalConvert.frag", "main"},
@@ -253,6 +270,7 @@
         {"hlsl.samplebias.offsetarray.dx10.frag", "main"},
         {"hlsl.samplecmp.array.dx10.frag", "main"},
         {"hlsl.samplecmp.basic.dx10.frag", "main"},
+        {"hlsl.samplecmp.dualmode.frag", "main"},
         {"hlsl.samplecmp.offset.dx10.frag", "main"},
         {"hlsl.samplecmp.offsetarray.dx10.frag", "main"},
         {"hlsl.samplecmp.negative.frag", "main"},
@@ -304,6 +322,7 @@
         {"hlsl.structin.vert", "main"},
         {"hlsl.structIoFourWay.frag", "main"},
         {"hlsl.structStructName.frag", "main"},
+        {"hlsl.subpass.frag", "main"},
         {"hlsl.synthesizeInput.frag", "main"},
         {"hlsl.texture.struct.frag", "main"},
         {"hlsl.texture.subvec4.frag", "main"},
@@ -362,7 +381,23 @@
     }),
     FileNameAsCustomTestSuffix
 );
-
 // clang-format on
+
+#ifdef ENABLE_OPT
+// clang-format off
+INSTANTIATE_TEST_CASE_P(
+    ToSpirv, HlslLegalizeTest,
+    ::testing::ValuesIn(std::vector<FileNameEntryPointPair>{
+        {"hlsl.aliasOpaque.frag", "main"},
+        {"hlsl.flattenOpaque.frag", "main"},
+        {"hlsl.flattenOpaqueInit.vert", "main"},
+        {"hlsl.flattenOpaqueInitMix.vert", "main"},
+        {"hlsl.flattenSubset.frag", "main"}
+    }),
+    FileNameAsCustomTestSuffix
+);
+// clang-format on
+#endif
+
 }  // anonymous namespace
 }  // namespace glslangtest
diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp
index 7c28a55..ec73ba1 100644
--- a/gtests/Spv.FromFile.cpp
+++ b/gtests/Spv.FromFile.cpp
@@ -352,6 +352,7 @@
         { "spv.register.autoassign.frag", "main_ep", 5, 10, 0, 20, 30, true, false },
         { "spv.register.noautoassign.frag", "main_ep", 5, 10, 0, 15, 30, false, false },
         { "spv.register.autoassign-2.frag", "main", 5, 10, 0, 15, 30, true, true },
+        { "spv.register.subpass.frag", "main", 0, 20, 0, 0, 0, true, true },
         { "spv.buffer.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
         { "spv.ssbo.autoassign.frag", "main", 5, 10, 0, 15, 30, true, true },
         { "spv.ssboAlias.frag", "main", 0, 0, 0, 0, 83, true, false },
@@ -429,7 +430,7 @@
         "spv.int16.amd.frag",
         "spv.shaderBallotAMD.comp",
         "spv.shaderFragMaskAMD.frag",
-        "spv.textureGatherBiasLod.frag"
+        "spv.textureGatherBiasLod.frag",
     })),
     FileNameAsCustomTestSuffix
 );
@@ -447,6 +448,7 @@
     "spv.stereoViewRendering.tesc",
     "spv.multiviewPerViewAttributes.vert",
     "spv.multiviewPerViewAttributes.tesc",
+    "spv.atomicInt64.comp",
 })),
 FileNameAsCustomTestSuffix
 );
diff --git a/gtests/TestFixture.h b/gtests/TestFixture.h
index a503b5f..2dac99b 100644
--- a/gtests/TestFixture.h
+++ b/gtests/TestFixture.h
@@ -198,7 +198,8 @@
             const std::string shaderName, const std::string& code,
             const std::string& entryPointName, EShMessages controls,
             bool flattenUniformArrays = false,
-            EShTextureSamplerTransformMode texSampTransMode = EShTexSampTransKeep)
+            EShTextureSamplerTransformMode texSampTransMode = EShTexSampTransKeep,
+            bool disableOptimizer = true)
     {
         const EShLanguage kind = GetShaderStage(GetSuffix(shaderName));
 
@@ -217,8 +218,10 @@
 
         if (success && (controls & EShMsgSpvRules)) {
             std::vector<uint32_t> spirv_binary;
+            glslang::SpvOptions options;
+            options.disableOptimizer = disableOptimizer;
             glslang::GlslangToSpv(*program.getIntermediate(kind),
-                                  spirv_binary, &logger);
+                                  spirv_binary, &logger, &options);
 
             std::ostringstream disassembly_stream;
             spv::Parameterize();
@@ -381,18 +384,20 @@
                                  Source source,
                                  Semantics semantics,
                                  Target target,
-                                 const std::string& entryPointName="")
+                                 const std::string& entryPointName="",
+                                 const std::string& baseDir="/baseResults/",
+                                 const bool disableOptimizer = true)
     {
         const std::string inputFname = testDir + "/" + testName;
         const std::string expectedOutputFname =
-            testDir + "/baseResults/" + testName + ".out";
+            testDir + baseDir + testName + ".out";
         std::string input, expectedOutput;
 
         tryLoadFile(inputFname, "input", &input);
         tryLoadFile(expectedOutputFname, "expected output", &expectedOutput);
 
         const EShMessages controls = DeriveOptions(source, semantics, target);
-        GlslangResult result = compileAndLink(testName, input, entryPointName, controls);
+        GlslangResult result = compileAndLink(testName, input, entryPointName, controls, false, EShTexSampTransKeep, disableOptimizer);
 
         // Generate the hybrid output in the way of glslangValidator.
         std::ostringstream stream;
diff --git a/hlsl/hlslAttributes.cpp b/hlsl/hlslAttributes.cpp
index 14f7a7b..61ef805 100644
--- a/hlsl/hlslAttributes.cpp
+++ b/hlsl/hlslAttributes.cpp
@@ -40,11 +40,27 @@
 namespace glslang {
     // Map the given string to an attribute enum from TAttributeType,
     // or EatNone if invalid.
-    TAttributeType TAttributeMap::attributeFromName(const TString& name)
+    TAttributeType TAttributeMap::attributeFromName(const TString& nameSpace, const TString& name)
     {
         // These are case insensitive.
         TString lowername(name);
         std::transform(lowername.begin(), lowername.end(), lowername.begin(), ::tolower);
+        TString lowernameSpace(nameSpace);
+        std::transform(lowernameSpace.begin(), lowernameSpace.end(), lowernameSpace.begin(), ::tolower);
+
+        // handle names within a namespace
+
+        if (lowernameSpace == "vk") {
+            if (lowername == "input_attachment_index")
+                return EatInputAttachment;
+            else if (lowername == "location")
+                return EatLocation;
+            else if (lowername == "binding")
+                return EatBinding;
+        } else if (lowernameSpace.size() > 0)
+            return EatNone;
+
+        // handle names with no namespace
 
         if (lowername == "allow_uav_condition")
             return EatAllow_uav_condition;
@@ -88,12 +104,12 @@
 
     // Look up entry, inserting if it's not there, and if name is a valid attribute name
     // as known by attributeFromName.
-    TAttributeType TAttributeMap::setAttribute(const TString* name, TIntermAggregate* value)
+    TAttributeType TAttributeMap::setAttribute(const TString& nameSpace, const TString* name, TIntermAggregate* value)
     {
         if (name == nullptr)
             return EatNone;
 
-        const TAttributeType attr = attributeFromName(*name);
+        const TAttributeType attr = attributeFromName(nameSpace, *name);
 
         if (attr != EatNone)
             attributes[attr] = value;
diff --git a/hlsl/hlslAttributes.h b/hlsl/hlslAttributes.h
index b32a53c..16ec31d 100644
--- a/hlsl/hlslAttributes.h
+++ b/hlsl/hlslAttributes.h
@@ -63,6 +63,9 @@
         EatPatchSize,
         EatUnroll,
         EatLoop,
+        EatBinding,
+        EatLocation,
+        EatInputAttachment
     };
 }
 
@@ -82,7 +85,7 @@
     public:
         // Search for and potentially add the attribute into the map.  Return the
         // attribute type enum for it, if found, else EatNone.
-        TAttributeType setAttribute(const TString* name, TIntermAggregate* value);
+        TAttributeType setAttribute(const TString& nameSpace, const TString* name, TIntermAggregate* value);
 
         // Const lookup: search for (but do not modify) the attribute in the map.
         const TIntermAggregate* operator[](TAttributeType) const;
@@ -92,7 +95,7 @@
 
     protected:
         // Find an attribute enum given its name.
-        static TAttributeType attributeFromName(const TString&);
+        static TAttributeType attributeFromName(const TString& nameSpace, const TString& name);
 
         std::unordered_map<TAttributeType, TIntermAggregate*> attributes;
     };
diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp
index ea9a8aa..5b078ba 100755
--- a/hlsl/hlslGrammar.cpp
+++ b/hlsl/hlslGrammar.cpp
@@ -295,13 +295,16 @@
 }
 
 // declaration
+//      : attributes attributed_declaration
+//      | NAMESPACE IDENTIFIER LEFT_BRACE declaration_list RIGHT_BRACE
+//
+// attributed_declaration
 //      : sampler_declaration_dx9 post_decls SEMICOLON
 //      | fully_specified_type                           // for cbuffer/tbuffer
 //      | fully_specified_type declarator_list SEMICOLON // for non cbuffer/tbuffer
 //      | fully_specified_type identifier function_parameters post_decls compound_statement  // function definition
 //      | fully_specified_type identifier sampler_state post_decls compound_statement        // sampler definition
 //      | typedef declaration
-//      | NAMESPACE IDENTIFIER LEFT_BRACE declaration_list RIGHT_BRACE
 //
 // declarator_list
 //      : declarator COMMA declarator COMMA declarator...  // zero or more declarators
@@ -376,6 +379,8 @@
     if (! acceptFullySpecifiedType(declaredType, nodeList))
         return false;
 
+    parseContext.transferTypeAttributes(declarator.attributes, declaredType);
+
     // cbuffer and tbuffer end with the closing '}'.
     // No semicolon is included.
     if (forbidDeclarators)
@@ -1083,6 +1088,69 @@
     return true;
 }
 
+// subpass input type
+//      : SUBPASSINPUT
+//      | SUBPASSINPUT VECTOR LEFT_ANGLE template_type RIGHT_ANGLE
+//      | SUBPASSINPUTMS
+//      | SUBPASSINPUTMS VECTOR LEFT_ANGLE template_type RIGHT_ANGLE
+bool HlslGrammar::acceptSubpassInputType(TType& type)
+{
+    // read subpass type
+    const EHlslTokenClass subpassInputType = peek();
+
+    bool multisample;
+
+    switch (subpassInputType) {
+    case EHTokSubpassInput:   multisample = false; break;
+    case EHTokSubpassInputMS: multisample = true;  break;
+    default:
+        return false;  // not a subpass input declaration
+    }
+
+    advanceToken();  // consume the sampler type keyword
+
+    TType subpassType(EbtFloat, EvqUniform, 4); // default type is float4
+
+    if (acceptTokenClass(EHTokLeftAngle)) {
+        if (! acceptType(subpassType)) {
+            expected("scalar or vector type");
+            return false;
+        }
+
+        const TBasicType basicRetType = subpassType.getBasicType() ;
+
+        switch (basicRetType) {
+        case EbtFloat:
+        case EbtUint:
+        case EbtInt:
+        case EbtStruct:
+            break;
+        default:
+            unimplemented("basic type in subpass input");
+            return false;
+        }
+
+        if (! acceptTokenClass(EHTokRightAngle)) {
+            expected("right angle bracket");
+            return false;
+        }
+    }
+
+    const TBasicType subpassBasicType = subpassType.isStruct() ? (*subpassType.getStruct())[0].type->getBasicType()
+        : subpassType.getBasicType();
+
+    TSampler sampler;
+    sampler.setSubpass(subpassBasicType, multisample);
+
+    // Remember the declared return type.  Function returns false on error.
+    if (!parseContext.setTextureReturnType(sampler, subpassType, token.loc))
+        return false;
+
+    type.shallowCopy(TType(sampler, EvqUniform));
+
+    return true;
+}
+
 // sampler_type
 //      : SAMPLER
 //      | SAMPLER1D
@@ -1352,6 +1420,11 @@
         return acceptSamplerType(type);
         break;
 
+    case EHTokSubpassInput:           // fall through
+    case EHTokSubpassInputMS:         // ...
+        return acceptSubpassInputType(type);
+        break;
+
     case EHTokBuffer:                 // fall through
     case EHTokTexture1d:              // ...
     case EHTokTexture1darray:         // ...
@@ -2357,6 +2430,9 @@
         node = parseContext.handleFunctionCall(token.loc, constructor, node);
     }
 
+    if (node == nullptr)
+        return false;
+
     // If this is simply a constant, we can use it directly.
     if (node->getAsConstantUnion())
         return true;
@@ -2375,16 +2451,25 @@
 }
 
 // parameter_declaration
+//      : attributes attributed_declaration
+//
+// attributed_declaration
 //      : fully_specified_type post_decls [ = default_parameter_declaration ]
 //      | fully_specified_type identifier array_specifier post_decls [ = default_parameter_declaration ]
 //
 bool HlslGrammar::acceptParameterDeclaration(TFunction& function)
 {
+    // attributes
+    TAttributeMap attributes;
+    acceptAttributes(attributes);
+
     // fully_specified_type
     TType* type = new TType;
     if (! acceptFullySpecifiedType(*type))
         return false;
 
+    parseContext.transferTypeAttributes(attributes, *type);
+
     // identifier
     HlslToken idToken;
     acceptIdentifier(idToken);
@@ -2784,7 +2869,7 @@
                 parseContext.handleFunctionArgument(constructorFunction, arguments, node);
                 node = parseContext.handleFunctionCall(loc, constructorFunction, arguments);
 
-                return true;
+                return node != nullptr;
             } else {
                 // This could be a parenthesized constructor, ala (int(3)), and we just accepted
                 // the '(int' part.  We must back up twice.
@@ -2994,7 +3079,7 @@
         // hook it up
         node = parseContext.handleFunctionCall(arguments->getLoc(), constructorFunction, arguments);
 
-        return true;
+        return node != nullptr;
     }
 
     return false;
@@ -3042,7 +3127,7 @@
     // call
     node = parseContext.handleFunctionCall(loc, function, arguments);
 
-    return true;
+    return node != nullptr;
 }
 
 // arguments
@@ -3260,7 +3345,15 @@
 }
 
 // attributes
-//      : list of zero or more of:  LEFT_BRACKET attribute RIGHT_BRACKET
+//      : [zero or more:] bracketed-attribute
+//
+// bracketed-attribute:
+//      : LEFT_BRACKET scoped-attribute RIGHT_BRACKET
+//      : LEFT_BRACKET LEFT_BRACKET scoped-attribute RIGHT_BRACKET RIGHT_BRACKET
+//
+// scoped-attribute:
+//      : attribute
+//      | namespace COLON COLON attribute
 //
 // attribute:
 //      : UNROLL
@@ -3287,18 +3380,33 @@
     // numthreads, which is used to set the CS local size.
     // TODO: subset to correct set?  Pass on?
     do {
-        HlslToken idToken;
+        HlslToken attributeToken;
 
         // LEFT_BRACKET?
         if (! acceptTokenClass(EHTokLeftBracket))
             return;
+        // another LEFT_BRACKET?
+        bool doubleBrackets = false;
+        if (acceptTokenClass(EHTokLeftBracket))
+            doubleBrackets = true;
 
-        // attribute
-        if (acceptIdentifier(idToken)) {
-            // 'idToken.string' is the attribute
-        } else if (! peekTokenClass(EHTokRightBracket)) {
-            expected("identifier");
-            advanceToken();
+        // attribute? (could be namespace; will adjust later)
+        if (!acceptIdentifier(attributeToken)) {
+            if (!peekTokenClass(EHTokRightBracket)) {
+                expected("namespace or attribute identifier");
+                advanceToken();
+            }
+        }
+
+        TString nameSpace;
+        if (acceptTokenClass(EHTokColonColon)) {
+            // namespace COLON COLON
+            nameSpace = *attributeToken.string;
+            // attribute
+            if (!acceptIdentifier(attributeToken)) {
+                expected("attribute identifier");
+                return;
+            }
         }
 
         TIntermAggregate* expressions = nullptr;
@@ -3331,10 +3439,15 @@
             expected("]");
             return;
         }
+        // another RIGHT_BRACKET?
+        if (doubleBrackets && !acceptTokenClass(EHTokRightBracket)) {
+            expected("]]");
+            return;
+        }
 
         // Add any values we found into the attribute map.  This accepts
         // (and ignores) values not mapping to a known TAttributeType;
-        attributes.setAttribute(idToken.string, expressions);
+        attributes.setAttribute(nameSpace, attributeToken.string, expressions);
     } while (true);
 }
 
diff --git a/hlsl/hlslGrammar.h b/hlsl/hlslGrammar.h
index 2db0754..f0adfa0 100755
--- a/hlsl/hlslGrammar.h
+++ b/hlsl/hlslGrammar.h
@@ -87,6 +87,7 @@
         bool acceptAnnotations(TQualifier&);
         bool acceptSamplerType(TType&);
         bool acceptTextureType(TType&);
+        bool acceptSubpassInputType(TType&);
         bool acceptStructBufferType(TType&);
         bool acceptConstantBufferType(TType&);
         bool acceptStruct(TType&, TIntermNode*& nodeList);
diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp
index 8c9174b..e34ab3a 100755
--- a/hlsl/hlslParseHelper.cpp
+++ b/hlsl/hlslParseHelper.cpp
@@ -166,11 +166,6 @@
     if (lhsAsAggregate != nullptr && lhsAsAggregate->getOp() == EOpImageLoad)
         return true;
 
-    // If it's a syntactic write to a sampler, we will use that to establish
-    // a compile-time alias.
-    if (node->getAsTyped()->getBasicType() == EbtSampler)
-        return true;
-
     return false;
 }
 
@@ -239,6 +234,13 @@
         }
     }
 
+    // We tolerate samplers as l-values, even though they are nominally
+    // illegal, because we expect a later optimization to eliminate them.
+    if (node->getType().getBasicType() == EbtSampler) {
+        intermediate.setNeedsLegalization();
+        return false;
+    }
+
     // Let the base class check errors
     return TParseContextBase::lValueErrorCheck(loc, op, node);
 }
@@ -274,10 +276,6 @@
 
     // *** If we get here, we're going to apply some conversion to an l-value.
 
-    // Spin off sampler aliasing
-    if (node->getAsTyped()->getBasicType() == EbtSampler)
-        return handleSamplerLvalue(loc, op, node);
-
     // Helper to create a load.
     const auto makeLoad = [&](TIntermSymbol* rhsTmp, TIntermTyped* object, TIntermTyped* coord, const TType& derefType) {
         TIntermAggregate* loadOp = new TIntermAggregate(EOpImageLoad);
@@ -524,58 +522,6 @@
     return node;
 }
 
-// Deal with sampler aliasing: turning assignments into aliases
-// Return a placeholder node for higher-level code that think assignments must
-// generate code.
-TIntermTyped* HlslParseContext::handleSamplerLvalue(const TSourceLoc& loc, const char* op, TIntermTyped*& node)
-{
-    // Can only alias an assignment:  "s1 = s2"
-    TIntermBinary* binary = node->getAsBinaryNode();
-    if (binary == nullptr || node->getAsOperator()->getOp() != EOpAssign ||
-        binary->getLeft()->getAsSymbolNode() == nullptr ||
-        binary->getRight()->getAsSymbolNode() == nullptr) {
-        error(loc, "can't modify sampler", op, "");
-        return node;
-    }
-
-    if (controlFlowNestingLevel > 0)
-        warn(loc, "sampler or image aliased under control flow; consumption must be in same path", op, "");
-
-    TIntermTyped* set = setOpaqueLvalue(binary->getLeft(), binary->getRight());
-    if (set == nullptr)
-        warn(loc, "could not create alias for sampler", op, "");
-    else
-        node = set;
-
-    return node;
-}
-
-// Do an opaque assignment that needs to turn into an alias.
-// Return nullptr if it can't be done, otherwise return a placeholder
-// node for higher-level code that think assignments must generate code.
-TIntermTyped* HlslParseContext::setOpaqueLvalue(TIntermTyped* leftTyped, TIntermTyped* rightTyped)
-{
-    // Best is if we are aliasing a flattened struct member "S.s1 = s2",
-    // in which case we want to update the flattening information with the alias,
-    // making everything else work seamlessly.
-    TIntermSymbol* left = leftTyped->getAsSymbolNode();
-    TIntermSymbol* right = rightTyped->getAsSymbolNode();
-    for (auto fit = flattenMap.begin(); fit != flattenMap.end(); ++fit) {
-        for (auto mit = fit->second.members.begin(); mit != fit->second.members.end(); ++mit) {
-            if ((*mit)->getUniqueId() == left->getId()) {
-                // found it: update with alias to the existing variable, and don't emit any code
-                (*mit) = new TVariable(&right->getName(), right->getType());
-                (*mit)->setUniqueId(right->getId());
-                // replace node (rest of compiler expects either an error or code to generate)
-                // with pointless access
-                return right;
-            }
-        }
-    }
-
-    return nullptr;
-}
-
 void HlslParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>& tokens)
 {
     if (pragmaCallback)
@@ -859,10 +805,8 @@
 
     bool flattened = false;
     int indexValue = 0;
-    if (index->getQualifier().storage == EvqConst) {
+    if (index->getQualifier().isFrontEndConstant())
         indexValue = index->getAsConstantUnion()->getConstArray()[0].getIConst();
-        checkIndex(loc, base->getType(), indexValue);
-    }
 
     variableCheck(base);
     if (! base->isArray() && ! base->isMatrix() && ! base->isVector()) {
@@ -871,9 +815,11 @@
                   base->getAsSymbolNode()->getName().c_str(), "");
         else
             error(loc, " left of '[' is not of type array, matrix, or vector ", "expression", "");
-    } else if (base->getType().getQualifier().storage == EvqConst && index->getQualifier().storage == EvqConst)
+    } else if (base->getType().getQualifier().storage == EvqConst && index->getQualifier().storage == EvqConst) {
+        // both base and index are front-end constants
+        checkIndex(loc, base->getType(), indexValue);
         return intermediate.foldDereference(base, indexValue, loc);
-    else {
+    } else {
         // at least one of base and index is variable...
 
         if (base->getAsSymbolNode() && wasFlattened(base)) {
@@ -883,9 +829,11 @@
             result = flattenAccess(base, indexValue);
             flattened = (result != base);
         } else {
-            if (index->getQualifier().storage == EvqConst) {
+            if (index->getQualifier().isFrontEndConstant()) {
                 if (base->getType().isImplicitlySizedArray())
                     updateImplicitArraySize(loc, base, indexValue);
+                else
+                    checkIndex(loc, base->getType(), indexValue);
                 result = intermediate.addIndex(EOpIndexDirect, base, index, loc);
             } else {
                 result = intermediate.addIndex(EOpIndexIndirect, base, index, loc);
@@ -914,11 +862,6 @@
     return result;
 }
 
-void HlslParseContext::checkIndex(const TSourceLoc& /*loc*/, const TType& /*type*/, int& /*index*/)
-{
-    // HLSL todo: any rules for index fixups?
-}
-
 // Handle seeing a binary node with a math operation.
 TIntermTyped* HlslParseContext::handleBinaryMath(const TSourceLoc& loc, const char* str, TOperator op,
                                                  TIntermTyped* left, TIntermTyped* right)
@@ -1436,6 +1379,44 @@
     return subsetSymbol;
 }
 
+// For finding where the first leaf is in a subtree of a multi-level aggregate
+// that is just getting a subset assigned. Follows the same logic as flattenAccess,
+// but logically going down the "left-most" tree branch each step of the way.
+//
+// Returns the offset into the first leaf of the subset.
+int HlslParseContext::findSubtreeOffset(const TIntermNode& node) const
+{
+    const TIntermSymbol* sym = node.getAsSymbolNode();
+    if (sym == nullptr)
+        return 0;
+    if (!sym->isArray() && !sym->isStruct())
+        return 0;
+    int subset = sym->getFlattenSubset();
+    if (subset == -1)
+        return 0;
+
+    // Getting this far means a partial aggregate is identified by the flatten subset.
+    // Find the first leaf of the subset.
+
+    const auto flattenData = flattenMap.find(sym->getId());
+    if (flattenData == flattenMap.end())
+        return 0;
+
+    return findSubtreeOffset(sym->getType(), subset, flattenData->second.offsets);
+
+    do {
+        subset = flattenData->second.offsets[subset];
+    } while (true);
+}
+// Recursively do the desent
+int HlslParseContext::findSubtreeOffset(const TType& type, int subset, const TVector<int>& offsets) const
+{
+    if (!type.isArray() && !type.isStruct())
+        return offsets[subset];
+    TType derefType(type, 0);
+    return findSubtreeOffset(derefType, offsets[subset], offsets);
+};
+
 // Find and return the split IO TVariable for id, or nullptr if none.
 TVariable* HlslParseContext::getSplitNonIoVar(int id) const
 {
@@ -1723,7 +1704,6 @@
     return paramNodes;
 }
 
-
 // Handle all [attrib] attribute for the shader entry point
 void HlslParseContext::handleEntryPointAttributes(const TSourceLoc& loc, const TAttributeMap& attributes)
 {
@@ -1872,6 +1852,44 @@
     }
 }
 
+// Update the given type with any type-like attribute information in the
+// attributes.
+void HlslParseContext::transferTypeAttributes(const TAttributeMap& attributes, TType& type)
+{
+    // extract integers out of attribute arguments stored in attribute aggregate
+    const auto getInt = [&](TAttributeType attr, int argNum, int& value) -> bool {
+        const TIntermAggregate* attrAgg = attributes[attr];
+        if (attrAgg == nullptr)
+            return false;
+        if (argNum >= (int)attrAgg->getSequence().size())
+            return false;
+        const TConstUnion& intConst = attrAgg->getSequence()[argNum]->getAsConstantUnion()->getConstArray()[0];
+        if (intConst.getType() != EbtInt)
+            return false;
+        value = intConst.getIConst();
+        return true;
+    };
+
+    // location
+    int value;
+    if (getInt(EatLocation, 0, value))
+        type.getQualifier().layoutLocation = value;
+
+    // binding
+    if (getInt(EatBinding, 0, value)) {
+        type.getQualifier().layoutBinding = value;
+        type.getQualifier().layoutSet = 0;
+    }
+
+    // set
+    if (getInt(EatBinding, 1, value))
+        type.getQualifier().layoutSet = value;
+
+    // input attachment
+    if (getInt(EatInputAttachment, 0, value))
+        type.getQualifier().layoutAttachment = value;
+}
+
 //
 // Do all special handling for the entry point, including wrapping
 // the shader's entry point with the official entry point that will call it.
@@ -1999,6 +2017,11 @@
         TParameter& param = userFunction[i];
         argVars.push_back(makeInternalVariable(*param.name, *param.type));
         argVars.back()->getWritableType().getQualifier().makeTemporary();
+
+        // Track the input patch, which is the only non-builtin supported by hull shader PCF.
+        if (param.getDeclaredBuiltIn() == EbvInputPatch)
+            inputPatch = argVars.back();
+
         TIntermSymbol* arg = intermediate.addSymbol(*argVars.back());
         handleFunctionArgument(&callee, callingArgs, arg);
         if (param.type->getQualifier().isParamInput()) {
@@ -2039,7 +2062,10 @@
 
             TIntermTyped* element = intermediate.addIndex(EOpIndexIndirect, intermediate.addSymbol(*entryPointOutput),
                                                           invocationIdSym, loc);
-            element->setType(callReturn->getType());
+
+            // Set the type of the array element being dereferenced
+            const TType derefElementType(entryPointOutput->getType(), 0);
+            element->setType(derefElementType);
 
             returnAssign = handleAssign(loc, EOpAssign, element, callReturn);
         } else {
@@ -2215,9 +2241,6 @@
             synthesizeEditedInput(paramType);
             TVariable* argAsGlobal = makeIoVariable(function[i].name->c_str(), paramType, EvqVaryingIn);
             inputs.push_back(argAsGlobal);
-
-            if (function[i].getDeclaredBuiltIn() == EbvInputPatch)
-                inputPatch = argAsGlobal;
         }
         if (paramType.getQualifier().isParamOutput()) {
             TVariable* argAsGlobal = makeIoVariable(function[i].name->c_str(), paramType, EvqVaryingOut);
@@ -2511,41 +2534,6 @@
     return assignList;
 }
 
-// For a declaration with an initializer, where the initialized symbol is flattened,
-// and possibly contains opaque values, such that the initializer should never exist
-// as emitted code, because even creating the initializer would write opaques.
-//
-// If possible, decompose this into individual member-wise assignments, which themselves
-// are expected to then not exist for opaque types, because they will turn into aliases.
-//
-// Return a node that contains the non-aliased assignments that must continue to exist.
-TIntermTyped* HlslParseContext::executeFlattenedInitializer(const TSourceLoc& loc, TIntermSymbol* symbol,
-                                                            TIntermAggregate& initializer)
-{
-    // We need individual RHS initializers per member to do this
-    const TTypeList* typeList = symbol->getType().getStruct();
-    if (typeList == nullptr || initializer.getSequence().size() != typeList->size()) {
-        warn(loc, "cannot do member-wise aliasing for opaque members with this initializer", "=", "");
-        return handleAssign(loc, EOpAssign, symbol, &initializer);
-    }
-
-    TIntermAggregate* initList = nullptr;
-    // synthesize an access to each member, and then an assignment to it
-    for (int member = 0; member < (int)typeList->size(); ++member) {
-        TIntermTyped* memberInitializer = initializer.getSequence()[member]->getAsTyped();
-        TIntermTyped* flattenedMember = flattenAccess(symbol, member);
-        if (flattenedMember->getType().containsOpaque())
-            setOpaqueLvalue(flattenedMember, memberInitializer);
-        else
-            initList = intermediate.growAggregate(initList, handleAssign(loc, EOpAssign, flattenedMember,
-                                                  memberInitializer));
-    }
-
-    if (initList)
-        initList->setOperator(EOpSequence);
-    return initList;
-}
-
 // Some simple source assignments need to be flattened to a sequence
 // of AST assignments. Catch these and flatten, otherwise, pass through
 // to intermediate.addAssign().
@@ -2558,17 +2546,32 @@
     if (left == nullptr || right == nullptr)
         return nullptr;
 
+    // writing to opaques will require fixing transforms
+    if (left->getType().containsOpaque())
+        intermediate.setNeedsLegalization();
+
     if (left->getAsOperator() && left->getAsOperator()->getOp() == EOpMatrixSwizzle)
         return handleAssignToMatrixSwizzle(loc, op, left, right);
 
-    const bool isSplitLeft    = wasSplit(left);
-    const bool isSplitRight   = wasSplit(right);
+    // Return true if the given node is an index operation into a split variable.
+    const auto indexesSplit = [this](const TIntermTyped* node) -> bool {
+        const TIntermBinary* binaryNode = node->getAsBinaryNode();
+
+        if (binaryNode == nullptr)
+            return false;
+
+        return (binaryNode->getOp() == EOpIndexDirect || binaryNode->getOp() == EOpIndexIndirect) && 
+               wasSplit(binaryNode->getLeft());
+    };
+
+    const bool isSplitLeft    = wasSplit(left) || indexesSplit(left);
+    const bool isSplitRight   = wasSplit(right) || indexesSplit(right);
 
     const bool isFlattenLeft  = wasFlattened(left);
     const bool isFlattenRight = wasFlattened(right);
 
-    // OK to do a single assign if both are split, or both are unsplit.  But if one is and the other
-    // isn't, we fall back to a member-wise copy.
+    // OK to do a single assign if neither side is split or flattened.  Otherwise, 
+    // fall through to a member-wise copy.
     if (!isFlattenLeft && !isFlattenRight && !isSplitLeft && !isSplitRight) {
         // Clip and cull distance requires more processing.  See comment above assignClipCullDistance.
         if (isClipOrCullDistance(left->getType()) || isClipOrCullDistance(right->getType())) {
@@ -2630,30 +2633,29 @@
         }
     }
 
-    int memberIdx = 0;
-
     // When dealing with split arrayed structures of built-ins, the arrayness is moved to the extracted built-in
     // variables, which is awkward when copying between split and unsplit structures.  This variable tracks
     // array indirections so they can be percolated from outer structs to inner variables.
     std::vector <int> arrayElement;
 
-    // We track the outer-most aggregate, so that we can use its storage class later.
-    const TIntermTyped* outerLeft  = left;
-    const TIntermTyped* outerRight = right;
+    TStorageQualifier leftStorage = left->getType().getQualifier().storage;
+    TStorageQualifier rightStorage = right->getType().getQualifier().storage;
 
-    const auto getMember = [&](bool isLeft, TIntermTyped* node, int member, TIntermTyped* splitNode, int splitMember)
+    int leftOffset = findSubtreeOffset(*left);
+    int rightOffset = findSubtreeOffset(*right);
+
+    const auto getMember = [&](bool isLeft, const TType& type, int member, TIntermTyped* splitNode, int splitMember)
                            -> TIntermTyped * {
         const bool flattened = isLeft ? isFlattenLeft : isFlattenRight;
         const bool split     = isLeft ? isSplitLeft   : isSplitRight;
 
         TIntermTyped* subTree;
-        const TType derefType(node->getType(), member);
+        const TType derefType(type, member);
         const TVariable* builtInVar = nullptr;
         if ((flattened || split) && derefType.isBuiltIn()) {
-            const TIntermTyped* outer = isLeft ? outerLeft : outerRight;
             auto splitPair = splitBuiltIns.find(HlslParseContext::tInterstageIoData(
                                                    derefType.getQualifier().builtIn,
-                                                   outer->getType().getQualifier().storage));
+                                                   isLeft ? leftStorage : rightStorage));
             if (splitPair != splitBuiltIns.end())
                 builtInVar = splitPair->second;
         }
@@ -2670,12 +2672,14 @@
                 subTree->setType(splitDerefType);
             }
         } else if (flattened && isFinalFlattening(derefType)) {
-            const TVector<TVariable*>& flatVariables = isLeft ? *leftVariables : *rightVariables;
-            subTree = intermediate.addSymbol(*flatVariables[memberIdx++]);
+            if (isLeft)
+                subTree = intermediate.addSymbol(*(*leftVariables)[leftOffset++]);
+            else
+                subTree = intermediate.addSymbol(*(*rightVariables)[rightOffset++]);
         } else {
             // Index operator if it's an aggregate, else EOpNull
-            const TOperator accessOp = node->getType().isArray()  ? EOpIndexDirect
-                                     : node->getType().isStruct() ? EOpIndexDirectStruct
+            const TOperator accessOp = type.isArray()  ? EOpIndexDirect
+                                     : type.isStruct() ? EOpIndexDirectStruct
                                      : EOpNull;
             if (accessOp == EOpNull) {
                 subTree = splitNode;
@@ -2707,7 +2711,8 @@
             const int elementsL = left->getType().isArray()  ? left->getType().getOuterArraySize()  : 1;
             const int elementsR = right->getType().isArray() ? right->getType().getOuterArraySize() : 1;
 
-            // The arrays may not be the same size, e.g, if the size has been forced for EbvTessLevelInner or Outer.
+            // The arrays might not be the same size,
+            // e.g., if the size has been forced for EbvTessLevelInner/Outer.
             const int elementsToCopy = std::min(elementsL, elementsR);
 
             // array case
@@ -2715,12 +2720,12 @@
                 arrayElement.push_back(element);
 
                 // Add a new AST symbol node if we have a temp variable holding a complex RHS.
-                TIntermTyped* subLeft  = getMember(true,  left,  element, left, element);
-                TIntermTyped* subRight = getMember(false, right, element, right, element);
+                TIntermTyped* subLeft  = getMember(true,  left->getType(),  element, left, element);
+                TIntermTyped* subRight = getMember(false, right->getType(), element, right, element);
 
-                TIntermTyped* subSplitLeft =  isSplitLeft  ? getMember(true,  left,  element, splitLeft, element)
+                TIntermTyped* subSplitLeft =  isSplitLeft  ? getMember(true,  left->getType(),  element, splitLeft, element)
                                                            : subLeft;
-                TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right, element, splitRight, element)
+                TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right->getType(), element, splitRight, element)
                                                            : subRight;
 
                 traverse(subLeft, subRight, subSplitLeft, subSplitRight);
@@ -2745,13 +2750,13 @@
                 const TType& typeL = *membersL[member].type;
                 const TType& typeR = *membersR[member].type;
 
-                TIntermTyped* subLeft  = getMember(true,  left, member, left, member);
-                TIntermTyped* subRight = getMember(false, right, member, right, member);
+                TIntermTyped* subLeft  = getMember(true,  left->getType(), member, left, member);
+                TIntermTyped* subRight = getMember(false, right->getType(), member, right, member);
 
                 // If there is no splitting, use the same values to avoid inefficiency.
-                TIntermTyped* subSplitLeft =  isSplitLeft  ? getMember(true,  left,  member, splitLeft, memberL)
+                TIntermTyped* subSplitLeft =  isSplitLeft  ? getMember(true,  left->getType(),  member, splitLeft, memberL)
                                                            : subLeft;
-                TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right, member, splitRight, memberR)
+                TIntermTyped* subSplitRight = isSplitRight ? getMember(false, right->getType(), member, splitRight, memberR)
                                                            : subRight;
 
                 if (isClipOrCullDistance(subSplitLeft->getType()) || isClipOrCullDistance(subSplitRight->getType())) {
@@ -2803,8 +2808,25 @@
 
     // If either left or right was a split structure, we must read or write it, but still have to
     // parallel-recurse through the unsplit structure to identify the built-in IO vars.
-    if (isSplitLeft)
-        splitLeft = intermediate.addSymbol(*getSplitNonIoVar(left->getAsSymbolNode()->getId()), loc);
+    // The left can be either a symbol, or an index into a symbol (e.g, array reference)
+    if (isSplitLeft) {
+        if (indexesSplit(left)) {
+            // Index case: Refer to the indexed symbol, if the left is an index operator.
+            const TIntermSymbol* symNode = left->getAsBinaryNode()->getLeft()->getAsSymbolNode();
+
+            TIntermTyped* splitLeftNonIo = intermediate.addSymbol(*getSplitNonIoVar(symNode->getId()), loc);
+
+            splitLeft = intermediate.addIndex(left->getAsBinaryNode()->getOp(), splitLeftNonIo,
+                                              left->getAsBinaryNode()->getRight(), loc);
+
+            const TType derefType(splitLeftNonIo->getType(), 0);
+            splitLeft->setType(derefType);
+        } else {
+            // Symbol case: otherwise, if not indexed, we have the symbol directly.
+            const TIntermSymbol* symNode = left->getAsSymbolNode();
+            splitLeft = intermediate.addSymbol(*getSplitNonIoVar(symNode->getId()), loc);
+        }
+    }
 
     if (isSplitRight)
         splitRight = intermediate.addSymbol(*getSplitNonIoVar(right->getAsSymbolNode()->getId()), loc);
@@ -2914,7 +2936,66 @@
 
     TSampler samplerType = argTex->getType().getSampler();
     samplerType.combined = true;
-    samplerType.shadow   = argSampler->getType().getSampler().shadow;
+
+    // TODO:
+    // This block exists until the spec no longer requires shadow modes on texture objects.
+    // It can be deleted after that, along with the shadowTextureVariant member.
+    {
+        const bool shadowMode = argSampler->getType().getSampler().shadow;
+
+        TIntermSymbol* texSymbol = argTex->getAsSymbolNode();
+
+        if (texSymbol == nullptr)
+            texSymbol = argTex->getAsBinaryNode()->getLeft()->getAsSymbolNode();
+
+        if (texSymbol == nullptr) {
+            error(loc, "unable to find texture symbol", "", "");
+            return nullptr;
+        }
+
+        // This forces the texture's shadow state to be the sampler's
+        // shadow state.  This depends on downstream optimization to
+        // DCE one variant in [shadow, nonshadow] if both are present,
+        // or the SPIR-V module would be invalid.
+        int newId = texSymbol->getId();
+
+        // Check to see if this texture has been given a shadow mode already.
+        // If so, look up the one we already have.
+        const auto textureShadowEntry = textureShadowVariant.find(texSymbol->getId());
+
+        if (textureShadowEntry != textureShadowVariant.end())
+            newId = textureShadowEntry->second->get(shadowMode);
+        else
+            textureShadowVariant[texSymbol->getId()] = new tShadowTextureSymbols;
+
+        // Sometimes we have to create another symbol (if this texture has been seen before,
+        // and we haven't created the form for this shadow mode).
+        if (newId == -1) {
+            TType texType;
+            texType.shallowCopy(argTex->getType());
+            texType.getSampler().shadow = shadowMode;  // set appropriate shadow mode.
+            globalQualifierFix(loc, texType.getQualifier());
+
+            TVariable* newTexture = makeInternalVariable(texSymbol->getName(), texType);
+
+            trackLinkage(*newTexture);
+
+            newId = newTexture->getUniqueId();
+        }
+
+        assert(newId != -1);
+
+        if (textureShadowVariant.find(newId) == textureShadowVariant.end())
+            textureShadowVariant[newId] = textureShadowVariant[texSymbol->getId()];
+
+        textureShadowVariant[newId]->set(shadowMode, newId);
+
+        // Remember this shadow mode in the texture and the merged type.
+        argTex->getWritableType().getSampler().shadow = shadowMode;
+        samplerType.shadow = shadowMode;
+
+        texSymbol->setId(newId);
+    }
 
     txcombine->setType(TType(samplerType, EvqTemporary));
     txcombine->setLoc(loc);
@@ -4202,6 +4283,25 @@
             break;
         }
 
+    case EOpSubpassLoad:
+        {
+            const TIntermTyped* argSubpass = 
+                argAggregate ? argAggregate->getSequence()[0]->getAsTyped() :
+                arguments->getAsTyped();
+
+            const TSampler& sampler = argSubpass->getType().getSampler();
+
+            // subpass load: the multisample form is overloaded.  Here, we convert that to
+            // the EOpSubpassLoadMS opcode.
+            if (argAggregate != nullptr && argAggregate->getSequence().size() > 1)
+                node->getAsOperator()->setOp(EOpSubpassLoadMS);
+
+            node = convertReturn(node, sampler);
+
+            break;
+        }
+        
+
     default:
         break; // most pass through unchanged
     }
@@ -4994,8 +5094,10 @@
             // It's a constructor, of type 'type'.
             //
             result = handleConstructor(loc, arguments, type);
-            if (result == nullptr)
+            if (result == nullptr) {
                 error(loc, "cannot construct with these arguments", type.getCompleteString().c_str(), "");
+                return nullptr;
+            }
         }
     } else {
         //
@@ -7520,7 +7622,7 @@
         error(loc, "initializer requires a variable, not a member", identifier.c_str(), "");
         return nullptr;
     }
-    return executeInitializer(loc, initializer, variable, flattenVar);
+    return executeInitializer(loc, initializer, variable);
 }
 
 // Pick up global defaults from the provide global defaults into dst.
@@ -7588,8 +7690,7 @@
 // Returning nullptr just means there is no code to execute to handle the
 // initializer, which will, for example, be the case for constant initializers.
 //
-TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyped* initializer, TVariable* variable,
-                                                  bool flattened)
+TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyped* initializer, TVariable* variable)
 {
     //
     // Identifier must be of type constant, a global, or a temporary, and
@@ -7669,20 +7770,10 @@
         // normal assigning of a value to a variable...
         specializationCheck(loc, initializer->getType(), "initializer");
         TIntermSymbol* intermSymbol = intermediate.addSymbol(*variable, loc);
-
-        // If we are flattening, it could be due to setting opaques, which must be handled
-        // as aliases, and the 'initializer' node cannot actually be emitted, because it
-        // itself stores the result of the constructor, and we can't store to opaques.
-        // handleAssign() will emit the initializer.
-        TIntermNode* initNode = nullptr;
-        if (flattened && intermSymbol->getType().containsOpaque())
-            return executeFlattenedInitializer(loc, intermSymbol, *initializer->getAsAggregate());
-        else {
-            initNode = handleAssign(loc, EOpAssign, intermSymbol, initializer);
-            if (initNode == nullptr)
-                assignError(loc, "=", intermSymbol->getCompleteString(), initializer->getCompleteString());
-            return initNode;
-        }
+        TIntermNode* initNode = handleAssign(loc, EOpAssign, intermSymbol, initializer);
+        if (initNode == nullptr)
+            assignError(loc, "=", intermSymbol->getCompleteString(), initializer->getCompleteString());
+        return initNode;
     }
 
     return nullptr;
@@ -7760,6 +7851,14 @@
 
         return addConstructor(loc, initList, arrayType);
     } else if (type.isStruct()) {
+        // do we have implicit assignments to opaques?
+        for (size_t i = initList->getSequence().size(); i < type.getStruct()->size(); ++i) {
+            if ((*type.getStruct())[i].type->containsOpaque()) {
+                error(loc, "cannot implicitly initialize opaque members", "initializer list", "");
+                return nullptr;
+            }
+        }
+
         // lengthen list to be long enough
         lengthenList(loc, initList->getSequence(), static_cast<int>(type.getStruct()->size()), scalarInit);
 
@@ -7890,12 +7989,13 @@
 //
 TIntermTyped* HlslParseContext::addConstructor(const TSourceLoc& loc, TIntermTyped* node, const TType& type)
 {
+    TIntermAggregate* aggrNode = node->getAsAggregate();
     TOperator op = intermediate.mapTypeToConstructorOp(type);
 
     // Combined texture-sampler constructors are completely semantic checked
     // in constructorTextureSamplerError()
     if (op == EOpConstructTextureSampler)
-        return intermediate.setAggregateOperator(node->getAsAggregate(), op, type, loc);
+        return intermediate.setAggregateOperator(aggrNode, op, type, loc);
 
     TTypeList::const_iterator memberTypes;
     if (op == EOpConstructStruct)
@@ -7909,9 +8009,8 @@
         elementType.shallowCopy(type);
 
     bool singleArg;
-    TIntermAggregate* aggrNode = node->getAsAggregate();
     if (aggrNode != nullptr) {
-        if (aggrNode->getOp() != EOpNull || aggrNode->getSequence().size() == 1)
+        if (aggrNode->getOp() != EOpNull)
             singleArg = true;
         else
             singleArg = false;
@@ -7927,7 +8026,7 @@
             newNode = convertArray(node, type);
 
         // If structure constructor or array constructor is being called
-        // for only one parameter inside the structure, we need to call constructAggregate function once.
+        // for only one parameter inside the aggregate, we need to call constructAggregate function once.
         else if (type.isArray())
             newNode = constructAggregate(node, elementType, 1, node->getLoc());
         else if (op == EOpConstructStruct)
@@ -7951,7 +8050,7 @@
     //
     // Handle list of arguments.
     //
-    TIntermSequence &sequenceVector = aggrNode->getSequence();    // Stores the information about the parameter to the constructor
+    TIntermSequence& sequenceVector = aggrNode->getSequence();    // Stores the information about the parameter to the constructor
     // if the structure constructor contains more than one parameter, then construct
     // each parameter
 
@@ -8342,8 +8441,9 @@
         return;
     }
 
-    // Save it in the AST for linker use.
-    trackLinkage(variable);
+	// Save it in the AST for linker use.
+    if (symbolTable.atGlobalLevel())
+        trackLinkage(variable);
 }
 
 //
@@ -9063,6 +9163,12 @@
         return false;
     }
 
+    // TODO: Subpass doesn't handle struct returns, due to some oddities with fn overloading.
+    if (sampler.isSubpass()) {
+        error(loc, "Unimplemented: structure template type in subpass input", "", "");
+        return false;
+    }
+
     TTypeList* members = retType.getWritableStruct();
 
     // Check for too many or not enough structure members.
@@ -9148,19 +9254,12 @@
     return intermediate.addSymbol(*it->second->getAsVariable());
 }
 
-// Finalization step: Add patch constant function invocation
-void HlslParseContext::addPatchConstantInvocation()
+// Find the patch constant function (issues error, returns nullptr if not found)
+const TFunction* HlslParseContext::findPatchConstantFunction(const TSourceLoc& loc)
 {
-    TSourceLoc loc;
-    loc.init();
-
-    // If there's no patch constant function, or we're not a HS, do nothing.
-    if (patchConstantFunctionName.empty() || language != EShLangTessControl)
-        return;
-
     if (symbolTable.isFunctionNameVariable(patchConstantFunctionName)) {
         error(loc, "can't use variable in patch constant function", patchConstantFunctionName.c_str(), "");
-        return;
+        return nullptr;
     }
 
     const TString mangledName = patchConstantFunctionName + "(";
@@ -9174,7 +9273,7 @@
     // allow any disambiguation of overloads.
     if (candidateList.empty()) {
         error(loc, "patch constant function not found", patchConstantFunctionName.c_str(), "");
-        return;
+        return nullptr;
     }
 
     // Based on directed experiments, it appears that if there are overloaded patchconstantfunctions,
@@ -9182,9 +9281,22 @@
     // out if there is more than one candidate.
     if (candidateList.size() > 1) {
         error(loc, "ambiguous patch constant function", patchConstantFunctionName.c_str(), "");
-        return;
+        return nullptr;
     }
 
+    return candidateList[0];
+}
+
+// Finalization step: Add patch constant function invocation
+void HlslParseContext::addPatchConstantInvocation()
+{
+    TSourceLoc loc;
+    loc.init();
+
+    // If there's no patch constant function, or we're not a HS, do nothing.
+    if (patchConstantFunctionName.empty() || language != EShLangTessControl)
+        return;
+
     // Look for built-in variables in a function's parameter list.
     const auto findBuiltIns = [&](const TFunction& function, std::set<tInterstageIoData>& builtIns) {
         for (int p=0; p<function.getParamCount(); ++p) {
@@ -9249,7 +9361,13 @@
     // 
     // 5/5B. Call the PCF inside an if test for (invocation id == 0).
 
-    TFunction& patchConstantFunction = const_cast<TFunction&>(*candidateList[0]);
+    TFunction* patchConstantFunctionPtr = const_cast<TFunction*>(findPatchConstantFunction(loc));
+
+    if (patchConstantFunctionPtr == nullptr)
+        return;
+
+    TFunction& patchConstantFunction = *patchConstantFunctionPtr;
+
     const int pcfParamCount = patchConstantFunction.getParamCount();
     TIntermSymbol* invocationIdSym = findTessLinkageSymbol(EbvInvocationId);
     TIntermSequence& epBodySeq = entryPointFunctionBody->getAsAggregate()->getSequence();
@@ -9330,10 +9448,9 @@
 
     // ================ Step 1B: Argument synthesis ================
     // Create pcfArguments for synthesis of patchconstantfunction invocation
-    // TODO: handle struct or array inputs
     {
         for (int p=0; p<pcfParamCount; ++p) {
-            TIntermSymbol* inputArg = nullptr;
+            TIntermTyped* inputArg = nullptr;
 
             if (p == outPatchParam) {
                 if (perCtrlPtVar == nullptr) {
@@ -9347,6 +9464,11 @@
                 // find which built-in it is
                 const TBuiltInVariable biType = patchConstantFunction[p].getDeclaredBuiltIn();
                 
+                if (biType == EbvInputPatch && inputPatch == nullptr) {
+                    error(loc, "unimplemented: PCF input patch without entry point input patch parameter", "", "");
+                    return;
+                }
+
                 inputArg = findTessLinkageSymbol(biType);
 
                 if (inputArg == nullptr) {
@@ -9530,6 +9652,26 @@
     linkageSymbols.erase(endIt, linkageSymbols.end());
 }
 
+// Finalization step: patch texture shadow modes to match samplers they were combined with
+void HlslParseContext::fixTextureShadowModes()
+{
+    for (auto symbol = linkageSymbols.begin(); symbol != linkageSymbols.end(); ++symbol) {
+        TSampler& sampler = (*symbol)->getWritableType().getSampler();
+
+        if (sampler.isTexture()) {
+            const auto shadowMode = textureShadowVariant.find((*symbol)->getUniqueId());
+            if (shadowMode != textureShadowVariant.end()) {
+
+                if (shadowMode->second->overloaded())
+                    // Texture needs legalization if it's been seen with both shadow and non-shadow modes.
+                    intermediate.setNeedsLegalization();
+
+                sampler.shadow = shadowMode->second->isShadowId((*symbol)->getUniqueId());
+            }
+        }
+    }
+}
+
 // post-processing
 void HlslParseContext::finish()
 {
@@ -9541,6 +9683,12 @@
 
     removeUnusedStructBufferCounters();
     addPatchConstantInvocation();
+    fixTextureShadowModes();
+
+    // Communicate out (esp. for command line) that we formed AST that will make
+    // illegal AST SPIR-V and it needs transforms to legalize it.
+    if (intermediate.needsLegalization())
+        infoSink.info << "WARNING: AST will form illegal SPIR-V; need to transform to legalize";
 
     TParseContextBase::finish();
 }
diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h
index 3f654e0..e4c15a1 100755
--- a/hlsl/hlslParseHelper.h
+++ b/hlsl/hlslParseHelper.h
@@ -73,7 +73,6 @@
     TIntermTyped* handleVariable(const TSourceLoc&, const TString* string);
     TIntermTyped* handleBracketDereference(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
     TIntermTyped* handleBracketOperator(const TSourceLoc&, TIntermTyped* base, TIntermTyped* index);
-    void checkIndex(const TSourceLoc&, const TType&, int& index);
 
     TIntermTyped* handleBinaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right);
     TIntermTyped* handleUnaryMath(const TSourceLoc&, const char* str, TOperator op, TIntermTyped* childNode);
@@ -84,12 +83,12 @@
     TIntermAggregate* handleFunctionDefinition(const TSourceLoc&, TFunction&, const TAttributeMap&, TIntermNode*& entryPointTree);
     TIntermNode* transformEntryPoint(const TSourceLoc&, TFunction&, const TAttributeMap&);
     void handleEntryPointAttributes(const TSourceLoc&, const TAttributeMap&);
+    void transferTypeAttributes(const TAttributeMap&, TType&);
     void handleFunctionBody(const TSourceLoc&, TFunction&, TIntermNode* functionBody, TIntermNode*& node);
     void remapEntryPointIO(TFunction& function, TVariable*& returnValue, TVector<TVariable*>& inputs, TVector<TVariable*>& outputs);
     void remapNonEntryPointIO(TFunction& function);
     TIntermNode* handleReturnValue(const TSourceLoc&, TIntermTyped*);
     void handleFunctionArgument(TFunction*, TIntermTyped*& arguments, TIntermTyped* newArg);
-    TIntermTyped* executeFlattenedInitializer(const TSourceLoc&, TIntermSymbol*, TIntermAggregate&);
     TIntermTyped* handleAssign(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right);
     TIntermTyped* handleAssignToMatrixSwizzle(const TSourceLoc&, TOperator, TIntermTyped* left, TIntermTyped* right);
     TIntermTyped* handleFunctionCall(const TSourceLoc&, TFunction*, TIntermTyped*);
@@ -192,8 +191,6 @@
 
     // Apply L-value conversions.  E.g, turning a write to a RWTexture into an ImageStore.
     TIntermTyped* handleLvalue(const TSourceLoc&, const char* op, TIntermTyped*& node);
-    TIntermTyped* handleSamplerLvalue(const TSourceLoc&, const char* op, TIntermTyped*& node);
-    TIntermTyped* setOpaqueLvalue(TIntermTyped* left, TIntermTyped* right);
     bool lValueErrorCheck(const TSourceLoc&, const char* op, TIntermTyped*) override;
 
     TLayoutFormat getLayoutFromTxType(const TSourceLoc&, const TType&);
@@ -237,7 +234,7 @@
     TIntermSymbol* makeInternalVariableNode(const TSourceLoc&, const char* name, const TType&) const;
     TVariable* declareNonArray(const TSourceLoc&, const TString& identifier, const TType&, bool track);
     void declareArray(const TSourceLoc&, const TString& identifier, const TType&, TSymbol*&, bool track);
-    TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable, bool flattened);
+    TIntermNode* executeInitializer(const TSourceLoc&, TIntermTyped* initializer, TVariable* variable);
     TIntermTyped* convertInitializerList(const TSourceLoc&, const TType&, TIntermTyped* initializer, TIntermTyped* scalarInit);
     bool isScalarConstructor(const TIntermNode*);
     TOperator mapAtomicOp(const TSourceLoc& loc, TOperator op, bool isImage);
@@ -248,6 +245,8 @@
     // Array and struct flattening
     TIntermTyped* flattenAccess(TIntermTyped* base, int member);
     TIntermTyped* flattenAccess(int uniqueId, int member, const TType&, int subset = -1);
+    int findSubtreeOffset(const TIntermNode&) const;
+    int findSubtreeOffset(const TType&, int subset, const TVector<int>& offsets) const;
     bool shouldFlatten(const TType&) const;
     bool wasFlattened(const TIntermTyped* node) const;
     bool wasFlattened(int id) const { return flattenMap.find(id) != flattenMap.end(); }
@@ -263,6 +262,7 @@
     bool wasSplit(int id) const { return splitNonIoVars.find(id) != splitNonIoVars.end(); }
     TVariable* getSplitNonIoVar(int id) const;
     void addPatchConstantInvocation();
+    void fixTextureShadowModes();
     TIntermTyped* makeIntegerIndex(TIntermTyped*);
 
     void fixBuiltInIoType(TType&);
@@ -316,6 +316,9 @@
     static bool isClipOrCullDistance(const TQualifier& qual) { return isClipOrCullDistance(qual.builtIn); }
     static bool isClipOrCullDistance(const TType& type) { return isClipOrCullDistance(type.getQualifier()); }
 
+    // Find the patch constant function (issues error, returns nullptr if not found)
+    const TFunction* findPatchConstantFunction(const TSourceLoc& loc);
+
     // Pass through to base class after remembering built-in mappings.
     using TParseContextBase::trackLinkage;
     void trackLinkage(TSymbol& variable) override;
@@ -415,7 +418,8 @@
     };
 
     TMap<tInterstageIoData, TVariable*> splitBuiltIns; // split built-ins, indexed by built-in type.
-    TVariable* inputPatch;
+    TVariable* inputPatch; // input patch is special for PCF: it's the only non-builtin PCF input,
+                           // and is handled as a pseudo-builtin.
 
     unsigned int nextInLocation;
     unsigned int nextOutLocation;
@@ -452,6 +456,30 @@
     };
 
     TVector<tMipsOperatorData> mipsOperatorMipArg;
+
+    // A texture object may be used with shadow and non-shadow samplers, but both may not be
+    // alive post-DCE in the same shader.  We do not know at compilation time which are alive: that's
+    // only known post-DCE.  If a texture is used both ways, we create two textures, and
+    // leave the elimiation of one to the optimizer.  This maps the shader variant to
+    // the shadow variant.
+    //
+    // This can be removed if and when the texture shadow code in
+    // HlslParseContext::handleSamplerTextureCombine is removed.
+    struct tShadowTextureSymbols {
+        tShadowTextureSymbols() { symId.fill(-1); }
+
+        void set(bool shadow, int id) { symId[int(shadow)] = id; }
+        int get(bool shadow) const { return symId[int(shadow)]; }
+
+        // True if this texture has been seen with both shadow and non-shadow modes
+        bool overloaded() const { return symId[0] != -1 && symId[1] != -1; }
+        bool isShadowId(int id) const { return symId[1] == id; }
+
+    private:
+        std::array<int, 2> symId;
+    };
+
+    TMap<int, tShadowTextureSymbols*> textureShadowVariant;
 };
 
 // This is the prefix we use for built-in methods to avoid namespace collisions with
diff --git a/hlsl/hlslParseables.cpp b/hlsl/hlslParseables.cpp
index 851d412..946d91b 100755
--- a/hlsl/hlslParseables.cpp
+++ b/hlsl/hlslParseables.cpp
@@ -68,14 +68,21 @@
     }
 }
 
-bool IsSamplerType(const char argType) { return argType == 'S' || argType == 's'; }
-bool IsArrayed(const char argOrder)    { return argOrder == '@' || argOrder == '&' || argOrder == '#'; }
-bool IsTextureMS(const char argOrder)  { return argOrder == '$' || argOrder == '&'; }
-bool IsBuffer(const char argOrder)     { return argOrder == '*' || argOrder == '~'; }
-bool IsImage(const char argOrder)      { return argOrder == '!' || argOrder == '#' || argOrder == '~'; }
+// arg order queries
+bool IsSamplerType(const char argType)     { return argType == 'S' || argType == 's'; }
+bool IsArrayed(const char argOrder)        { return argOrder == '@' || argOrder == '&' || argOrder == '#'; }
+bool IsTextureNonMS(const char argOrder)   { return argOrder == '%'; }
+bool IsSubpassInput(const char argOrder)   { return argOrder == '[' || argOrder == ']'; }
+bool IsArrayedTexture(const char argOrder) { return argOrder == '@'; }
+bool IsTextureMS(const char argOrder)      { return argOrder == '$' || argOrder == '&'; }
+bool IsMS(const char argOrder)             { return IsTextureMS(argOrder) || argOrder == ']'; }
+bool IsBuffer(const char argOrder)         { return argOrder == '*' || argOrder == '~'; }
+bool IsImage(const char argOrder)          { return argOrder == '!' || argOrder == '#' || argOrder == '~'; }
+
 bool IsTextureType(const char argOrder)
 {
-    return argOrder == '%' || argOrder == '@' || IsTextureMS(argOrder) || IsBuffer(argOrder) | IsImage(argOrder);
+    return IsTextureNonMS(argOrder) || IsArrayedTexture(argOrder) ||
+           IsTextureMS(argOrder) || IsBuffer(argOrder) || IsImage(argOrder);
 }
 
 // Reject certain combinations that are illegal sample methods.  For example,
@@ -222,15 +229,16 @@
     const bool isTexture   = IsTextureType(argOrder[0]);
     const bool isArrayed   = IsArrayed(argOrder[0]);
     const bool isSampler   = IsSamplerType(argType[0]);
-    const bool isMS        = IsTextureMS(argOrder[0]);
+    const bool isMS        = IsMS(argOrder[0]);
     const bool isBuffer    = IsBuffer(argOrder[0]);
     const bool isImage     = IsImage(argOrder[0]);
+    const bool isSubpass   = IsSubpassInput(argOrder[0]);
 
     char type  = *argType;
 
     if (isTranspose) {  // Take transpose of matrix dimensions
         std::swap(dim0, dim1);
-    } else if (isTexture) {
+    } else if (isTexture || isSubpass) {
         if (type == 'F')       // map base type to texture of that type.
             type = 'T';        // e.g, int -> itexture, uint -> utexture, etc.
         else if (type == 'I')
@@ -257,16 +265,23 @@
         case 'S': s += "sampler";                             break;
         case 's': s += "SamplerComparisonState";              break;
         case 'T': s += ((isBuffer && isImage) ? "RWBuffer" :
+                        isSubpass ? "SubpassInput" :
                         isBuffer ? "Buffer" :
                         isImage  ? "RWTexture" : "Texture");  break;
         case 'i': s += ((isBuffer && isImage) ? "RWBuffer" :
+                        isSubpass ? "SubpassInput" :
                         isBuffer ? "Buffer" :
                         isImage ? "RWTexture" : "Texture");   break;
         case 'u': s += ((isBuffer && isImage) ? "RWBuffer" :
+                        isSubpass ? "SubpassInput" :
                         isBuffer ? "Buffer" :
                         isImage ? "RWTexture" : "Texture");   break;
         default:  s += "UNKNOWN_TYPE";                        break;
         }
+
+        if (isSubpass && isMS)
+            s += "MS";
+
     } else {
         switch (type) {
         case '-': s += "void"; break;
@@ -284,6 +299,7 @@
                 s += type;
 
             s += ((isImage && isBuffer) ? "imageBuffer"   :
+                  isSubpass             ? "subpassInput" :
                   isImage               ? "image"         :
                   isBuffer              ? "samplerBuffer" :
                   "texture");
@@ -298,6 +314,9 @@
     if (fixedVecSize != 0)
         dim0 = dim1 = fixedVecSize;
 
+    const char dim0Char = ('0' + char(dim0));
+    const char dim1Char = ('0' + char(dim1));
+
     // Add sampler dimensions
     if (isSampler || isTexture) {
         if ((order == 'V' || isTexture) && !isBuffer) {
@@ -322,12 +341,12 @@
         case '-': break;  // no dimensions for voids
         case 'S': break;  // no dimensions on scalars
         case 'V':
-            s += ('0' + char(dim0));
+            s += dim0Char;
             break;
         case 'M':
-            s += ('0' + char(dim0));
+            s += dim0Char;
             s += 'x';
-            s += ('0' + char(dim1));
+            s += dim1Char;
             break;
         default:
             break;
@@ -341,9 +360,9 @@
     // For HLSL, append return type for texture types
     if (UseHlslTypes) {
         switch (type) {
-        case 'i': s += "<int4>";   break;
-        case 'u': s += "<uint4>";  break;
-        case 'T': s += "<float4>"; break;
+        case 'i': s += "<int";   s += dim0Char; s += ">"; break;
+        case 'u': s += "<uint";  s += dim0Char; s += ">"; break;
+        case 'T': s += "<float"; s += dim0Char; s += ">"; break;
         default: break;
         }
     }
@@ -416,7 +435,7 @@
         const char* nthArgOrder(NthArg(argOrder, arg));
         if (nthArgOrder == nullptr)
             break;
-        else if (*nthArgOrder == 'V')
+        else if (*nthArgOrder == 'V' || IsSubpassInput(*nthArgOrder))
             dim0Max = 4;
         else if (*nthArgOrder == 'M')
             dim0Max = dim1Max = 4;
@@ -539,6 +558,7 @@
     // '!' as first letter of order creates image object
     // '#' as first letter of order creates arrayed image object
     // '~' as first letter of order creates an image buffer object
+    // '[' / ']' as first letter of order creates a SubpassInput/SubpassInputMS object
 
     static const struct {
         const char*   name;      // intrinsic name
@@ -910,6 +930,10 @@
         { "WaveGetOrderedIndex",              "S",     "U",       "-",              "-",              EShLangPSCS,  false},
         { "GlobalOrderedCountIncrement",      "S",     "U",       "S",              "U",              EShLangPSCS,  false},
 
+        // Methods for subpass input objects
+        { "SubpassLoad",                      "V4",    nullptr,   "[",              "FIU",            EShLangPS,    true },
+        { "SubpassLoad",                      "V4",    nullptr,   "],S",            "FIU,I",          EShLangPS,    true },
+
         // Mark end of list, since we want to avoid a range-based for, as some compilers don't handle it yet.
         { nullptr,                            nullptr, nullptr,   nullptr,      nullptr,  0, false },
     };
@@ -1273,6 +1297,10 @@
     symbolTable.relateToOperator("QuadSwapY",                                  EOpSubgroupQuadSwapVertical);
     symbolTable.relateToOperator("WaveGetOrderedIndex",                        EOpWaveGetOrderedIndex);
     symbolTable.relateToOperator("GlobalOrderedCountIncrement",                EOpGlobalOrderedCountIncrement);
+
+    // Subpass input methods
+    symbolTable.relateToOperator(BUILTIN_PREFIX "SubpassLoad",                 EOpSubpassLoad);
+    symbolTable.relateToOperator(BUILTIN_PREFIX "SubpassLoadMS",               EOpSubpassLoadMS);
 }
 
 //
diff --git a/hlsl/hlslScanContext.cpp b/hlsl/hlslScanContext.cpp
index ea6e6c0..c6fb122 100755
--- a/hlsl/hlslScanContext.cpp
+++ b/hlsl/hlslScanContext.cpp
@@ -337,6 +337,8 @@
     (*KeywordMap)["RWTexture2DArray"] =        EHTokRWTexture2darray;
     (*KeywordMap)["RWTexture3D"] =             EHTokRWTexture3d;
     (*KeywordMap)["RWBuffer"] =                EHTokRWBuffer;
+    (*KeywordMap)["SubpassInput"] =            EHTokSubpassInput;
+    (*KeywordMap)["SubpassInputMS"] =          EHTokSubpassInputMS;
 
     (*KeywordMap)["AppendStructuredBuffer"] =  EHTokAppendStructuredBuffer;
     (*KeywordMap)["ByteAddressBuffer"] =       EHTokByteAddressBuffer;
@@ -829,6 +831,8 @@
     case EHTokRWByteAddressBuffer:
     case EHTokRWStructuredBuffer:
     case EHTokStructuredBuffer:
+    case EHTokSubpassInput:
+    case EHTokSubpassInputMS:
         return keyword;
 
     // variable, user type, ...
diff --git a/hlsl/hlslTokens.h b/hlsl/hlslTokens.h
index bb27fe3..621e272 100755
--- a/hlsl/hlslTokens.h
+++ b/hlsl/hlslTokens.h
@@ -274,6 +274,8 @@
     EHTokRWTexture2darray,
     EHTokRWTexture3d,
     EHTokRWBuffer,
+    EHTokSubpassInput,
+    EHTokSubpassInputMS,
 
     // Structure buffer variants
     EHTokAppendStructuredBuffer,
diff --git a/known_good.json b/known_good.json
new file mode 100644
index 0000000..4e59cd3
--- /dev/null
+++ b/known_good.json
@@ -0,0 +1,18 @@
+{
+  "commits" : [
+    {
+      "name" : "spirv-tools",
+      "site" : "github",
+      "subrepo" : "KhronosGroup/SPIRV-Tools",
+      "subdir" : "External/spirv-tools",
+      "commit" : "99cd25c4139e0dc914ab8a5a3b75e6fed0ad1329"
+    },
+    {
+      "name" : "spirv-tools/external/spirv-headers",
+      "site" : "github",
+      "subrepo" : "KhronosGroup/SPIRV-Headers",
+      "subdir" : "External/spirv-tools/external/spirv-headers",
+      "commit" : "2bb92e6fe2c6aa410152fc6c63443f452acb1a65"
+    }
+  ]
+}
diff --git a/update_glslang_sources.py b/update_glslang_sources.py
new file mode 100755
index 0000000..b2988f9
--- /dev/null
+++ b/update_glslang_sources.py
@@ -0,0 +1,151 @@
+#!/usr/bin/env python
+
+# Copyright 2017 The Glslang Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Get source files for Glslang and its dependencies from public repositories.
+"""
+
+from __future__ import print_function
+
+import argparse
+import json
+import distutils.dir_util
+import os.path
+import subprocess
+import sys
+
+KNOWN_GOOD_FILE = 'known_good.json'
+
+# Maps a site name to its hostname.
+SITE_TO_HOST = { 'github' : 'github.com' }
+
+VERBOSE = True
+
+
+def command_output(cmd, directory, fail_ok=False):
+    """Runs a command in a directory and returns its standard output stream.
+
+    Captures the standard error stream.
+
+    Raises a RuntimeError if the command fails to launch or otherwise fails.
+    """
+    if VERBOSE:
+        print('In {d}: {cmd}'.format(d=directory, cmd=cmd))
+    p = subprocess.Popen(cmd,
+                         cwd=directory,
+                         stdout=subprocess.PIPE)
+    (stdout, _) = p.communicate()
+    if p.returncode != 0 and not fail_ok:
+        raise RuntimeError('Failed to run {} in {}'.format(cmd, directory))
+    if VERBOSE:
+        print(stdout)
+    return stdout
+
+
+def command_retval(cmd, directory):
+    """Runs a command in a directory and returns its return value.
+
+    Captures the standard error stream.
+    """
+    p = subprocess.Popen(cmd,
+                         cwd=directory,
+                         stdout=subprocess.PIPE)
+    (stdout, _) = p.communicate()
+    return p.returncode
+
+
+class GoodCommit(object):
+    """Represents a good commit for a repository."""
+
+    def __init__(self, json):
+        """Initializes this good commit object.
+
+        Args:
+        'json':  A fully populated JSON object describing the commit.
+        """
+        self._json = json
+        self.name = json['name']
+        self.site = json['site']
+        self.subrepo = json['subrepo']
+        self.subdir = json['subdir'] if ('subdir' in json) else '.'
+        self.commit = json['commit']
+
+    def GetUrl(self, style='https'):
+        """Returns the URL for the repository."""
+        host = SITE_TO_HOST[self.site]
+        sep = '/' if (style is 'https') else ':'
+        return '{style}://{host}{sep}{subrepo}'.format(
+                    style=style,
+                    host=host,
+                    sep=sep,
+                    subrepo=self.subrepo)
+
+    def AddRemote(self):
+        """Add the remote 'known-good' if it does not exist."""
+        print('Ignore "fatal" errors for missing known-good remote:')
+        if command_retval(['git', 'remote', 'show', 'known-good'], self.subdir) != 0:
+            command_output(['git', 'remote', 'add', 'known-good', self.GetUrl()], self.subdir)
+
+    def HasCommit(self):
+        """Check if the repository contains the known-good commit."""
+        return 0 == subprocess.call(['git', 'rev-parse', '--verify', '--quiet',
+                                     self.commit + "^{commit}"],
+                                    cwd=self.subdir)
+
+    def Clone(self):
+        distutils.dir_util.mkpath(self.subdir)
+        command_output(['git', 'clone', self.GetUrl(), '.'], self.subdir)
+
+    def Fetch(self):
+        command_output(['git', 'fetch', 'known-good'], self.subdir)
+
+    def Checkout(self):
+        if not os.path.exists(os.path.join(self.subdir,'.git')):
+            self.Clone()
+        self.AddRemote()
+        if not self.HasCommit():
+            self.Fetch()
+        command_output(['git', 'checkout', self.commit], self.subdir)
+
+
+def GetGoodCommits():
+    """Returns the latest list of GoodCommit objects."""
+    with open(KNOWN_GOOD_FILE) as known_good:
+        return [GoodCommit(c) for c in json.loads(known_good.read())['commits']]
+
+
+def main():
+    parser = argparse.ArgumentParser(description='Get Glslang source dependencies at a known-good commit')
+    parser.add_argument('--dir', dest='dir', default='.',
+                        help="Set target directory for Glslang source root. Default is \'.\'.")
+
+    args = parser.parse_args()
+
+    commits = GetGoodCommits()
+
+    distutils.dir_util.mkpath(args.dir)
+    print('Change directory to {d}'.format(d=args.dir))
+    os.chdir(args.dir)
+
+    # Create the subdirectories in sorted order so that parent git repositories
+    # are created first.
+    for c in sorted(commits, cmp=lambda x,y: cmp(x.subdir, y.subdir)):
+        print('Get {n}\n'.format(n=c.name))
+        c.Checkout()
+    sys.exit(0)
+
+
+if __name__ == '__main__':
+    main()