HLSL: phase 3b: Texture methods remember and return vector size.

Also makes a (correct) test change for global -> temp vars.
diff --git a/Test/baseResults/hlsl.array.flatten.frag.out b/Test/baseResults/hlsl.array.flatten.frag.out
index 185c2cc..cbfb0ef 100644
--- a/Test/baseResults/hlsl.array.flatten.frag.out
+++ b/Test/baseResults/hlsl.array.flatten.frag.out
@@ -6,7 +6,7 @@
 0:17    Function Parameters: 
 0:?     Sequence
 0:18      Branch: Return with expression
-0:18        texture (global 4-component vector of float)
+0:18        texture (temp 4-component vector of float)
 0:18          Construct combined texture-sampler (temp sampler1D)
 0:?             'g_tex[1]' (uniform texture1D)
 0:?             'g_samp[1]' (uniform sampler)
@@ -18,7 +18,7 @@
 0:22      'l_samp' (in 3-element array of sampler)
 0:?     Sequence
 0:23      Branch: Return with expression
-0:23        texture (global 4-component vector of float)
+0:23        texture (temp 4-component vector of float)
 0:23          Construct combined texture-sampler (temp sampler1D)
 0:23            direct index (temp texture1D)
 0:23              'l_tex' (in 3-element array of texture1D)
@@ -165,7 +165,7 @@
 0:17    Function Parameters: 
 0:?     Sequence
 0:18      Branch: Return with expression
-0:18        texture (global 4-component vector of float)
+0:18        texture (temp 4-component vector of float)
 0:18          Construct combined texture-sampler (temp sampler1D)
 0:?             'g_tex[1]' (uniform texture1D)
 0:?             'g_samp[1]' (uniform sampler)
@@ -177,7 +177,7 @@
 0:22      'l_samp' (in 3-element array of sampler)
 0:?     Sequence
 0:23      Branch: Return with expression
-0:23        texture (global 4-component vector of float)
+0:23        texture (temp 4-component vector of float)
 0:23          Construct combined texture-sampler (temp sampler1D)
 0:23            direct index (temp texture1D)
 0:23              'l_tex' (in 3-element array of texture1D)
diff --git a/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out b/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out
index 87e9680..6d64b94 100644
--- a/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out
+++ b/Test/baseResults/hlsl.load.buffer.float.dx10.frag.out
@@ -8,30 +8,33 @@
 0:28      Sequence
 0:28        move second child to first child (temp float)
 0:28          'r00' (temp float)
-0:28          textureFetch (temp float)
-0:28            'g_tTexbfs' (layout(r32f ) uniform samplerBuffer)
-0:28            c1: direct index for structure (layout(offset=0 ) uniform int)
-0:28              'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
-0:28              Constant:
-0:28                0 (const uint)
+0:28          Construct float (temp float)
+0:?             textureFetch (temp 4-component vector of float)
+0:28              'g_tTexbfs' (layout(r32f ) uniform samplerBuffer)
+0:28              c1: direct index for structure (layout(offset=0 ) uniform int)
+0:28                'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
+0:28                Constant:
+0:28                  0 (const uint)
 0:29      Sequence
 0:29        move second child to first child (temp int)
 0:29          'r01' (temp int)
-0:29          textureFetch (temp int)
-0:29            'g_tTexbis' (layout(r32i ) uniform isamplerBuffer)
-0:29            c1: direct index for structure (layout(offset=0 ) uniform int)
-0:29              'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
-0:29              Constant:
-0:29                0 (const uint)
+0:29          Construct int (temp int)
+0:?             textureFetch (temp 4-component vector of int)
+0:29              'g_tTexbis' (layout(r32i ) uniform isamplerBuffer)
+0:29              c1: direct index for structure (layout(offset=0 ) uniform int)
+0:29                'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
+0:29                Constant:
+0:29                  0 (const uint)
 0:30      Sequence
 0:30        move second child to first child (temp uint)
 0:30          'r02' (temp uint)
-0:30          textureFetch (temp uint)
-0:30            'g_tTexbus' (layout(r32ui ) uniform usamplerBuffer)
-0:30            c1: direct index for structure (layout(offset=0 ) uniform int)
-0:30              'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
-0:30              Constant:
-0:30                0 (const uint)
+0:30          Construct uint (temp uint)
+0:?             textureFetch (temp 4-component vector of uint)
+0:30              'g_tTexbus' (layout(r32ui ) uniform usamplerBuffer)
+0:30              c1: direct index for structure (layout(offset=0 ) uniform int)
+0:30                'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
+0:30                Constant:
+0:30                  0 (const uint)
 0:34      move second child to first child (temp 4-component vector of float)
 0:34        Color: direct index for structure (temp 4-component vector of float)
 0:34          'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
@@ -86,30 +89,33 @@
 0:28      Sequence
 0:28        move second child to first child (temp float)
 0:28          'r00' (temp float)
-0:28          textureFetch (temp float)
-0:28            'g_tTexbfs' (layout(r32f ) uniform samplerBuffer)
-0:28            c1: direct index for structure (layout(offset=0 ) uniform int)
-0:28              'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
-0:28              Constant:
-0:28                0 (const uint)
+0:28          Construct float (temp float)
+0:?             textureFetch (temp 4-component vector of float)
+0:28              'g_tTexbfs' (layout(r32f ) uniform samplerBuffer)
+0:28              c1: direct index for structure (layout(offset=0 ) uniform int)
+0:28                'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
+0:28                Constant:
+0:28                  0 (const uint)
 0:29      Sequence
 0:29        move second child to first child (temp int)
 0:29          'r01' (temp int)
-0:29          textureFetch (temp int)
-0:29            'g_tTexbis' (layout(r32i ) uniform isamplerBuffer)
-0:29            c1: direct index for structure (layout(offset=0 ) uniform int)
-0:29              'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
-0:29              Constant:
-0:29                0 (const uint)
+0:29          Construct int (temp int)
+0:?             textureFetch (temp 4-component vector of int)
+0:29              'g_tTexbis' (layout(r32i ) uniform isamplerBuffer)
+0:29              c1: direct index for structure (layout(offset=0 ) uniform int)
+0:29                'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
+0:29                Constant:
+0:29                  0 (const uint)
 0:30      Sequence
 0:30        move second child to first child (temp uint)
 0:30          'r02' (temp uint)
-0:30          textureFetch (temp uint)
-0:30            'g_tTexbus' (layout(r32ui ) uniform usamplerBuffer)
-0:30            c1: direct index for structure (layout(offset=0 ) uniform int)
-0:30              'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
-0:30              Constant:
-0:30                0 (const uint)
+0:30          Construct uint (temp uint)
+0:?             textureFetch (temp 4-component vector of uint)
+0:30              'g_tTexbus' (layout(r32ui ) uniform usamplerBuffer)
+0:30              c1: direct index for structure (layout(offset=0 ) uniform int)
+0:30                'anon@0' (layout(row_major std140 ) uniform block{layout(offset=0 ) uniform int c1, layout(offset=8 ) uniform 2-component vector of int c2, layout(offset=16 ) uniform 3-component vector of int c3, layout(offset=32 ) uniform 4-component vector of int c4, layout(offset=48 ) uniform int o1, layout(offset=56 ) uniform 2-component vector of int o2, layout(offset=64 ) uniform 3-component vector of int o3, layout(offset=80 ) uniform 4-component vector of int o4})
+0:30                Constant:
+0:30                  0 (const uint)
 0:34      move second child to first child (temp 4-component vector of float)
 0:34        Color: direct index for structure (temp 4-component vector of float)
 0:34          'psout' (temp structure{temp 4-component vector of float Color, temp float Depth})
@@ -153,13 +159,13 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 70
+// Id's are bound by 74
 
                               Capability Shader
                               Capability SampledBuffer
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 61 65
+                              EntryPoint Fragment 4  "main" 65 69
                               ExecutionMode 4 OriginUpperLeft
                               Name 4  "main"
                               Name 8  "r00"
@@ -174,17 +180,17 @@
                               MemberName 18($Global) 6  "o3"
                               MemberName 18($Global) 7  "o4"
                               Name 20  ""
-                              Name 28  "r01"
-                              Name 32  "g_tTexbis"
-                              Name 40  "r02"
-                              Name 44  "g_tTexbus"
-                              Name 51  "PS_OUTPUT"
-                              MemberName 51(PS_OUTPUT) 0  "Color"
-                              MemberName 51(PS_OUTPUT) 1  "Depth"
-                              Name 53  "psout"
-                              Name 61  "Color"
-                              Name 65  "Depth"
-                              Name 69  "g_tTexbfs_test"
+                              Name 30  "r01"
+                              Name 34  "g_tTexbis"
+                              Name 43  "r02"
+                              Name 47  "g_tTexbus"
+                              Name 55  "PS_OUTPUT"
+                              MemberName 55(PS_OUTPUT) 0  "Color"
+                              MemberName 55(PS_OUTPUT) 1  "Depth"
+                              Name 57  "psout"
+                              Name 65  "Color"
+                              Name 69  "Depth"
+                              Name 73  "g_tTexbfs_test"
                               Decorate 12(g_tTexbfs) DescriptorSet 0
                               MemberDecorate 18($Global) 0 Offset 0
                               MemberDecorate 18($Global) 1 Offset 8
@@ -196,12 +202,12 @@
                               MemberDecorate 18($Global) 7 Offset 80
                               Decorate 18($Global) Block
                               Decorate 20 DescriptorSet 0
-                              Decorate 32(g_tTexbis) DescriptorSet 0
-                              Decorate 44(g_tTexbus) DescriptorSet 0
-                              Decorate 61(Color) Location 0
-                              Decorate 65(Depth) BuiltIn FragDepth
-                              Decorate 69(g_tTexbfs_test) DescriptorSet 0
-                              Decorate 69(g_tTexbfs_test) Binding 0
+                              Decorate 34(g_tTexbis) DescriptorSet 0
+                              Decorate 47(g_tTexbus) DescriptorSet 0
+                              Decorate 65(Color) Location 0
+                              Decorate 69(Depth) BuiltIn FragDepth
+                              Decorate 73(g_tTexbfs_test) DescriptorSet 0
+                              Decorate 73(g_tTexbfs_test) Binding 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -219,62 +225,66 @@
               20:     19(ptr) Variable Uniform
               21:     14(int) Constant 0
               22:             TypePointer Uniform 14(int)
-              27:             TypePointer Function 14(int)
-              29:             TypeImage 14(int) Buffer sampled format:R32i
-              30:             TypeSampledImage 29
-              31:             TypePointer UniformConstant 30
-   32(g_tTexbis):     31(ptr) Variable UniformConstant
-              38:             TypeInt 32 0
-              39:             TypePointer Function 38(int)
-              41:             TypeImage 38(int) Buffer sampled format:R32ui
-              42:             TypeSampledImage 41
-              43:             TypePointer UniformConstant 42
-   44(g_tTexbus):     43(ptr) Variable UniformConstant
-              50:             TypeVector 6(float) 4
-   51(PS_OUTPUT):             TypeStruct 50(fvec4) 6(float)
-              52:             TypePointer Function 51(PS_OUTPUT)
-              54:    6(float) Constant 1065353216
-              55:   50(fvec4) ConstantComposite 54 54 54 54
-              56:             TypePointer Function 50(fvec4)
-              58:     14(int) Constant 1
-              60:             TypePointer Output 50(fvec4)
-       61(Color):     60(ptr) Variable Output
-              64:             TypePointer Output 6(float)
-       65(Depth):     64(ptr) Variable Output
-69(g_tTexbfs_test):     11(ptr) Variable UniformConstant
+              26:             TypeVector 6(float) 4
+              29:             TypePointer Function 14(int)
+              31:             TypeImage 14(int) Buffer sampled format:R32i
+              32:             TypeSampledImage 31
+              33:             TypePointer UniformConstant 32
+   34(g_tTexbis):     33(ptr) Variable UniformConstant
+              41:             TypeInt 32 0
+              42:             TypePointer Function 41(int)
+              44:             TypeImage 41(int) Buffer sampled format:R32ui
+              45:             TypeSampledImage 44
+              46:             TypePointer UniformConstant 45
+   47(g_tTexbus):     46(ptr) Variable UniformConstant
+              52:             TypeVector 41(int) 4
+   55(PS_OUTPUT):             TypeStruct 26(fvec4) 6(float)
+              56:             TypePointer Function 55(PS_OUTPUT)
+              58:    6(float) Constant 1065353216
+              59:   26(fvec4) ConstantComposite 58 58 58 58
+              60:             TypePointer Function 26(fvec4)
+              62:     14(int) Constant 1
+              64:             TypePointer Output 26(fvec4)
+       65(Color):     64(ptr) Variable Output
+              68:             TypePointer Output 6(float)
+       69(Depth):     68(ptr) Variable Output
+73(g_tTexbfs_test):     11(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
           8(r00):      7(ptr) Variable Function
-         28(r01):     27(ptr) Variable Function
-         40(r02):     39(ptr) Variable Function
-       53(psout):     52(ptr) Variable Function
+         30(r01):     29(ptr) Variable Function
+         43(r02):     42(ptr) Variable Function
+       57(psout):     56(ptr) Variable Function
               13:          10 Load 12(g_tTexbfs)
               23:     22(ptr) AccessChain 20 21
               24:     14(int) Load 23
               25:           9 Image 13
-              26:    6(float) ImageFetch 25 24
-                              Store 8(r00) 26
-              33:          30 Load 32(g_tTexbis)
-              34:     22(ptr) AccessChain 20 21
-              35:     14(int) Load 34
-              36:          29 Image 33
-              37:     14(int) ImageFetch 36 35
-                              Store 28(r01) 37
-              45:          42 Load 44(g_tTexbus)
-              46:     22(ptr) AccessChain 20 21
-              47:     14(int) Load 46
-              48:          41 Image 45
-              49:     38(int) ImageFetch 48 47
-                              Store 40(r02) 49
-              57:     56(ptr) AccessChain 53(psout) 21
-                              Store 57 55
-              59:      7(ptr) AccessChain 53(psout) 58
-                              Store 59 54
-              62:     56(ptr) AccessChain 53(psout) 21
-              63:   50(fvec4) Load 62
-                              Store 61(Color) 63
-              66:      7(ptr) AccessChain 53(psout) 58
-              67:    6(float) Load 66
-                              Store 65(Depth) 67
+              27:   26(fvec4) ImageFetch 25 24
+              28:    6(float) CompositeExtract 27 0
+                              Store 8(r00) 28
+              35:          32 Load 34(g_tTexbis)
+              36:     22(ptr) AccessChain 20 21
+              37:     14(int) Load 36
+              38:          31 Image 35
+              39:   17(ivec4) ImageFetch 38 37
+              40:     14(int) CompositeExtract 39 0
+                              Store 30(r01) 40
+              48:          45 Load 47(g_tTexbus)
+              49:     22(ptr) AccessChain 20 21
+              50:     14(int) Load 49
+              51:          44 Image 48
+              53:   52(ivec4) ImageFetch 51 50
+              54:     41(int) CompositeExtract 53 0
+                              Store 43(r02) 54
+              61:     60(ptr) AccessChain 57(psout) 21
+                              Store 61 59
+              63:      7(ptr) AccessChain 57(psout) 62
+                              Store 63 58
+              66:     60(ptr) AccessChain 57(psout) 21
+              67:   26(fvec4) Load 66
+                              Store 65(Color) 67
+              70:      7(ptr) AccessChain 57(psout) 62
+              71:    6(float) Load 70
+                              Store 69(Depth) 71
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.sample.array.dx10.frag.out b/Test/baseResults/hlsl.sample.array.dx10.frag.out
index bb2962d..6c6f187 100644
--- a/Test/baseResults/hlsl.sample.array.dx10.frag.out
+++ b/Test/baseResults/hlsl.sample.array.dx10.frag.out
@@ -8,7 +8,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval10' (temp 4-component vector of float)
-0:27          texture (global 4-component vector of float)
+0:27          texture (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler1DArray)
 0:27              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -18,7 +18,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval11' (temp 4-component vector of int)
-0:28          texture (global 4-component vector of int)
+0:28          texture (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler1DArray)
 0:28              'g_tTex1di4' (uniform itexture1DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -28,7 +28,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval12' (temp 4-component vector of uint)
-0:29          texture (global 4-component vector of uint)
+0:29          texture (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler1DArray)
 0:29              'g_tTex1du4' (uniform utexture1DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -38,7 +38,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval20' (temp 4-component vector of float)
-0:31          texture (global 4-component vector of float)
+0:31          texture (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler2DArray)
 0:31              'g_tTex2df4' (uniform texture2DArray)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -49,7 +49,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval21' (temp 4-component vector of int)
-0:32          texture (global 4-component vector of int)
+0:32          texture (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler2DArray)
 0:32              'g_tTex2di4' (uniform itexture2DArray)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -60,7 +60,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval22' (temp 4-component vector of uint)
-0:33          texture (global 4-component vector of uint)
+0:33          texture (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler2DArray)
 0:33              'g_tTex2du4' (uniform utexture2DArray)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -71,7 +71,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval40' (temp 4-component vector of float)
-0:35          texture (global 4-component vector of float)
+0:35          texture (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp samplerCubeArray)
 0:35              'g_tTexcdf4' (uniform textureCubeArray)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -83,7 +83,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval41' (temp 4-component vector of int)
-0:36          texture (global 4-component vector of int)
+0:36          texture (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isamplerCubeArray)
 0:36              'g_tTexcdi4' (uniform itextureCubeArray)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -95,7 +95,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval42' (temp 4-component vector of uint)
-0:37          texture (global 4-component vector of uint)
+0:37          texture (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usamplerCubeArray)
 0:37              'g_tTexcdu4' (uniform utextureCubeArray)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -164,7 +164,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval10' (temp 4-component vector of float)
-0:27          texture (global 4-component vector of float)
+0:27          texture (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler1DArray)
 0:27              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -174,7 +174,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval11' (temp 4-component vector of int)
-0:28          texture (global 4-component vector of int)
+0:28          texture (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler1DArray)
 0:28              'g_tTex1di4' (uniform itexture1DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -184,7 +184,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval12' (temp 4-component vector of uint)
-0:29          texture (global 4-component vector of uint)
+0:29          texture (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler1DArray)
 0:29              'g_tTex1du4' (uniform utexture1DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -194,7 +194,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval20' (temp 4-component vector of float)
-0:31          texture (global 4-component vector of float)
+0:31          texture (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler2DArray)
 0:31              'g_tTex2df4' (uniform texture2DArray)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -205,7 +205,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval21' (temp 4-component vector of int)
-0:32          texture (global 4-component vector of int)
+0:32          texture (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler2DArray)
 0:32              'g_tTex2di4' (uniform itexture2DArray)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -216,7 +216,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval22' (temp 4-component vector of uint)
-0:33          texture (global 4-component vector of uint)
+0:33          texture (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler2DArray)
 0:33              'g_tTex2du4' (uniform utexture2DArray)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -227,7 +227,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval40' (temp 4-component vector of float)
-0:35          texture (global 4-component vector of float)
+0:35          texture (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp samplerCubeArray)
 0:35              'g_tTexcdf4' (uniform textureCubeArray)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -239,7 +239,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval41' (temp 4-component vector of int)
-0:36          texture (global 4-component vector of int)
+0:36          texture (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isamplerCubeArray)
 0:36              'g_tTexcdi4' (uniform itextureCubeArray)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -251,7 +251,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval42' (temp 4-component vector of uint)
-0:37          texture (global 4-component vector of uint)
+0:37          texture (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usamplerCubeArray)
 0:37              'g_tTexcdu4' (uniform utextureCubeArray)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.sample.basic.dx10.frag.out b/Test/baseResults/hlsl.sample.basic.dx10.frag.out
index b6cc8c6..de9a4f4 100644
--- a/Test/baseResults/hlsl.sample.basic.dx10.frag.out
+++ b/Test/baseResults/hlsl.sample.basic.dx10.frag.out
@@ -94,7 +94,7 @@
 0:70      Sequence
 0:70        move second child to first child (temp 4-component vector of float)
 0:70          'txval10' (temp 4-component vector of float)
-0:70          texture (global 4-component vector of float)
+0:70          texture (temp 4-component vector of float)
 0:70            Construct combined texture-sampler (temp sampler1D)
 0:70              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:70              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -103,7 +103,7 @@
 0:71      Sequence
 0:71        move second child to first child (temp 4-component vector of int)
 0:71          'txval11' (temp 4-component vector of int)
-0:71          texture (global 4-component vector of int)
+0:71          texture (temp 4-component vector of int)
 0:71            Construct combined texture-sampler (temp isampler1D)
 0:71              'g_tTex1di4' (uniform itexture1D)
 0:71              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -112,7 +112,7 @@
 0:72      Sequence
 0:72        move second child to first child (temp 4-component vector of uint)
 0:72          'txval12' (temp 4-component vector of uint)
-0:72          texture (global 4-component vector of uint)
+0:72          texture (temp 4-component vector of uint)
 0:72            Construct combined texture-sampler (temp usampler1D)
 0:72              'g_tTex1du4' (uniform utexture1D)
 0:72              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -121,7 +121,7 @@
 0:74      Sequence
 0:74        move second child to first child (temp 4-component vector of float)
 0:74          'txval20' (temp 4-component vector of float)
-0:74          texture (global 4-component vector of float)
+0:74          texture (temp 4-component vector of float)
 0:74            Construct combined texture-sampler (temp sampler2D)
 0:74              'g_tTex2df4' (uniform texture2D)
 0:74              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -131,7 +131,7 @@
 0:75      Sequence
 0:75        move second child to first child (temp 4-component vector of int)
 0:75          'txval21' (temp 4-component vector of int)
-0:75          texture (global 4-component vector of int)
+0:75          texture (temp 4-component vector of int)
 0:75            Construct combined texture-sampler (temp isampler2D)
 0:75              'g_tTex2di4' (uniform itexture2D)
 0:75              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -141,7 +141,7 @@
 0:76      Sequence
 0:76        move second child to first child (temp 4-component vector of uint)
 0:76          'txval22' (temp 4-component vector of uint)
-0:76          texture (global 4-component vector of uint)
+0:76          texture (temp 4-component vector of uint)
 0:76            Construct combined texture-sampler (temp usampler2D)
 0:76              'g_tTex2du4' (uniform utexture2D)
 0:76              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -151,7 +151,7 @@
 0:78      Sequence
 0:78        move second child to first child (temp 4-component vector of float)
 0:78          'txval30' (temp 4-component vector of float)
-0:78          texture (global 4-component vector of float)
+0:78          texture (temp 4-component vector of float)
 0:78            Construct combined texture-sampler (temp sampler3D)
 0:78              'g_tTex3df4' (uniform texture3D)
 0:78              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -162,7 +162,7 @@
 0:79      Sequence
 0:79        move second child to first child (temp 4-component vector of int)
 0:79          'txval31' (temp 4-component vector of int)
-0:79          texture (global 4-component vector of int)
+0:79          texture (temp 4-component vector of int)
 0:79            Construct combined texture-sampler (temp isampler3D)
 0:79              'g_tTex3di4' (uniform itexture3D)
 0:79              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -173,7 +173,7 @@
 0:80      Sequence
 0:80        move second child to first child (temp 4-component vector of uint)
 0:80          'txval32' (temp 4-component vector of uint)
-0:80          texture (global 4-component vector of uint)
+0:80          texture (temp 4-component vector of uint)
 0:80            Construct combined texture-sampler (temp usampler3D)
 0:80              'g_tTex3du4' (uniform utexture3D)
 0:80              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -184,7 +184,7 @@
 0:82      Sequence
 0:82        move second child to first child (temp 4-component vector of float)
 0:82          'txval40' (temp 4-component vector of float)
-0:82          texture (global 4-component vector of float)
+0:82          texture (temp 4-component vector of float)
 0:82            Construct combined texture-sampler (temp samplerCube)
 0:82              'g_tTexcdf4' (uniform textureCube)
 0:82              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -195,7 +195,7 @@
 0:83      Sequence
 0:83        move second child to first child (temp 4-component vector of int)
 0:83          'txval41' (temp 4-component vector of int)
-0:83          texture (global 4-component vector of int)
+0:83          texture (temp 4-component vector of int)
 0:83            Construct combined texture-sampler (temp isamplerCube)
 0:83              'g_tTexcdi4' (uniform itextureCube)
 0:83              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -206,7 +206,7 @@
 0:84      Sequence
 0:84        move second child to first child (temp 4-component vector of uint)
 0:84          'txval42' (temp 4-component vector of uint)
-0:84          texture (global 4-component vector of uint)
+0:84          texture (temp 4-component vector of uint)
 0:84            Construct combined texture-sampler (temp usamplerCube)
 0:84              'g_tTexcdu4' (uniform utextureCube)
 0:84              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -363,7 +363,7 @@
 0:70      Sequence
 0:70        move second child to first child (temp 4-component vector of float)
 0:70          'txval10' (temp 4-component vector of float)
-0:70          texture (global 4-component vector of float)
+0:70          texture (temp 4-component vector of float)
 0:70            Construct combined texture-sampler (temp sampler1D)
 0:70              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:70              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -372,7 +372,7 @@
 0:71      Sequence
 0:71        move second child to first child (temp 4-component vector of int)
 0:71          'txval11' (temp 4-component vector of int)
-0:71          texture (global 4-component vector of int)
+0:71          texture (temp 4-component vector of int)
 0:71            Construct combined texture-sampler (temp isampler1D)
 0:71              'g_tTex1di4' (uniform itexture1D)
 0:71              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -381,7 +381,7 @@
 0:72      Sequence
 0:72        move second child to first child (temp 4-component vector of uint)
 0:72          'txval12' (temp 4-component vector of uint)
-0:72          texture (global 4-component vector of uint)
+0:72          texture (temp 4-component vector of uint)
 0:72            Construct combined texture-sampler (temp usampler1D)
 0:72              'g_tTex1du4' (uniform utexture1D)
 0:72              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -390,7 +390,7 @@
 0:74      Sequence
 0:74        move second child to first child (temp 4-component vector of float)
 0:74          'txval20' (temp 4-component vector of float)
-0:74          texture (global 4-component vector of float)
+0:74          texture (temp 4-component vector of float)
 0:74            Construct combined texture-sampler (temp sampler2D)
 0:74              'g_tTex2df4' (uniform texture2D)
 0:74              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -400,7 +400,7 @@
 0:75      Sequence
 0:75        move second child to first child (temp 4-component vector of int)
 0:75          'txval21' (temp 4-component vector of int)
-0:75          texture (global 4-component vector of int)
+0:75          texture (temp 4-component vector of int)
 0:75            Construct combined texture-sampler (temp isampler2D)
 0:75              'g_tTex2di4' (uniform itexture2D)
 0:75              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -410,7 +410,7 @@
 0:76      Sequence
 0:76        move second child to first child (temp 4-component vector of uint)
 0:76          'txval22' (temp 4-component vector of uint)
-0:76          texture (global 4-component vector of uint)
+0:76          texture (temp 4-component vector of uint)
 0:76            Construct combined texture-sampler (temp usampler2D)
 0:76              'g_tTex2du4' (uniform utexture2D)
 0:76              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -420,7 +420,7 @@
 0:78      Sequence
 0:78        move second child to first child (temp 4-component vector of float)
 0:78          'txval30' (temp 4-component vector of float)
-0:78          texture (global 4-component vector of float)
+0:78          texture (temp 4-component vector of float)
 0:78            Construct combined texture-sampler (temp sampler3D)
 0:78              'g_tTex3df4' (uniform texture3D)
 0:78              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -431,7 +431,7 @@
 0:79      Sequence
 0:79        move second child to first child (temp 4-component vector of int)
 0:79          'txval31' (temp 4-component vector of int)
-0:79          texture (global 4-component vector of int)
+0:79          texture (temp 4-component vector of int)
 0:79            Construct combined texture-sampler (temp isampler3D)
 0:79              'g_tTex3di4' (uniform itexture3D)
 0:79              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -442,7 +442,7 @@
 0:80      Sequence
 0:80        move second child to first child (temp 4-component vector of uint)
 0:80          'txval32' (temp 4-component vector of uint)
-0:80          texture (global 4-component vector of uint)
+0:80          texture (temp 4-component vector of uint)
 0:80            Construct combined texture-sampler (temp usampler3D)
 0:80              'g_tTex3du4' (uniform utexture3D)
 0:80              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -453,7 +453,7 @@
 0:82      Sequence
 0:82        move second child to first child (temp 4-component vector of float)
 0:82          'txval40' (temp 4-component vector of float)
-0:82          texture (global 4-component vector of float)
+0:82          texture (temp 4-component vector of float)
 0:82            Construct combined texture-sampler (temp samplerCube)
 0:82              'g_tTexcdf4' (uniform textureCube)
 0:82              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -464,7 +464,7 @@
 0:83      Sequence
 0:83        move second child to first child (temp 4-component vector of int)
 0:83          'txval41' (temp 4-component vector of int)
-0:83          texture (global 4-component vector of int)
+0:83          texture (temp 4-component vector of int)
 0:83            Construct combined texture-sampler (temp isamplerCube)
 0:83              'g_tTexcdi4' (uniform itextureCube)
 0:83              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -475,7 +475,7 @@
 0:84      Sequence
 0:84        move second child to first child (temp 4-component vector of uint)
 0:84          'txval42' (temp 4-component vector of uint)
-0:84          texture (global 4-component vector of uint)
+0:84          texture (temp 4-component vector of uint)
 0:84            Construct combined texture-sampler (temp usamplerCube)
 0:84              'g_tTexcdu4' (uniform utextureCube)
 0:84              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.sample.offset.dx10.frag.out b/Test/baseResults/hlsl.sample.offset.dx10.frag.out
index 9de5f49..67bf043 100644
--- a/Test/baseResults/hlsl.sample.offset.dx10.frag.out
+++ b/Test/baseResults/hlsl.sample.offset.dx10.frag.out
@@ -8,7 +8,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          textureOffset (global 4-component vector of float)
+0:31          textureOffset (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -19,7 +19,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          textureOffset (global 4-component vector of int)
+0:32          textureOffset (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -30,7 +30,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          textureOffset (global 4-component vector of uint)
+0:33          textureOffset (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -41,7 +41,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          textureOffset (global 4-component vector of float)
+0:35          textureOffset (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -54,7 +54,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          textureOffset (global 4-component vector of int)
+0:36          textureOffset (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -67,7 +67,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          textureOffset (global 4-component vector of uint)
+0:37          textureOffset (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -80,7 +80,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          textureOffset (global 4-component vector of float)
+0:39          textureOffset (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -95,7 +95,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          textureOffset (global 4-component vector of int)
+0:40          textureOffset (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -110,7 +110,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          textureOffset (global 4-component vector of uint)
+0:41          textureOffset (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -185,7 +185,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          textureOffset (global 4-component vector of float)
+0:31          textureOffset (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -196,7 +196,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          textureOffset (global 4-component vector of int)
+0:32          textureOffset (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -207,7 +207,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          textureOffset (global 4-component vector of uint)
+0:33          textureOffset (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -218,7 +218,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          textureOffset (global 4-component vector of float)
+0:35          textureOffset (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -231,7 +231,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          textureOffset (global 4-component vector of int)
+0:36          textureOffset (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -244,7 +244,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          textureOffset (global 4-component vector of uint)
+0:37          textureOffset (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -257,7 +257,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          textureOffset (global 4-component vector of float)
+0:39          textureOffset (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -272,7 +272,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          textureOffset (global 4-component vector of int)
+0:40          textureOffset (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -287,7 +287,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          textureOffset (global 4-component vector of uint)
+0:41          textureOffset (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.sample.offsetarray.dx10.frag.out b/Test/baseResults/hlsl.sample.offsetarray.dx10.frag.out
index f4646d4..83a0e8b 100644
--- a/Test/baseResults/hlsl.sample.offsetarray.dx10.frag.out
+++ b/Test/baseResults/hlsl.sample.offsetarray.dx10.frag.out
@@ -8,7 +8,7 @@
 0:23      Sequence
 0:23        move second child to first child (temp 4-component vector of float)
 0:23          'txval10' (temp 4-component vector of float)
-0:23          textureOffset (global 4-component vector of float)
+0:23          textureOffset (temp 4-component vector of float)
 0:23            Construct combined texture-sampler (temp sampler1DArray)
 0:23              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:23              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -20,7 +20,7 @@
 0:24      Sequence
 0:24        move second child to first child (temp 4-component vector of int)
 0:24          'txval11' (temp 4-component vector of int)
-0:24          textureOffset (global 4-component vector of int)
+0:24          textureOffset (temp 4-component vector of int)
 0:24            Construct combined texture-sampler (temp isampler1DArray)
 0:24              'g_tTex1di4' (uniform itexture1DArray)
 0:24              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -32,7 +32,7 @@
 0:25      Sequence
 0:25        move second child to first child (temp 4-component vector of uint)
 0:25          'txval12' (temp 4-component vector of uint)
-0:25          textureOffset (global 4-component vector of uint)
+0:25          textureOffset (temp 4-component vector of uint)
 0:25            Construct combined texture-sampler (temp usampler1DArray)
 0:25              'g_tTex1du4' (uniform utexture1DArray)
 0:25              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -44,7 +44,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval20' (temp 4-component vector of float)
-0:27          textureOffset (global 4-component vector of float)
+0:27          textureOffset (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler2DArray)
 0:27              'g_tTex2df4' (uniform texture2DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -58,7 +58,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval21' (temp 4-component vector of int)
-0:28          textureOffset (global 4-component vector of int)
+0:28          textureOffset (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler2DArray)
 0:28              'g_tTex2di4' (uniform itexture2DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -72,7 +72,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval22' (temp 4-component vector of uint)
-0:29          textureOffset (global 4-component vector of uint)
+0:29          textureOffset (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler2DArray)
 0:29              'g_tTex2du4' (uniform utexture2DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -140,7 +140,7 @@
 0:23      Sequence
 0:23        move second child to first child (temp 4-component vector of float)
 0:23          'txval10' (temp 4-component vector of float)
-0:23          textureOffset (global 4-component vector of float)
+0:23          textureOffset (temp 4-component vector of float)
 0:23            Construct combined texture-sampler (temp sampler1DArray)
 0:23              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:23              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -152,7 +152,7 @@
 0:24      Sequence
 0:24        move second child to first child (temp 4-component vector of int)
 0:24          'txval11' (temp 4-component vector of int)
-0:24          textureOffset (global 4-component vector of int)
+0:24          textureOffset (temp 4-component vector of int)
 0:24            Construct combined texture-sampler (temp isampler1DArray)
 0:24              'g_tTex1di4' (uniform itexture1DArray)
 0:24              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -164,7 +164,7 @@
 0:25      Sequence
 0:25        move second child to first child (temp 4-component vector of uint)
 0:25          'txval12' (temp 4-component vector of uint)
-0:25          textureOffset (global 4-component vector of uint)
+0:25          textureOffset (temp 4-component vector of uint)
 0:25            Construct combined texture-sampler (temp usampler1DArray)
 0:25              'g_tTex1du4' (uniform utexture1DArray)
 0:25              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -176,7 +176,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval20' (temp 4-component vector of float)
-0:27          textureOffset (global 4-component vector of float)
+0:27          textureOffset (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler2DArray)
 0:27              'g_tTex2df4' (uniform texture2DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -190,7 +190,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval21' (temp 4-component vector of int)
-0:28          textureOffset (global 4-component vector of int)
+0:28          textureOffset (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler2DArray)
 0:28              'g_tTex2di4' (uniform itexture2DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -204,7 +204,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval22' (temp 4-component vector of uint)
-0:29          textureOffset (global 4-component vector of uint)
+0:29          textureOffset (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler2DArray)
 0:29              'g_tTex2du4' (uniform utexture2DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out b/Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out
new file mode 100644
index 0000000..abe1cb5
--- /dev/null
+++ b/Test/baseResults/hlsl.sample.sub-vec4.dx10.frag.out
@@ -0,0 +1,252 @@
+hlsl.sample.sub-vec4.dx10.frag
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:14  Function Definition: main( (temp structure{temp 4-component vector of float Color})
+0:14    Function Parameters: 
+0:?     Sequence
+0:17      Sequence
+0:17        move second child to first child (temp float)
+0:17          'txval10' (temp float)
+0:17          Construct float (temp float)
+0:?             texture (temp 4-component vector of float)
+0:17              Construct combined texture-sampler (temp sampler1D)
+0:17                'g_tTex1df1' (uniform texture1D)
+0:17                'g_sSamp' (layout(binding=0 ) uniform sampler)
+0:17              Constant:
+0:17                0.100000
+0:18      Sequence
+0:18        move second child to first child (temp 2-component vector of float)
+0:18          'txval11' (temp 2-component vector of float)
+0:18          Construct float (temp 2-component vector of float)
+0:?             texture (temp 4-component vector of float)
+0:18              Construct combined texture-sampler (temp sampler1D)
+0:18                'g_tTex1df2' (uniform texture1D)
+0:18                'g_sSamp' (layout(binding=0 ) uniform sampler)
+0:18              Constant:
+0:18                0.200000
+0:19      Sequence
+0:19        move second child to first child (temp 3-component vector of float)
+0:19          'txval12' (temp 3-component vector of float)
+0:19          Construct float (temp 3-component vector of float)
+0:?             texture (temp 4-component vector of float)
+0:19              Construct combined texture-sampler (temp sampler1D)
+0:19                'g_tTex1df3' (uniform texture1D)
+0:19                'g_sSamp' (layout(binding=0 ) uniform sampler)
+0:19              Constant:
+0:19                0.200000
+0:20      Sequence
+0:20        move second child to first child (temp 4-component vector of float)
+0:20          'txval13' (temp 4-component vector of float)
+0:20          texture (temp 4-component vector of float)
+0:20            Construct combined texture-sampler (temp sampler1D)
+0:20              'g_tTex1df4' (uniform texture1D)
+0:20              'g_sSamp' (layout(binding=0 ) uniform sampler)
+0:20            Constant:
+0:20              0.200000
+0:22      move second child to first child (temp 4-component vector of float)
+0:22        Color: direct index for structure (temp 4-component vector of float)
+0:22          'psout' (temp structure{temp 4-component vector of float Color})
+0:22          Constant:
+0:22            0 (const int)
+0:22        Constant:
+0:22          1.000000
+0:22          1.000000
+0:22          1.000000
+0:22          1.000000
+0:23      Sequence
+0:23        Sequence
+0:23          move second child to first child (temp 4-component vector of float)
+0:?             'Color' (layout(location=0 ) out 4-component vector of float)
+0:23            Color: direct index for structure (temp 4-component vector of float)
+0:23              'psout' (temp structure{temp 4-component vector of float Color})
+0:23              Constant:
+0:23                0 (const int)
+0:23        Branch: Return
+0:?   Linker Objects
+0:?     'g_sSamp' (layout(binding=0 ) uniform sampler)
+0:?     'g_tTex1df1' (uniform texture1D)
+0:?     'g_tTex1df2' (uniform texture1D)
+0:?     'g_tTex1df3' (uniform texture1D)
+0:?     'g_tTex1df4' (uniform texture1D)
+0:?     'Color' (layout(location=0 ) out 4-component vector of float)
+
+
+Linked fragment stage:
+
+
+Shader version: 450
+gl_FragCoord origin is upper left
+0:? Sequence
+0:14  Function Definition: main( (temp structure{temp 4-component vector of float Color})
+0:14    Function Parameters: 
+0:?     Sequence
+0:17      Sequence
+0:17        move second child to first child (temp float)
+0:17          'txval10' (temp float)
+0:17          Construct float (temp float)
+0:?             texture (temp 4-component vector of float)
+0:17              Construct combined texture-sampler (temp sampler1D)
+0:17                'g_tTex1df1' (uniform texture1D)
+0:17                'g_sSamp' (layout(binding=0 ) uniform sampler)
+0:17              Constant:
+0:17                0.100000
+0:18      Sequence
+0:18        move second child to first child (temp 2-component vector of float)
+0:18          'txval11' (temp 2-component vector of float)
+0:18          Construct float (temp 2-component vector of float)
+0:?             texture (temp 4-component vector of float)
+0:18              Construct combined texture-sampler (temp sampler1D)
+0:18                'g_tTex1df2' (uniform texture1D)
+0:18                'g_sSamp' (layout(binding=0 ) uniform sampler)
+0:18              Constant:
+0:18                0.200000
+0:19      Sequence
+0:19        move second child to first child (temp 3-component vector of float)
+0:19          'txval12' (temp 3-component vector of float)
+0:19          Construct float (temp 3-component vector of float)
+0:?             texture (temp 4-component vector of float)
+0:19              Construct combined texture-sampler (temp sampler1D)
+0:19                'g_tTex1df3' (uniform texture1D)
+0:19                'g_sSamp' (layout(binding=0 ) uniform sampler)
+0:19              Constant:
+0:19                0.200000
+0:20      Sequence
+0:20        move second child to first child (temp 4-component vector of float)
+0:20          'txval13' (temp 4-component vector of float)
+0:20          texture (temp 4-component vector of float)
+0:20            Construct combined texture-sampler (temp sampler1D)
+0:20              'g_tTex1df4' (uniform texture1D)
+0:20              'g_sSamp' (layout(binding=0 ) uniform sampler)
+0:20            Constant:
+0:20              0.200000
+0:22      move second child to first child (temp 4-component vector of float)
+0:22        Color: direct index for structure (temp 4-component vector of float)
+0:22          'psout' (temp structure{temp 4-component vector of float Color})
+0:22          Constant:
+0:22            0 (const int)
+0:22        Constant:
+0:22          1.000000
+0:22          1.000000
+0:22          1.000000
+0:22          1.000000
+0:23      Sequence
+0:23        Sequence
+0:23          move second child to first child (temp 4-component vector of float)
+0:?             'Color' (layout(location=0 ) out 4-component vector of float)
+0:23            Color: direct index for structure (temp 4-component vector of float)
+0:23              'psout' (temp structure{temp 4-component vector of float Color})
+0:23              Constant:
+0:23                0 (const int)
+0:23        Branch: Return
+0:?   Linker Objects
+0:?     'g_sSamp' (layout(binding=0 ) uniform sampler)
+0:?     'g_tTex1df1' (uniform texture1D)
+0:?     'g_tTex1df2' (uniform texture1D)
+0:?     'g_tTex1df3' (uniform texture1D)
+0:?     'g_tTex1df4' (uniform texture1D)
+0:?     'Color' (layout(location=0 ) out 4-component vector of float)
+
+// Module Version 10000
+// Generated by (magic number): 80001
+// Id's are bound by 67
+
+                              Capability Shader
+                              Capability Sampled1D
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main" 63
+                              ExecutionMode 4 OriginUpperLeft
+                              Name 4  "main"
+                              Name 8  "txval10"
+                              Name 11  "g_tTex1df1"
+                              Name 15  "g_sSamp"
+                              Name 25  "txval11"
+                              Name 26  "g_tTex1df2"
+                              Name 37  "txval12"
+                              Name 38  "g_tTex1df3"
+                              Name 48  "txval13"
+                              Name 49  "g_tTex1df4"
+                              Name 54  "PS_OUTPUT"
+                              MemberName 54(PS_OUTPUT) 0  "Color"
+                              Name 56  "psout"
+                              Name 63  "Color"
+                              Decorate 11(g_tTex1df1) DescriptorSet 0
+                              Decorate 15(g_sSamp) DescriptorSet 0
+                              Decorate 15(g_sSamp) Binding 0
+                              Decorate 26(g_tTex1df2) DescriptorSet 0
+                              Decorate 38(g_tTex1df3) DescriptorSet 0
+                              Decorate 49(g_tTex1df4) DescriptorSet 0
+                              Decorate 63(Color) Location 0
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeFloat 32
+               7:             TypePointer Function 6(float)
+               9:             TypeImage 6(float) 1D sampled format:Unknown
+              10:             TypePointer UniformConstant 9
+  11(g_tTex1df1):     10(ptr) Variable UniformConstant
+              13:             TypeSampler
+              14:             TypePointer UniformConstant 13
+     15(g_sSamp):     14(ptr) Variable UniformConstant
+              17:             TypeSampledImage 9
+              19:    6(float) Constant 1036831949
+              20:             TypeVector 6(float) 4
+              23:             TypeVector 6(float) 2
+              24:             TypePointer Function 23(fvec2)
+  26(g_tTex1df2):     10(ptr) Variable UniformConstant
+              30:    6(float) Constant 1045220557
+              35:             TypeVector 6(float) 3
+              36:             TypePointer Function 35(fvec3)
+  38(g_tTex1df3):     10(ptr) Variable UniformConstant
+              47:             TypePointer Function 20(fvec4)
+  49(g_tTex1df4):     10(ptr) Variable UniformConstant
+   54(PS_OUTPUT):             TypeStruct 20(fvec4)
+              55:             TypePointer Function 54(PS_OUTPUT)
+              57:             TypeInt 32 1
+              58:     57(int) Constant 0
+              59:    6(float) Constant 1065353216
+              60:   20(fvec4) ConstantComposite 59 59 59 59
+              62:             TypePointer Output 20(fvec4)
+       63(Color):     62(ptr) Variable Output
+         4(main):           2 Function None 3
+               5:             Label
+      8(txval10):      7(ptr) Variable Function
+     25(txval11):     24(ptr) Variable Function
+     37(txval12):     36(ptr) Variable Function
+     48(txval13):     47(ptr) Variable Function
+       56(psout):     55(ptr) Variable Function
+              12:           9 Load 11(g_tTex1df1)
+              16:          13 Load 15(g_sSamp)
+              18:          17 SampledImage 12 16
+              21:   20(fvec4) ImageSampleImplicitLod 18 19
+              22:    6(float) CompositeExtract 21 0
+                              Store 8(txval10) 22
+              27:           9 Load 26(g_tTex1df2)
+              28:          13 Load 15(g_sSamp)
+              29:          17 SampledImage 27 28
+              31:   20(fvec4) ImageSampleImplicitLod 29 30
+              32:    6(float) CompositeExtract 31 0
+              33:    6(float) CompositeExtract 31 1
+              34:   23(fvec2) CompositeConstruct 32 33
+                              Store 25(txval11) 34
+              39:           9 Load 38(g_tTex1df3)
+              40:          13 Load 15(g_sSamp)
+              41:          17 SampledImage 39 40
+              42:   20(fvec4) ImageSampleImplicitLod 41 30
+              43:    6(float) CompositeExtract 42 0
+              44:    6(float) CompositeExtract 42 1
+              45:    6(float) CompositeExtract 42 2
+              46:   35(fvec3) CompositeConstruct 43 44 45
+                              Store 37(txval12) 46
+              50:           9 Load 49(g_tTex1df4)
+              51:          13 Load 15(g_sSamp)
+              52:          17 SampledImage 50 51
+              53:   20(fvec4) ImageSampleImplicitLod 52 30
+                              Store 48(txval13) 53
+              61:     47(ptr) AccessChain 56(psout) 58
+                              Store 61 60
+              64:     47(ptr) AccessChain 56(psout) 58
+              65:   20(fvec4) Load 64
+                              Store 63(Color) 65
+                              Return
+                              FunctionEnd
diff --git a/Test/baseResults/hlsl.samplebias.array.dx10.frag.out b/Test/baseResults/hlsl.samplebias.array.dx10.frag.out
index 539855e..b2b38b6 100644
--- a/Test/baseResults/hlsl.samplebias.array.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplebias.array.dx10.frag.out
@@ -8,7 +8,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval10' (temp 4-component vector of float)
-0:27          texture (global 4-component vector of float)
+0:27          texture (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler1DArray)
 0:27              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -20,7 +20,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval11' (temp 4-component vector of int)
-0:28          texture (global 4-component vector of int)
+0:28          texture (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler1DArray)
 0:28              'g_tTex1di4' (uniform itexture1DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -32,7 +32,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval12' (temp 4-component vector of uint)
-0:29          texture (global 4-component vector of uint)
+0:29          texture (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler1DArray)
 0:29              'g_tTex1du4' (uniform utexture1DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -44,7 +44,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval20' (temp 4-component vector of float)
-0:31          texture (global 4-component vector of float)
+0:31          texture (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler2DArray)
 0:31              'g_tTex2df4' (uniform texture2DArray)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -57,7 +57,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval21' (temp 4-component vector of int)
-0:32          texture (global 4-component vector of int)
+0:32          texture (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler2DArray)
 0:32              'g_tTex2di4' (uniform itexture2DArray)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -70,7 +70,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval22' (temp 4-component vector of uint)
-0:33          texture (global 4-component vector of uint)
+0:33          texture (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler2DArray)
 0:33              'g_tTex2du4' (uniform utexture2DArray)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -83,7 +83,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval40' (temp 4-component vector of float)
-0:35          texture (global 4-component vector of float)
+0:35          texture (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp samplerCubeArray)
 0:35              'g_tTexcdf4' (uniform textureCubeArray)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -97,7 +97,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval41' (temp 4-component vector of int)
-0:36          texture (global 4-component vector of int)
+0:36          texture (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isamplerCubeArray)
 0:36              'g_tTexcdi4' (uniform itextureCubeArray)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -111,7 +111,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval42' (temp 4-component vector of uint)
-0:37          texture (global 4-component vector of uint)
+0:37          texture (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usamplerCubeArray)
 0:37              'g_tTexcdu4' (uniform utextureCubeArray)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -182,7 +182,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval10' (temp 4-component vector of float)
-0:27          texture (global 4-component vector of float)
+0:27          texture (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler1DArray)
 0:27              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -194,7 +194,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval11' (temp 4-component vector of int)
-0:28          texture (global 4-component vector of int)
+0:28          texture (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler1DArray)
 0:28              'g_tTex1di4' (uniform itexture1DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -206,7 +206,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval12' (temp 4-component vector of uint)
-0:29          texture (global 4-component vector of uint)
+0:29          texture (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler1DArray)
 0:29              'g_tTex1du4' (uniform utexture1DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -218,7 +218,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval20' (temp 4-component vector of float)
-0:31          texture (global 4-component vector of float)
+0:31          texture (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler2DArray)
 0:31              'g_tTex2df4' (uniform texture2DArray)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -231,7 +231,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval21' (temp 4-component vector of int)
-0:32          texture (global 4-component vector of int)
+0:32          texture (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler2DArray)
 0:32              'g_tTex2di4' (uniform itexture2DArray)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -244,7 +244,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval22' (temp 4-component vector of uint)
-0:33          texture (global 4-component vector of uint)
+0:33          texture (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler2DArray)
 0:33              'g_tTex2du4' (uniform utexture2DArray)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -257,7 +257,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval40' (temp 4-component vector of float)
-0:35          texture (global 4-component vector of float)
+0:35          texture (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp samplerCubeArray)
 0:35              'g_tTexcdf4' (uniform textureCubeArray)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -271,7 +271,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval41' (temp 4-component vector of int)
-0:36          texture (global 4-component vector of int)
+0:36          texture (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isamplerCubeArray)
 0:36              'g_tTexcdi4' (uniform itextureCubeArray)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -285,7 +285,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval42' (temp 4-component vector of uint)
-0:37          texture (global 4-component vector of uint)
+0:37          texture (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usamplerCubeArray)
 0:37              'g_tTexcdu4' (uniform utextureCubeArray)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplebias.basic.dx10.frag.out b/Test/baseResults/hlsl.samplebias.basic.dx10.frag.out
index 9fb8b1a..c794914 100644
--- a/Test/baseResults/hlsl.samplebias.basic.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplebias.basic.dx10.frag.out
@@ -8,7 +8,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          texture (global 4-component vector of float)
+0:31          texture (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -19,7 +19,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          texture (global 4-component vector of int)
+0:32          texture (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -30,7 +30,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          texture (global 4-component vector of uint)
+0:33          texture (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -41,7 +41,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          texture (global 4-component vector of float)
+0:35          texture (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -53,7 +53,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          texture (global 4-component vector of int)
+0:36          texture (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -65,7 +65,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          texture (global 4-component vector of uint)
+0:37          texture (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -77,7 +77,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          texture (global 4-component vector of float)
+0:39          texture (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -90,7 +90,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          texture (global 4-component vector of int)
+0:40          texture (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -103,7 +103,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          texture (global 4-component vector of uint)
+0:41          texture (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -116,7 +116,7 @@
 0:43      Sequence
 0:43        move second child to first child (temp 4-component vector of float)
 0:43          'txval40' (temp 4-component vector of float)
-0:43          texture (global 4-component vector of float)
+0:43          texture (temp 4-component vector of float)
 0:43            Construct combined texture-sampler (temp samplerCube)
 0:43              'g_tTexcdf4' (uniform textureCube)
 0:43              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -129,7 +129,7 @@
 0:44      Sequence
 0:44        move second child to first child (temp 4-component vector of int)
 0:44          'txval41' (temp 4-component vector of int)
-0:44          texture (global 4-component vector of int)
+0:44          texture (temp 4-component vector of int)
 0:44            Construct combined texture-sampler (temp isamplerCube)
 0:44              'g_tTexcdi4' (uniform itextureCube)
 0:44              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -142,7 +142,7 @@
 0:45      Sequence
 0:45        move second child to first child (temp 4-component vector of uint)
 0:45          'txval42' (temp 4-component vector of uint)
-0:45          texture (global 4-component vector of uint)
+0:45          texture (temp 4-component vector of uint)
 0:45            Construct combined texture-sampler (temp usamplerCube)
 0:45              'g_tTexcdu4' (uniform utextureCube)
 0:45              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -215,7 +215,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          texture (global 4-component vector of float)
+0:31          texture (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -226,7 +226,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          texture (global 4-component vector of int)
+0:32          texture (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -237,7 +237,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          texture (global 4-component vector of uint)
+0:33          texture (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -248,7 +248,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          texture (global 4-component vector of float)
+0:35          texture (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -260,7 +260,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          texture (global 4-component vector of int)
+0:36          texture (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -272,7 +272,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          texture (global 4-component vector of uint)
+0:37          texture (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -284,7 +284,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          texture (global 4-component vector of float)
+0:39          texture (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -297,7 +297,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          texture (global 4-component vector of int)
+0:40          texture (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -310,7 +310,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          texture (global 4-component vector of uint)
+0:41          texture (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -323,7 +323,7 @@
 0:43      Sequence
 0:43        move second child to first child (temp 4-component vector of float)
 0:43          'txval40' (temp 4-component vector of float)
-0:43          texture (global 4-component vector of float)
+0:43          texture (temp 4-component vector of float)
 0:43            Construct combined texture-sampler (temp samplerCube)
 0:43              'g_tTexcdf4' (uniform textureCube)
 0:43              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -336,7 +336,7 @@
 0:44      Sequence
 0:44        move second child to first child (temp 4-component vector of int)
 0:44          'txval41' (temp 4-component vector of int)
-0:44          texture (global 4-component vector of int)
+0:44          texture (temp 4-component vector of int)
 0:44            Construct combined texture-sampler (temp isamplerCube)
 0:44              'g_tTexcdi4' (uniform itextureCube)
 0:44              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -349,7 +349,7 @@
 0:45      Sequence
 0:45        move second child to first child (temp 4-component vector of uint)
 0:45          'txval42' (temp 4-component vector of uint)
-0:45          texture (global 4-component vector of uint)
+0:45          texture (temp 4-component vector of uint)
 0:45            Construct combined texture-sampler (temp usamplerCube)
 0:45              'g_tTexcdu4' (uniform utextureCube)
 0:45              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplebias.offset.dx10.frag.out b/Test/baseResults/hlsl.samplebias.offset.dx10.frag.out
index 643e003..900eb4b 100644
--- a/Test/baseResults/hlsl.samplebias.offset.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplebias.offset.dx10.frag.out
@@ -8,7 +8,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          textureOffset (global 4-component vector of float)
+0:31          textureOffset (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -21,7 +21,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          textureOffset (global 4-component vector of int)
+0:32          textureOffset (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -34,7 +34,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          textureOffset (global 4-component vector of uint)
+0:33          textureOffset (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -47,7 +47,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          textureOffset (global 4-component vector of float)
+0:35          textureOffset (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -62,7 +62,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          textureOffset (global 4-component vector of int)
+0:36          textureOffset (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -77,7 +77,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          textureOffset (global 4-component vector of uint)
+0:37          textureOffset (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -92,7 +92,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          textureOffset (global 4-component vector of float)
+0:39          textureOffset (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -109,7 +109,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          textureOffset (global 4-component vector of int)
+0:40          textureOffset (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -126,7 +126,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          textureOffset (global 4-component vector of uint)
+0:41          textureOffset (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -203,7 +203,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          textureOffset (global 4-component vector of float)
+0:31          textureOffset (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -216,7 +216,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          textureOffset (global 4-component vector of int)
+0:32          textureOffset (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -229,7 +229,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          textureOffset (global 4-component vector of uint)
+0:33          textureOffset (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -242,7 +242,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          textureOffset (global 4-component vector of float)
+0:35          textureOffset (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -257,7 +257,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          textureOffset (global 4-component vector of int)
+0:36          textureOffset (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -272,7 +272,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          textureOffset (global 4-component vector of uint)
+0:37          textureOffset (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -287,7 +287,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          textureOffset (global 4-component vector of float)
+0:39          textureOffset (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -304,7 +304,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          textureOffset (global 4-component vector of int)
+0:40          textureOffset (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -321,7 +321,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          textureOffset (global 4-component vector of uint)
+0:41          textureOffset (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplebias.offsetarray.dx10.frag.out b/Test/baseResults/hlsl.samplebias.offsetarray.dx10.frag.out
index 3ab84b9..bd21622 100644
--- a/Test/baseResults/hlsl.samplebias.offsetarray.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplebias.offsetarray.dx10.frag.out
@@ -8,7 +8,7 @@
 0:23      Sequence
 0:23        move second child to first child (temp 4-component vector of float)
 0:23          'txval10' (temp 4-component vector of float)
-0:23          textureOffset (global 4-component vector of float)
+0:23          textureOffset (temp 4-component vector of float)
 0:23            Construct combined texture-sampler (temp sampler1DArray)
 0:23              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:23              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -22,7 +22,7 @@
 0:24      Sequence
 0:24        move second child to first child (temp 4-component vector of int)
 0:24          'txval11' (temp 4-component vector of int)
-0:24          textureOffset (global 4-component vector of int)
+0:24          textureOffset (temp 4-component vector of int)
 0:24            Construct combined texture-sampler (temp isampler1DArray)
 0:24              'g_tTex1di4' (uniform itexture1DArray)
 0:24              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -36,7 +36,7 @@
 0:25      Sequence
 0:25        move second child to first child (temp 4-component vector of uint)
 0:25          'txval12' (temp 4-component vector of uint)
-0:25          textureOffset (global 4-component vector of uint)
+0:25          textureOffset (temp 4-component vector of uint)
 0:25            Construct combined texture-sampler (temp usampler1DArray)
 0:25              'g_tTex1du4' (uniform utexture1DArray)
 0:25              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -50,7 +50,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval20' (temp 4-component vector of float)
-0:27          textureOffset (global 4-component vector of float)
+0:27          textureOffset (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler2DArray)
 0:27              'g_tTex2df4' (uniform texture2DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -66,7 +66,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval21' (temp 4-component vector of int)
-0:28          textureOffset (global 4-component vector of int)
+0:28          textureOffset (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler2DArray)
 0:28              'g_tTex2di4' (uniform itexture2DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -82,7 +82,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval22' (temp 4-component vector of uint)
-0:29          textureOffset (global 4-component vector of uint)
+0:29          textureOffset (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler2DArray)
 0:29              'g_tTex2du4' (uniform utexture2DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -152,7 +152,7 @@
 0:23      Sequence
 0:23        move second child to first child (temp 4-component vector of float)
 0:23          'txval10' (temp 4-component vector of float)
-0:23          textureOffset (global 4-component vector of float)
+0:23          textureOffset (temp 4-component vector of float)
 0:23            Construct combined texture-sampler (temp sampler1DArray)
 0:23              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:23              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -166,7 +166,7 @@
 0:24      Sequence
 0:24        move second child to first child (temp 4-component vector of int)
 0:24          'txval11' (temp 4-component vector of int)
-0:24          textureOffset (global 4-component vector of int)
+0:24          textureOffset (temp 4-component vector of int)
 0:24            Construct combined texture-sampler (temp isampler1DArray)
 0:24              'g_tTex1di4' (uniform itexture1DArray)
 0:24              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -180,7 +180,7 @@
 0:25      Sequence
 0:25        move second child to first child (temp 4-component vector of uint)
 0:25          'txval12' (temp 4-component vector of uint)
-0:25          textureOffset (global 4-component vector of uint)
+0:25          textureOffset (temp 4-component vector of uint)
 0:25            Construct combined texture-sampler (temp usampler1DArray)
 0:25              'g_tTex1du4' (uniform utexture1DArray)
 0:25              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -194,7 +194,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval20' (temp 4-component vector of float)
-0:27          textureOffset (global 4-component vector of float)
+0:27          textureOffset (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler2DArray)
 0:27              'g_tTex2df4' (uniform texture2DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -210,7 +210,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval21' (temp 4-component vector of int)
-0:28          textureOffset (global 4-component vector of int)
+0:28          textureOffset (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler2DArray)
 0:28              'g_tTex2di4' (uniform itexture2DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -226,7 +226,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval22' (temp 4-component vector of uint)
-0:29          textureOffset (global 4-component vector of uint)
+0:29          textureOffset (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler2DArray)
 0:29              'g_tTex2du4' (uniform utexture2DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplegrad.array.dx10.frag.out b/Test/baseResults/hlsl.samplegrad.array.dx10.frag.out
index 1513492..46a6bbc 100644
--- a/Test/baseResults/hlsl.samplegrad.array.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplegrad.array.dx10.frag.out
@@ -8,7 +8,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval10' (temp 4-component vector of float)
-0:27          textureGrad (global 4-component vector of float)
+0:27          textureGrad (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler1DArray)
 0:27              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -22,7 +22,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval11' (temp 4-component vector of int)
-0:28          textureGrad (global 4-component vector of int)
+0:28          textureGrad (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler1DArray)
 0:28              'g_tTex1di4' (uniform itexture1DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -36,7 +36,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval12' (temp 4-component vector of uint)
-0:29          textureGrad (global 4-component vector of uint)
+0:29          textureGrad (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler1DArray)
 0:29              'g_tTex1du4' (uniform utexture1DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -50,7 +50,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval20' (temp 4-component vector of float)
-0:31          textureGrad (global 4-component vector of float)
+0:31          textureGrad (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler2DArray)
 0:31              'g_tTex2df4' (uniform texture2DArray)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -67,7 +67,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval21' (temp 4-component vector of int)
-0:32          textureGrad (global 4-component vector of int)
+0:32          textureGrad (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler2DArray)
 0:32              'g_tTex2di4' (uniform itexture2DArray)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -84,7 +84,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval22' (temp 4-component vector of uint)
-0:33          textureGrad (global 4-component vector of uint)
+0:33          textureGrad (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler2DArray)
 0:33              'g_tTex2du4' (uniform utexture2DArray)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -101,7 +101,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval40' (temp 4-component vector of float)
-0:35          textureGrad (global 4-component vector of float)
+0:35          textureGrad (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp samplerCubeArray)
 0:35              'g_tTexcdf4' (uniform textureCubeArray)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -121,7 +121,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval41' (temp 4-component vector of int)
-0:36          textureGrad (global 4-component vector of int)
+0:36          textureGrad (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isamplerCubeArray)
 0:36              'g_tTexcdi4' (uniform itextureCubeArray)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -141,7 +141,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval42' (temp 4-component vector of uint)
-0:37          textureGrad (global 4-component vector of uint)
+0:37          textureGrad (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usamplerCubeArray)
 0:37              'g_tTexcdu4' (uniform utextureCubeArray)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -218,7 +218,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval10' (temp 4-component vector of float)
-0:27          textureGrad (global 4-component vector of float)
+0:27          textureGrad (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler1DArray)
 0:27              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -232,7 +232,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval11' (temp 4-component vector of int)
-0:28          textureGrad (global 4-component vector of int)
+0:28          textureGrad (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler1DArray)
 0:28              'g_tTex1di4' (uniform itexture1DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -246,7 +246,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval12' (temp 4-component vector of uint)
-0:29          textureGrad (global 4-component vector of uint)
+0:29          textureGrad (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler1DArray)
 0:29              'g_tTex1du4' (uniform utexture1DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -260,7 +260,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval20' (temp 4-component vector of float)
-0:31          textureGrad (global 4-component vector of float)
+0:31          textureGrad (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler2DArray)
 0:31              'g_tTex2df4' (uniform texture2DArray)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -277,7 +277,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval21' (temp 4-component vector of int)
-0:32          textureGrad (global 4-component vector of int)
+0:32          textureGrad (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler2DArray)
 0:32              'g_tTex2di4' (uniform itexture2DArray)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -294,7 +294,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval22' (temp 4-component vector of uint)
-0:33          textureGrad (global 4-component vector of uint)
+0:33          textureGrad (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler2DArray)
 0:33              'g_tTex2du4' (uniform utexture2DArray)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -311,7 +311,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval40' (temp 4-component vector of float)
-0:35          textureGrad (global 4-component vector of float)
+0:35          textureGrad (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp samplerCubeArray)
 0:35              'g_tTexcdf4' (uniform textureCubeArray)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -331,7 +331,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval41' (temp 4-component vector of int)
-0:36          textureGrad (global 4-component vector of int)
+0:36          textureGrad (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isamplerCubeArray)
 0:36              'g_tTexcdi4' (uniform itextureCubeArray)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -351,7 +351,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval42' (temp 4-component vector of uint)
-0:37          textureGrad (global 4-component vector of uint)
+0:37          textureGrad (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usamplerCubeArray)
 0:37              'g_tTexcdu4' (uniform utextureCubeArray)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplegrad.basic.dx10.frag.out b/Test/baseResults/hlsl.samplegrad.basic.dx10.frag.out
index 92c0c34..395efc2 100644
--- a/Test/baseResults/hlsl.samplegrad.basic.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplegrad.basic.dx10.frag.out
@@ -8,7 +8,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          textureGrad (global 4-component vector of float)
+0:31          textureGrad (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -21,7 +21,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          textureGrad (global 4-component vector of int)
+0:32          textureGrad (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -34,7 +34,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          textureGrad (global 4-component vector of uint)
+0:33          textureGrad (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -47,7 +47,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          textureGrad (global 4-component vector of float)
+0:35          textureGrad (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -63,7 +63,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          textureGrad (global 4-component vector of int)
+0:36          textureGrad (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -79,7 +79,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          textureGrad (global 4-component vector of uint)
+0:37          textureGrad (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -95,7 +95,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          textureGrad (global 4-component vector of float)
+0:39          textureGrad (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -114,7 +114,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          textureGrad (global 4-component vector of int)
+0:40          textureGrad (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -133,7 +133,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          textureGrad (global 4-component vector of uint)
+0:41          textureGrad (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -152,7 +152,7 @@
 0:43      Sequence
 0:43        move second child to first child (temp 4-component vector of float)
 0:43          'txval40' (temp 4-component vector of float)
-0:43          textureGrad (global 4-component vector of float)
+0:43          textureGrad (temp 4-component vector of float)
 0:43            Construct combined texture-sampler (temp samplerCube)
 0:43              'g_tTexcdf4' (uniform textureCube)
 0:43              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -171,7 +171,7 @@
 0:44      Sequence
 0:44        move second child to first child (temp 4-component vector of int)
 0:44          'txval41' (temp 4-component vector of int)
-0:44          textureGrad (global 4-component vector of int)
+0:44          textureGrad (temp 4-component vector of int)
 0:44            Construct combined texture-sampler (temp isamplerCube)
 0:44              'g_tTexcdi4' (uniform itextureCube)
 0:44              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -190,7 +190,7 @@
 0:45      Sequence
 0:45        move second child to first child (temp 4-component vector of uint)
 0:45          'txval42' (temp 4-component vector of uint)
-0:45          textureGrad (global 4-component vector of uint)
+0:45          textureGrad (temp 4-component vector of uint)
 0:45            Construct combined texture-sampler (temp usamplerCube)
 0:45              'g_tTexcdu4' (uniform utextureCube)
 0:45              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -269,7 +269,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          textureGrad (global 4-component vector of float)
+0:31          textureGrad (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -282,7 +282,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          textureGrad (global 4-component vector of int)
+0:32          textureGrad (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -295,7 +295,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          textureGrad (global 4-component vector of uint)
+0:33          textureGrad (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -308,7 +308,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          textureGrad (global 4-component vector of float)
+0:35          textureGrad (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -324,7 +324,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          textureGrad (global 4-component vector of int)
+0:36          textureGrad (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -340,7 +340,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          textureGrad (global 4-component vector of uint)
+0:37          textureGrad (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -356,7 +356,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          textureGrad (global 4-component vector of float)
+0:39          textureGrad (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -375,7 +375,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          textureGrad (global 4-component vector of int)
+0:40          textureGrad (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -394,7 +394,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          textureGrad (global 4-component vector of uint)
+0:41          textureGrad (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -413,7 +413,7 @@
 0:43      Sequence
 0:43        move second child to first child (temp 4-component vector of float)
 0:43          'txval40' (temp 4-component vector of float)
-0:43          textureGrad (global 4-component vector of float)
+0:43          textureGrad (temp 4-component vector of float)
 0:43            Construct combined texture-sampler (temp samplerCube)
 0:43              'g_tTexcdf4' (uniform textureCube)
 0:43              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -432,7 +432,7 @@
 0:44      Sequence
 0:44        move second child to first child (temp 4-component vector of int)
 0:44          'txval41' (temp 4-component vector of int)
-0:44          textureGrad (global 4-component vector of int)
+0:44          textureGrad (temp 4-component vector of int)
 0:44            Construct combined texture-sampler (temp isamplerCube)
 0:44              'g_tTexcdi4' (uniform itextureCube)
 0:44              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -451,7 +451,7 @@
 0:45      Sequence
 0:45        move second child to first child (temp 4-component vector of uint)
 0:45          'txval42' (temp 4-component vector of uint)
-0:45          textureGrad (global 4-component vector of uint)
+0:45          textureGrad (temp 4-component vector of uint)
 0:45            Construct combined texture-sampler (temp usamplerCube)
 0:45              'g_tTexcdu4' (uniform utextureCube)
 0:45              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out b/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out
index e890934..2e79be3 100644
--- a/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out
+++ b/Test/baseResults/hlsl.samplegrad.basic.dx10.vert.out
@@ -7,7 +7,7 @@
 0:30      Sequence
 0:30        move second child to first child (temp 4-component vector of float)
 0:30          'txval10' (temp 4-component vector of float)
-0:30          textureGrad (global 4-component vector of float)
+0:30          textureGrad (temp 4-component vector of float)
 0:30            Construct combined texture-sampler (temp sampler1D)
 0:30              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:30              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -20,7 +20,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of int)
 0:31          'txval11' (temp 4-component vector of int)
-0:31          textureGrad (global 4-component vector of int)
+0:31          textureGrad (temp 4-component vector of int)
 0:31            Construct combined texture-sampler (temp isampler1D)
 0:31              'g_tTex1di4' (uniform itexture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -33,7 +33,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of uint)
 0:32          'txval12' (temp 4-component vector of uint)
-0:32          textureGrad (global 4-component vector of uint)
+0:32          textureGrad (temp 4-component vector of uint)
 0:32            Construct combined texture-sampler (temp usampler1D)
 0:32              'g_tTex1du4' (uniform utexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -46,7 +46,7 @@
 0:34      Sequence
 0:34        move second child to first child (temp 4-component vector of float)
 0:34          'txval20' (temp 4-component vector of float)
-0:34          textureGrad (global 4-component vector of float)
+0:34          textureGrad (temp 4-component vector of float)
 0:34            Construct combined texture-sampler (temp sampler2D)
 0:34              'g_tTex2df4' (uniform texture2D)
 0:34              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -62,7 +62,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of int)
 0:35          'txval21' (temp 4-component vector of int)
-0:35          textureGrad (global 4-component vector of int)
+0:35          textureGrad (temp 4-component vector of int)
 0:35            Construct combined texture-sampler (temp isampler2D)
 0:35              'g_tTex2di4' (uniform itexture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -78,7 +78,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of uint)
 0:36          'txval22' (temp 4-component vector of uint)
-0:36          textureGrad (global 4-component vector of uint)
+0:36          textureGrad (temp 4-component vector of uint)
 0:36            Construct combined texture-sampler (temp usampler2D)
 0:36              'g_tTex2du4' (uniform utexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -94,7 +94,7 @@
 0:38      Sequence
 0:38        move second child to first child (temp 4-component vector of float)
 0:38          'txval30' (temp 4-component vector of float)
-0:38          textureGrad (global 4-component vector of float)
+0:38          textureGrad (temp 4-component vector of float)
 0:38            Construct combined texture-sampler (temp sampler3D)
 0:38              'g_tTex3df4' (uniform texture3D)
 0:38              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -113,7 +113,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of int)
 0:39          'txval31' (temp 4-component vector of int)
-0:39          textureGrad (global 4-component vector of int)
+0:39          textureGrad (temp 4-component vector of int)
 0:39            Construct combined texture-sampler (temp isampler3D)
 0:39              'g_tTex3di4' (uniform itexture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -132,7 +132,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of uint)
 0:40          'txval32' (temp 4-component vector of uint)
-0:40          textureGrad (global 4-component vector of uint)
+0:40          textureGrad (temp 4-component vector of uint)
 0:40            Construct combined texture-sampler (temp usampler3D)
 0:40              'g_tTex3du4' (uniform utexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -151,7 +151,7 @@
 0:42      Sequence
 0:42        move second child to first child (temp 4-component vector of float)
 0:42          'txval40' (temp 4-component vector of float)
-0:42          textureGrad (global 4-component vector of float)
+0:42          textureGrad (temp 4-component vector of float)
 0:42            Construct combined texture-sampler (temp samplerCube)
 0:42              'g_tTexcdf4' (uniform textureCube)
 0:42              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -170,7 +170,7 @@
 0:43      Sequence
 0:43        move second child to first child (temp 4-component vector of int)
 0:43          'txval41' (temp 4-component vector of int)
-0:43          textureGrad (global 4-component vector of int)
+0:43          textureGrad (temp 4-component vector of int)
 0:43            Construct combined texture-sampler (temp isamplerCube)
 0:43              'g_tTexcdi4' (uniform itextureCube)
 0:43              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -189,7 +189,7 @@
 0:44      Sequence
 0:44        move second child to first child (temp 4-component vector of uint)
 0:44          'txval42' (temp 4-component vector of uint)
-0:44          textureGrad (global 4-component vector of uint)
+0:44          textureGrad (temp 4-component vector of uint)
 0:44            Construct combined texture-sampler (temp usamplerCube)
 0:44              'g_tTexcdu4' (uniform utextureCube)
 0:44              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -253,7 +253,7 @@
 0:30      Sequence
 0:30        move second child to first child (temp 4-component vector of float)
 0:30          'txval10' (temp 4-component vector of float)
-0:30          textureGrad (global 4-component vector of float)
+0:30          textureGrad (temp 4-component vector of float)
 0:30            Construct combined texture-sampler (temp sampler1D)
 0:30              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:30              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -266,7 +266,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of int)
 0:31          'txval11' (temp 4-component vector of int)
-0:31          textureGrad (global 4-component vector of int)
+0:31          textureGrad (temp 4-component vector of int)
 0:31            Construct combined texture-sampler (temp isampler1D)
 0:31              'g_tTex1di4' (uniform itexture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -279,7 +279,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of uint)
 0:32          'txval12' (temp 4-component vector of uint)
-0:32          textureGrad (global 4-component vector of uint)
+0:32          textureGrad (temp 4-component vector of uint)
 0:32            Construct combined texture-sampler (temp usampler1D)
 0:32              'g_tTex1du4' (uniform utexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -292,7 +292,7 @@
 0:34      Sequence
 0:34        move second child to first child (temp 4-component vector of float)
 0:34          'txval20' (temp 4-component vector of float)
-0:34          textureGrad (global 4-component vector of float)
+0:34          textureGrad (temp 4-component vector of float)
 0:34            Construct combined texture-sampler (temp sampler2D)
 0:34              'g_tTex2df4' (uniform texture2D)
 0:34              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -308,7 +308,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of int)
 0:35          'txval21' (temp 4-component vector of int)
-0:35          textureGrad (global 4-component vector of int)
+0:35          textureGrad (temp 4-component vector of int)
 0:35            Construct combined texture-sampler (temp isampler2D)
 0:35              'g_tTex2di4' (uniform itexture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -324,7 +324,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of uint)
 0:36          'txval22' (temp 4-component vector of uint)
-0:36          textureGrad (global 4-component vector of uint)
+0:36          textureGrad (temp 4-component vector of uint)
 0:36            Construct combined texture-sampler (temp usampler2D)
 0:36              'g_tTex2du4' (uniform utexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -340,7 +340,7 @@
 0:38      Sequence
 0:38        move second child to first child (temp 4-component vector of float)
 0:38          'txval30' (temp 4-component vector of float)
-0:38          textureGrad (global 4-component vector of float)
+0:38          textureGrad (temp 4-component vector of float)
 0:38            Construct combined texture-sampler (temp sampler3D)
 0:38              'g_tTex3df4' (uniform texture3D)
 0:38              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -359,7 +359,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of int)
 0:39          'txval31' (temp 4-component vector of int)
-0:39          textureGrad (global 4-component vector of int)
+0:39          textureGrad (temp 4-component vector of int)
 0:39            Construct combined texture-sampler (temp isampler3D)
 0:39              'g_tTex3di4' (uniform itexture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -378,7 +378,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of uint)
 0:40          'txval32' (temp 4-component vector of uint)
-0:40          textureGrad (global 4-component vector of uint)
+0:40          textureGrad (temp 4-component vector of uint)
 0:40            Construct combined texture-sampler (temp usampler3D)
 0:40              'g_tTex3du4' (uniform utexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -397,7 +397,7 @@
 0:42      Sequence
 0:42        move second child to first child (temp 4-component vector of float)
 0:42          'txval40' (temp 4-component vector of float)
-0:42          textureGrad (global 4-component vector of float)
+0:42          textureGrad (temp 4-component vector of float)
 0:42            Construct combined texture-sampler (temp samplerCube)
 0:42              'g_tTexcdf4' (uniform textureCube)
 0:42              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -416,7 +416,7 @@
 0:43      Sequence
 0:43        move second child to first child (temp 4-component vector of int)
 0:43          'txval41' (temp 4-component vector of int)
-0:43          textureGrad (global 4-component vector of int)
+0:43          textureGrad (temp 4-component vector of int)
 0:43            Construct combined texture-sampler (temp isamplerCube)
 0:43              'g_tTexcdi4' (uniform itextureCube)
 0:43              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -435,7 +435,7 @@
 0:44      Sequence
 0:44        move second child to first child (temp 4-component vector of uint)
 0:44          'txval42' (temp 4-component vector of uint)
-0:44          textureGrad (global 4-component vector of uint)
+0:44          textureGrad (temp 4-component vector of uint)
 0:44            Construct combined texture-sampler (temp usamplerCube)
 0:44              'g_tTexcdu4' (uniform utextureCube)
 0:44              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplegrad.offset.dx10.frag.out b/Test/baseResults/hlsl.samplegrad.offset.dx10.frag.out
index 9145aa4..7ef5e07 100644
--- a/Test/baseResults/hlsl.samplegrad.offset.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplegrad.offset.dx10.frag.out
@@ -8,7 +8,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          textureGradOffset (global 4-component vector of float)
+0:31          textureGradOffset (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -23,7 +23,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          textureGradOffset (global 4-component vector of int)
+0:32          textureGradOffset (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -38,7 +38,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          textureGradOffset (global 4-component vector of uint)
+0:33          textureGradOffset (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -53,7 +53,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          textureGradOffset (global 4-component vector of float)
+0:35          textureGradOffset (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -72,7 +72,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          textureGradOffset (global 4-component vector of int)
+0:36          textureGradOffset (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -91,7 +91,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          textureGradOffset (global 4-component vector of uint)
+0:37          textureGradOffset (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -110,7 +110,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          textureGradOffset (global 4-component vector of float)
+0:39          textureGradOffset (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -133,7 +133,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          textureGradOffset (global 4-component vector of int)
+0:40          textureGradOffset (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -156,7 +156,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          textureGradOffset (global 4-component vector of uint)
+0:41          textureGradOffset (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -239,7 +239,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          textureGradOffset (global 4-component vector of float)
+0:31          textureGradOffset (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -254,7 +254,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          textureGradOffset (global 4-component vector of int)
+0:32          textureGradOffset (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -269,7 +269,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          textureGradOffset (global 4-component vector of uint)
+0:33          textureGradOffset (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -284,7 +284,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          textureGradOffset (global 4-component vector of float)
+0:35          textureGradOffset (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -303,7 +303,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          textureGradOffset (global 4-component vector of int)
+0:36          textureGradOffset (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -322,7 +322,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          textureGradOffset (global 4-component vector of uint)
+0:37          textureGradOffset (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -341,7 +341,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          textureGradOffset (global 4-component vector of float)
+0:39          textureGradOffset (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -364,7 +364,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          textureGradOffset (global 4-component vector of int)
+0:40          textureGradOffset (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -387,7 +387,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          textureGradOffset (global 4-component vector of uint)
+0:41          textureGradOffset (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplegrad.offsetarray.dx10.frag.out b/Test/baseResults/hlsl.samplegrad.offsetarray.dx10.frag.out
index e964ff9..2043f38 100644
--- a/Test/baseResults/hlsl.samplegrad.offsetarray.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplegrad.offsetarray.dx10.frag.out
@@ -8,7 +8,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval10' (temp 4-component vector of float)
-0:27          textureGradOffset (global 4-component vector of float)
+0:27          textureGradOffset (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler1DArray)
 0:27              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -24,7 +24,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval11' (temp 4-component vector of int)
-0:28          textureGradOffset (global 4-component vector of int)
+0:28          textureGradOffset (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler1DArray)
 0:28              'g_tTex1di4' (uniform itexture1DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -40,7 +40,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval12' (temp 4-component vector of uint)
-0:29          textureGradOffset (global 4-component vector of uint)
+0:29          textureGradOffset (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler1DArray)
 0:29              'g_tTex1du4' (uniform utexture1DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -56,7 +56,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval20' (temp 4-component vector of float)
-0:31          textureGradOffset (global 4-component vector of float)
+0:31          textureGradOffset (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler2DArray)
 0:31              'g_tTex2df4' (uniform texture2DArray)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -76,7 +76,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval21' (temp 4-component vector of int)
-0:32          textureGradOffset (global 4-component vector of int)
+0:32          textureGradOffset (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler2DArray)
 0:32              'g_tTex2di4' (uniform itexture2DArray)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -96,7 +96,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval22' (temp 4-component vector of uint)
-0:33          textureGradOffset (global 4-component vector of uint)
+0:33          textureGradOffset (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler2DArray)
 0:33              'g_tTex2du4' (uniform utexture2DArray)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -173,7 +173,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval10' (temp 4-component vector of float)
-0:27          textureGradOffset (global 4-component vector of float)
+0:27          textureGradOffset (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler1DArray)
 0:27              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -189,7 +189,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval11' (temp 4-component vector of int)
-0:28          textureGradOffset (global 4-component vector of int)
+0:28          textureGradOffset (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler1DArray)
 0:28              'g_tTex1di4' (uniform itexture1DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -205,7 +205,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval12' (temp 4-component vector of uint)
-0:29          textureGradOffset (global 4-component vector of uint)
+0:29          textureGradOffset (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler1DArray)
 0:29              'g_tTex1du4' (uniform utexture1DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -221,7 +221,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval20' (temp 4-component vector of float)
-0:31          textureGradOffset (global 4-component vector of float)
+0:31          textureGradOffset (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler2DArray)
 0:31              'g_tTex2df4' (uniform texture2DArray)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -241,7 +241,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval21' (temp 4-component vector of int)
-0:32          textureGradOffset (global 4-component vector of int)
+0:32          textureGradOffset (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler2DArray)
 0:32              'g_tTex2di4' (uniform itexture2DArray)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -261,7 +261,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval22' (temp 4-component vector of uint)
-0:33          textureGradOffset (global 4-component vector of uint)
+0:33          textureGradOffset (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler2DArray)
 0:33              'g_tTex2du4' (uniform utexture2DArray)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplelevel.array.dx10.frag.out b/Test/baseResults/hlsl.samplelevel.array.dx10.frag.out
index d031665..351e2ed 100644
--- a/Test/baseResults/hlsl.samplelevel.array.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplelevel.array.dx10.frag.out
@@ -8,7 +8,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval10' (temp 4-component vector of float)
-0:27          textureLod (global 4-component vector of float)
+0:27          textureLod (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler1DArray)
 0:27              'g_tTex1df4a' (layout(binding=1 ) uniform texture1DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -20,7 +20,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval11' (temp 4-component vector of int)
-0:28          textureLod (global 4-component vector of int)
+0:28          textureLod (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler1DArray)
 0:28              'g_tTex1di4a' (uniform itexture1DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -32,7 +32,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval12' (temp 4-component vector of uint)
-0:29          textureLod (global 4-component vector of uint)
+0:29          textureLod (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler1DArray)
 0:29              'g_tTex1du4a' (uniform utexture1DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -44,7 +44,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval20' (temp 4-component vector of float)
-0:31          textureLod (global 4-component vector of float)
+0:31          textureLod (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler2DArray)
 0:31              'g_tTex2df4a' (uniform texture2DArray)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -57,7 +57,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval21' (temp 4-component vector of int)
-0:32          textureLod (global 4-component vector of int)
+0:32          textureLod (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler2DArray)
 0:32              'g_tTex2di4a' (uniform itexture2DArray)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -70,7 +70,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval22' (temp 4-component vector of uint)
-0:33          textureLod (global 4-component vector of uint)
+0:33          textureLod (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler2DArray)
 0:33              'g_tTex2du4a' (uniform utexture2DArray)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -83,7 +83,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval40' (temp 4-component vector of float)
-0:35          textureLod (global 4-component vector of float)
+0:35          textureLod (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp samplerCubeArray)
 0:35              'g_tTexcdf4a' (uniform textureCubeArray)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -97,7 +97,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval41' (temp 4-component vector of int)
-0:36          textureLod (global 4-component vector of int)
+0:36          textureLod (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isamplerCubeArray)
 0:36              'g_tTexcdi4a' (uniform itextureCubeArray)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -111,7 +111,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval42' (temp 4-component vector of uint)
-0:37          textureLod (global 4-component vector of uint)
+0:37          textureLod (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usamplerCubeArray)
 0:37              'g_tTexcdu4a' (uniform utextureCubeArray)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -182,7 +182,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval10' (temp 4-component vector of float)
-0:27          textureLod (global 4-component vector of float)
+0:27          textureLod (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler1DArray)
 0:27              'g_tTex1df4a' (layout(binding=1 ) uniform texture1DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -194,7 +194,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval11' (temp 4-component vector of int)
-0:28          textureLod (global 4-component vector of int)
+0:28          textureLod (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler1DArray)
 0:28              'g_tTex1di4a' (uniform itexture1DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -206,7 +206,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval12' (temp 4-component vector of uint)
-0:29          textureLod (global 4-component vector of uint)
+0:29          textureLod (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler1DArray)
 0:29              'g_tTex1du4a' (uniform utexture1DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -218,7 +218,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval20' (temp 4-component vector of float)
-0:31          textureLod (global 4-component vector of float)
+0:31          textureLod (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler2DArray)
 0:31              'g_tTex2df4a' (uniform texture2DArray)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -231,7 +231,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval21' (temp 4-component vector of int)
-0:32          textureLod (global 4-component vector of int)
+0:32          textureLod (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler2DArray)
 0:32              'g_tTex2di4a' (uniform itexture2DArray)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -244,7 +244,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval22' (temp 4-component vector of uint)
-0:33          textureLod (global 4-component vector of uint)
+0:33          textureLod (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler2DArray)
 0:33              'g_tTex2du4a' (uniform utexture2DArray)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -257,7 +257,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval40' (temp 4-component vector of float)
-0:35          textureLod (global 4-component vector of float)
+0:35          textureLod (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp samplerCubeArray)
 0:35              'g_tTexcdf4a' (uniform textureCubeArray)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -271,7 +271,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval41' (temp 4-component vector of int)
-0:36          textureLod (global 4-component vector of int)
+0:36          textureLod (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isamplerCubeArray)
 0:36              'g_tTexcdi4a' (uniform itextureCubeArray)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -285,7 +285,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval42' (temp 4-component vector of uint)
-0:37          textureLod (global 4-component vector of uint)
+0:37          textureLod (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usamplerCubeArray)
 0:37              'g_tTexcdu4a' (uniform utextureCubeArray)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplelevel.basic.dx10.frag.out b/Test/baseResults/hlsl.samplelevel.basic.dx10.frag.out
index 4a93750..d37090f 100644
--- a/Test/baseResults/hlsl.samplelevel.basic.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplelevel.basic.dx10.frag.out
@@ -8,7 +8,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of float)
 0:32          'txval10' (temp 4-component vector of float)
-0:32          textureLod (global 4-component vector of float)
+0:32          textureLod (temp 4-component vector of float)
 0:32            Construct combined texture-sampler (temp sampler1D)
 0:32              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -19,7 +19,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of int)
 0:33          'txval11' (temp 4-component vector of int)
-0:33          textureLod (global 4-component vector of int)
+0:33          textureLod (temp 4-component vector of int)
 0:33            Construct combined texture-sampler (temp isampler1D)
 0:33              'g_tTex1di4' (uniform itexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -30,7 +30,7 @@
 0:34      Sequence
 0:34        move second child to first child (temp 4-component vector of uint)
 0:34          'txval12' (temp 4-component vector of uint)
-0:34          textureLod (global 4-component vector of uint)
+0:34          textureLod (temp 4-component vector of uint)
 0:34            Construct combined texture-sampler (temp usampler1D)
 0:34              'g_tTex1du4' (uniform utexture1D)
 0:34              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -41,7 +41,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of float)
 0:36          'txval20' (temp 4-component vector of float)
-0:36          textureLod (global 4-component vector of float)
+0:36          textureLod (temp 4-component vector of float)
 0:36            Construct combined texture-sampler (temp sampler2D)
 0:36              'g_tTex2df4' (uniform texture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -53,7 +53,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of int)
 0:37          'txval21' (temp 4-component vector of int)
-0:37          textureLod (global 4-component vector of int)
+0:37          textureLod (temp 4-component vector of int)
 0:37            Construct combined texture-sampler (temp isampler2D)
 0:37              'g_tTex2di4' (uniform itexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -65,7 +65,7 @@
 0:38      Sequence
 0:38        move second child to first child (temp 4-component vector of uint)
 0:38          'txval22' (temp 4-component vector of uint)
-0:38          textureLod (global 4-component vector of uint)
+0:38          textureLod (temp 4-component vector of uint)
 0:38            Construct combined texture-sampler (temp usampler2D)
 0:38              'g_tTex2du4' (uniform utexture2D)
 0:38              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -77,7 +77,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of float)
 0:40          'txval30' (temp 4-component vector of float)
-0:40          textureLod (global 4-component vector of float)
+0:40          textureLod (temp 4-component vector of float)
 0:40            Construct combined texture-sampler (temp sampler3D)
 0:40              'g_tTex3df4' (uniform texture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -90,7 +90,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of int)
 0:41          'txval31' (temp 4-component vector of int)
-0:41          textureLod (global 4-component vector of int)
+0:41          textureLod (temp 4-component vector of int)
 0:41            Construct combined texture-sampler (temp isampler3D)
 0:41              'g_tTex3di4' (uniform itexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -103,7 +103,7 @@
 0:42      Sequence
 0:42        move second child to first child (temp 4-component vector of uint)
 0:42          'txval32' (temp 4-component vector of uint)
-0:42          textureLod (global 4-component vector of uint)
+0:42          textureLod (temp 4-component vector of uint)
 0:42            Construct combined texture-sampler (temp usampler3D)
 0:42              'g_tTex3du4' (uniform utexture3D)
 0:42              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -116,7 +116,7 @@
 0:44      Sequence
 0:44        move second child to first child (temp 4-component vector of float)
 0:44          'txval40' (temp 4-component vector of float)
-0:44          textureLod (global 4-component vector of float)
+0:44          textureLod (temp 4-component vector of float)
 0:44            Construct combined texture-sampler (temp samplerCube)
 0:44              'g_tTexcdf4' (uniform textureCube)
 0:44              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -129,7 +129,7 @@
 0:45      Sequence
 0:45        move second child to first child (temp 4-component vector of int)
 0:45          'txval41' (temp 4-component vector of int)
-0:45          textureLod (global 4-component vector of int)
+0:45          textureLod (temp 4-component vector of int)
 0:45            Construct combined texture-sampler (temp isamplerCube)
 0:45              'g_tTexcdi4' (uniform itextureCube)
 0:45              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -142,7 +142,7 @@
 0:46      Sequence
 0:46        move second child to first child (temp 4-component vector of uint)
 0:46          'txval42' (temp 4-component vector of uint)
-0:46          textureLod (global 4-component vector of uint)
+0:46          textureLod (temp 4-component vector of uint)
 0:46            Construct combined texture-sampler (temp usamplerCube)
 0:46              'g_tTexcdu4' (uniform utextureCube)
 0:46              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -216,7 +216,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of float)
 0:32          'txval10' (temp 4-component vector of float)
-0:32          textureLod (global 4-component vector of float)
+0:32          textureLod (temp 4-component vector of float)
 0:32            Construct combined texture-sampler (temp sampler1D)
 0:32              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -227,7 +227,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of int)
 0:33          'txval11' (temp 4-component vector of int)
-0:33          textureLod (global 4-component vector of int)
+0:33          textureLod (temp 4-component vector of int)
 0:33            Construct combined texture-sampler (temp isampler1D)
 0:33              'g_tTex1di4' (uniform itexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -238,7 +238,7 @@
 0:34      Sequence
 0:34        move second child to first child (temp 4-component vector of uint)
 0:34          'txval12' (temp 4-component vector of uint)
-0:34          textureLod (global 4-component vector of uint)
+0:34          textureLod (temp 4-component vector of uint)
 0:34            Construct combined texture-sampler (temp usampler1D)
 0:34              'g_tTex1du4' (uniform utexture1D)
 0:34              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -249,7 +249,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of float)
 0:36          'txval20' (temp 4-component vector of float)
-0:36          textureLod (global 4-component vector of float)
+0:36          textureLod (temp 4-component vector of float)
 0:36            Construct combined texture-sampler (temp sampler2D)
 0:36              'g_tTex2df4' (uniform texture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -261,7 +261,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of int)
 0:37          'txval21' (temp 4-component vector of int)
-0:37          textureLod (global 4-component vector of int)
+0:37          textureLod (temp 4-component vector of int)
 0:37            Construct combined texture-sampler (temp isampler2D)
 0:37              'g_tTex2di4' (uniform itexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -273,7 +273,7 @@
 0:38      Sequence
 0:38        move second child to first child (temp 4-component vector of uint)
 0:38          'txval22' (temp 4-component vector of uint)
-0:38          textureLod (global 4-component vector of uint)
+0:38          textureLod (temp 4-component vector of uint)
 0:38            Construct combined texture-sampler (temp usampler2D)
 0:38              'g_tTex2du4' (uniform utexture2D)
 0:38              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -285,7 +285,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of float)
 0:40          'txval30' (temp 4-component vector of float)
-0:40          textureLod (global 4-component vector of float)
+0:40          textureLod (temp 4-component vector of float)
 0:40            Construct combined texture-sampler (temp sampler3D)
 0:40              'g_tTex3df4' (uniform texture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -298,7 +298,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of int)
 0:41          'txval31' (temp 4-component vector of int)
-0:41          textureLod (global 4-component vector of int)
+0:41          textureLod (temp 4-component vector of int)
 0:41            Construct combined texture-sampler (temp isampler3D)
 0:41              'g_tTex3di4' (uniform itexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -311,7 +311,7 @@
 0:42      Sequence
 0:42        move second child to first child (temp 4-component vector of uint)
 0:42          'txval32' (temp 4-component vector of uint)
-0:42          textureLod (global 4-component vector of uint)
+0:42          textureLod (temp 4-component vector of uint)
 0:42            Construct combined texture-sampler (temp usampler3D)
 0:42              'g_tTex3du4' (uniform utexture3D)
 0:42              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -324,7 +324,7 @@
 0:44      Sequence
 0:44        move second child to first child (temp 4-component vector of float)
 0:44          'txval40' (temp 4-component vector of float)
-0:44          textureLod (global 4-component vector of float)
+0:44          textureLod (temp 4-component vector of float)
 0:44            Construct combined texture-sampler (temp samplerCube)
 0:44              'g_tTexcdf4' (uniform textureCube)
 0:44              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -337,7 +337,7 @@
 0:45      Sequence
 0:45        move second child to first child (temp 4-component vector of int)
 0:45          'txval41' (temp 4-component vector of int)
-0:45          textureLod (global 4-component vector of int)
+0:45          textureLod (temp 4-component vector of int)
 0:45            Construct combined texture-sampler (temp isamplerCube)
 0:45              'g_tTexcdi4' (uniform itextureCube)
 0:45              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -350,7 +350,7 @@
 0:46      Sequence
 0:46        move second child to first child (temp 4-component vector of uint)
 0:46          'txval42' (temp 4-component vector of uint)
-0:46          textureLod (global 4-component vector of uint)
+0:46          textureLod (temp 4-component vector of uint)
 0:46            Construct combined texture-sampler (temp usamplerCube)
 0:46              'g_tTexcdu4' (uniform utextureCube)
 0:46              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out b/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out
index c18fa89..0438299 100644
--- a/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out
+++ b/Test/baseResults/hlsl.samplelevel.basic.dx10.vert.out
@@ -7,7 +7,7 @@
 0:30      Sequence
 0:30        move second child to first child (temp 4-component vector of float)
 0:30          'txval10' (temp 4-component vector of float)
-0:30          textureLod (global 4-component vector of float)
+0:30          textureLod (temp 4-component vector of float)
 0:30            Construct combined texture-sampler (temp sampler1D)
 0:30              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:30              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -18,7 +18,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of int)
 0:31          'txval11' (temp 4-component vector of int)
-0:31          textureLod (global 4-component vector of int)
+0:31          textureLod (temp 4-component vector of int)
 0:31            Construct combined texture-sampler (temp isampler1D)
 0:31              'g_tTex1di4' (uniform itexture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -29,7 +29,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of uint)
 0:32          'txval12' (temp 4-component vector of uint)
-0:32          textureLod (global 4-component vector of uint)
+0:32          textureLod (temp 4-component vector of uint)
 0:32            Construct combined texture-sampler (temp usampler1D)
 0:32              'g_tTex1du4' (uniform utexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -40,7 +40,7 @@
 0:34      Sequence
 0:34        move second child to first child (temp 4-component vector of float)
 0:34          'txval20' (temp 4-component vector of float)
-0:34          textureLod (global 4-component vector of float)
+0:34          textureLod (temp 4-component vector of float)
 0:34            Construct combined texture-sampler (temp sampler2D)
 0:34              'g_tTex2df4' (uniform texture2D)
 0:34              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -52,7 +52,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of int)
 0:35          'txval21' (temp 4-component vector of int)
-0:35          textureLod (global 4-component vector of int)
+0:35          textureLod (temp 4-component vector of int)
 0:35            Construct combined texture-sampler (temp isampler2D)
 0:35              'g_tTex2di4' (uniform itexture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -64,7 +64,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of uint)
 0:36          'txval22' (temp 4-component vector of uint)
-0:36          textureLod (global 4-component vector of uint)
+0:36          textureLod (temp 4-component vector of uint)
 0:36            Construct combined texture-sampler (temp usampler2D)
 0:36              'g_tTex2du4' (uniform utexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -76,7 +76,7 @@
 0:38      Sequence
 0:38        move second child to first child (temp 4-component vector of float)
 0:38          'txval30' (temp 4-component vector of float)
-0:38          textureLod (global 4-component vector of float)
+0:38          textureLod (temp 4-component vector of float)
 0:38            Construct combined texture-sampler (temp sampler3D)
 0:38              'g_tTex3df4' (uniform texture3D)
 0:38              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -89,7 +89,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of int)
 0:39          'txval31' (temp 4-component vector of int)
-0:39          textureLod (global 4-component vector of int)
+0:39          textureLod (temp 4-component vector of int)
 0:39            Construct combined texture-sampler (temp isampler3D)
 0:39              'g_tTex3di4' (uniform itexture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -102,7 +102,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of uint)
 0:40          'txval32' (temp 4-component vector of uint)
-0:40          textureLod (global 4-component vector of uint)
+0:40          textureLod (temp 4-component vector of uint)
 0:40            Construct combined texture-sampler (temp usampler3D)
 0:40              'g_tTex3du4' (uniform utexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -115,7 +115,7 @@
 0:42      Sequence
 0:42        move second child to first child (temp 4-component vector of float)
 0:42          'txval40' (temp 4-component vector of float)
-0:42          textureLod (global 4-component vector of float)
+0:42          textureLod (temp 4-component vector of float)
 0:42            Construct combined texture-sampler (temp samplerCube)
 0:42              'g_tTexcdf4' (uniform textureCube)
 0:42              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -128,7 +128,7 @@
 0:43      Sequence
 0:43        move second child to first child (temp 4-component vector of int)
 0:43          'txval41' (temp 4-component vector of int)
-0:43          textureLod (global 4-component vector of int)
+0:43          textureLod (temp 4-component vector of int)
 0:43            Construct combined texture-sampler (temp isamplerCube)
 0:43              'g_tTexcdi4' (uniform itextureCube)
 0:43              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -141,7 +141,7 @@
 0:44      Sequence
 0:44        move second child to first child (temp 4-component vector of uint)
 0:44          'txval42' (temp 4-component vector of uint)
-0:44          textureLod (global 4-component vector of uint)
+0:44          textureLod (temp 4-component vector of uint)
 0:44            Construct combined texture-sampler (temp usamplerCube)
 0:44              'g_tTexcdu4' (uniform utextureCube)
 0:44              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -199,7 +199,7 @@
 0:30      Sequence
 0:30        move second child to first child (temp 4-component vector of float)
 0:30          'txval10' (temp 4-component vector of float)
-0:30          textureLod (global 4-component vector of float)
+0:30          textureLod (temp 4-component vector of float)
 0:30            Construct combined texture-sampler (temp sampler1D)
 0:30              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:30              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -210,7 +210,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of int)
 0:31          'txval11' (temp 4-component vector of int)
-0:31          textureLod (global 4-component vector of int)
+0:31          textureLod (temp 4-component vector of int)
 0:31            Construct combined texture-sampler (temp isampler1D)
 0:31              'g_tTex1di4' (uniform itexture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -221,7 +221,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of uint)
 0:32          'txval12' (temp 4-component vector of uint)
-0:32          textureLod (global 4-component vector of uint)
+0:32          textureLod (temp 4-component vector of uint)
 0:32            Construct combined texture-sampler (temp usampler1D)
 0:32              'g_tTex1du4' (uniform utexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -232,7 +232,7 @@
 0:34      Sequence
 0:34        move second child to first child (temp 4-component vector of float)
 0:34          'txval20' (temp 4-component vector of float)
-0:34          textureLod (global 4-component vector of float)
+0:34          textureLod (temp 4-component vector of float)
 0:34            Construct combined texture-sampler (temp sampler2D)
 0:34              'g_tTex2df4' (uniform texture2D)
 0:34              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -244,7 +244,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of int)
 0:35          'txval21' (temp 4-component vector of int)
-0:35          textureLod (global 4-component vector of int)
+0:35          textureLod (temp 4-component vector of int)
 0:35            Construct combined texture-sampler (temp isampler2D)
 0:35              'g_tTex2di4' (uniform itexture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -256,7 +256,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of uint)
 0:36          'txval22' (temp 4-component vector of uint)
-0:36          textureLod (global 4-component vector of uint)
+0:36          textureLod (temp 4-component vector of uint)
 0:36            Construct combined texture-sampler (temp usampler2D)
 0:36              'g_tTex2du4' (uniform utexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -268,7 +268,7 @@
 0:38      Sequence
 0:38        move second child to first child (temp 4-component vector of float)
 0:38          'txval30' (temp 4-component vector of float)
-0:38          textureLod (global 4-component vector of float)
+0:38          textureLod (temp 4-component vector of float)
 0:38            Construct combined texture-sampler (temp sampler3D)
 0:38              'g_tTex3df4' (uniform texture3D)
 0:38              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -281,7 +281,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of int)
 0:39          'txval31' (temp 4-component vector of int)
-0:39          textureLod (global 4-component vector of int)
+0:39          textureLod (temp 4-component vector of int)
 0:39            Construct combined texture-sampler (temp isampler3D)
 0:39              'g_tTex3di4' (uniform itexture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -294,7 +294,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of uint)
 0:40          'txval32' (temp 4-component vector of uint)
-0:40          textureLod (global 4-component vector of uint)
+0:40          textureLod (temp 4-component vector of uint)
 0:40            Construct combined texture-sampler (temp usampler3D)
 0:40              'g_tTex3du4' (uniform utexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -307,7 +307,7 @@
 0:42      Sequence
 0:42        move second child to first child (temp 4-component vector of float)
 0:42          'txval40' (temp 4-component vector of float)
-0:42          textureLod (global 4-component vector of float)
+0:42          textureLod (temp 4-component vector of float)
 0:42            Construct combined texture-sampler (temp samplerCube)
 0:42              'g_tTexcdf4' (uniform textureCube)
 0:42              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -320,7 +320,7 @@
 0:43      Sequence
 0:43        move second child to first child (temp 4-component vector of int)
 0:43          'txval41' (temp 4-component vector of int)
-0:43          textureLod (global 4-component vector of int)
+0:43          textureLod (temp 4-component vector of int)
 0:43            Construct combined texture-sampler (temp isamplerCube)
 0:43              'g_tTexcdi4' (uniform itextureCube)
 0:43              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -333,7 +333,7 @@
 0:44      Sequence
 0:44        move second child to first child (temp 4-component vector of uint)
 0:44          'txval42' (temp 4-component vector of uint)
-0:44          textureLod (global 4-component vector of uint)
+0:44          textureLod (temp 4-component vector of uint)
 0:44            Construct combined texture-sampler (temp usamplerCube)
 0:44              'g_tTexcdu4' (uniform utextureCube)
 0:44              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplelevel.offset.dx10.frag.out b/Test/baseResults/hlsl.samplelevel.offset.dx10.frag.out
index 4d81649..0f0f968 100644
--- a/Test/baseResults/hlsl.samplelevel.offset.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplelevel.offset.dx10.frag.out
@@ -8,7 +8,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          textureLodOffset (global 4-component vector of float)
+0:31          textureLodOffset (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -21,7 +21,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          textureLodOffset (global 4-component vector of int)
+0:32          textureLodOffset (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -34,7 +34,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          textureLodOffset (global 4-component vector of uint)
+0:33          textureLodOffset (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -47,7 +47,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          textureLodOffset (global 4-component vector of float)
+0:35          textureLodOffset (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -62,7 +62,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          textureLodOffset (global 4-component vector of int)
+0:36          textureLodOffset (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -77,7 +77,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          textureLodOffset (global 4-component vector of uint)
+0:37          textureLodOffset (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -92,7 +92,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          textureLodOffset (global 4-component vector of float)
+0:39          textureLodOffset (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -109,7 +109,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          textureLodOffset (global 4-component vector of int)
+0:40          textureLodOffset (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -126,7 +126,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          textureLodOffset (global 4-component vector of uint)
+0:41          textureLodOffset (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -203,7 +203,7 @@
 0:31      Sequence
 0:31        move second child to first child (temp 4-component vector of float)
 0:31          'txval10' (temp 4-component vector of float)
-0:31          textureLodOffset (global 4-component vector of float)
+0:31          textureLodOffset (temp 4-component vector of float)
 0:31            Construct combined texture-sampler (temp sampler1D)
 0:31              'g_tTex1df4' (layout(binding=0 ) uniform texture1D)
 0:31              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -216,7 +216,7 @@
 0:32      Sequence
 0:32        move second child to first child (temp 4-component vector of int)
 0:32          'txval11' (temp 4-component vector of int)
-0:32          textureLodOffset (global 4-component vector of int)
+0:32          textureLodOffset (temp 4-component vector of int)
 0:32            Construct combined texture-sampler (temp isampler1D)
 0:32              'g_tTex1di4' (uniform itexture1D)
 0:32              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -229,7 +229,7 @@
 0:33      Sequence
 0:33        move second child to first child (temp 4-component vector of uint)
 0:33          'txval12' (temp 4-component vector of uint)
-0:33          textureLodOffset (global 4-component vector of uint)
+0:33          textureLodOffset (temp 4-component vector of uint)
 0:33            Construct combined texture-sampler (temp usampler1D)
 0:33              'g_tTex1du4' (uniform utexture1D)
 0:33              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -242,7 +242,7 @@
 0:35      Sequence
 0:35        move second child to first child (temp 4-component vector of float)
 0:35          'txval20' (temp 4-component vector of float)
-0:35          textureLodOffset (global 4-component vector of float)
+0:35          textureLodOffset (temp 4-component vector of float)
 0:35            Construct combined texture-sampler (temp sampler2D)
 0:35              'g_tTex2df4' (uniform texture2D)
 0:35              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -257,7 +257,7 @@
 0:36      Sequence
 0:36        move second child to first child (temp 4-component vector of int)
 0:36          'txval21' (temp 4-component vector of int)
-0:36          textureLodOffset (global 4-component vector of int)
+0:36          textureLodOffset (temp 4-component vector of int)
 0:36            Construct combined texture-sampler (temp isampler2D)
 0:36              'g_tTex2di4' (uniform itexture2D)
 0:36              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -272,7 +272,7 @@
 0:37      Sequence
 0:37        move second child to first child (temp 4-component vector of uint)
 0:37          'txval22' (temp 4-component vector of uint)
-0:37          textureLodOffset (global 4-component vector of uint)
+0:37          textureLodOffset (temp 4-component vector of uint)
 0:37            Construct combined texture-sampler (temp usampler2D)
 0:37              'g_tTex2du4' (uniform utexture2D)
 0:37              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -287,7 +287,7 @@
 0:39      Sequence
 0:39        move second child to first child (temp 4-component vector of float)
 0:39          'txval30' (temp 4-component vector of float)
-0:39          textureLodOffset (global 4-component vector of float)
+0:39          textureLodOffset (temp 4-component vector of float)
 0:39            Construct combined texture-sampler (temp sampler3D)
 0:39              'g_tTex3df4' (uniform texture3D)
 0:39              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -304,7 +304,7 @@
 0:40      Sequence
 0:40        move second child to first child (temp 4-component vector of int)
 0:40          'txval31' (temp 4-component vector of int)
-0:40          textureLodOffset (global 4-component vector of int)
+0:40          textureLodOffset (temp 4-component vector of int)
 0:40            Construct combined texture-sampler (temp isampler3D)
 0:40              'g_tTex3di4' (uniform itexture3D)
 0:40              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -321,7 +321,7 @@
 0:41      Sequence
 0:41        move second child to first child (temp 4-component vector of uint)
 0:41          'txval32' (temp 4-component vector of uint)
-0:41          textureLodOffset (global 4-component vector of uint)
+0:41          textureLodOffset (temp 4-component vector of uint)
 0:41            Construct combined texture-sampler (temp usampler3D)
 0:41              'g_tTex3du4' (uniform utexture3D)
 0:41              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/baseResults/hlsl.samplelevel.offsetarray.dx10.frag.out b/Test/baseResults/hlsl.samplelevel.offsetarray.dx10.frag.out
index ef3dcf1..8eb74cd 100644
--- a/Test/baseResults/hlsl.samplelevel.offsetarray.dx10.frag.out
+++ b/Test/baseResults/hlsl.samplelevel.offsetarray.dx10.frag.out
@@ -8,7 +8,7 @@
 0:23      Sequence
 0:23        move second child to first child (temp 4-component vector of float)
 0:23          'txval10' (temp 4-component vector of float)
-0:23          textureLodOffset (global 4-component vector of float)
+0:23          textureLodOffset (temp 4-component vector of float)
 0:23            Construct combined texture-sampler (temp sampler1DArray)
 0:23              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:23              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -22,7 +22,7 @@
 0:24      Sequence
 0:24        move second child to first child (temp 4-component vector of int)
 0:24          'txval11' (temp 4-component vector of int)
-0:24          textureLodOffset (global 4-component vector of int)
+0:24          textureLodOffset (temp 4-component vector of int)
 0:24            Construct combined texture-sampler (temp isampler1DArray)
 0:24              'g_tTex1di4' (uniform itexture1DArray)
 0:24              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -36,7 +36,7 @@
 0:25      Sequence
 0:25        move second child to first child (temp 4-component vector of uint)
 0:25          'txval12' (temp 4-component vector of uint)
-0:25          textureLodOffset (global 4-component vector of uint)
+0:25          textureLodOffset (temp 4-component vector of uint)
 0:25            Construct combined texture-sampler (temp usampler1DArray)
 0:25              'g_tTex1du4' (uniform utexture1DArray)
 0:25              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -50,7 +50,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval20' (temp 4-component vector of float)
-0:27          textureLodOffset (global 4-component vector of float)
+0:27          textureLodOffset (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler2DArray)
 0:27              'g_tTex2df4' (uniform texture2DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -66,7 +66,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval21' (temp 4-component vector of int)
-0:28          textureLodOffset (global 4-component vector of int)
+0:28          textureLodOffset (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler2DArray)
 0:28              'g_tTex2di4' (uniform itexture2DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -82,7 +82,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval22' (temp 4-component vector of uint)
-0:29          textureLodOffset (global 4-component vector of uint)
+0:29          textureLodOffset (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler2DArray)
 0:29              'g_tTex2du4' (uniform utexture2DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -152,7 +152,7 @@
 0:23      Sequence
 0:23        move second child to first child (temp 4-component vector of float)
 0:23          'txval10' (temp 4-component vector of float)
-0:23          textureLodOffset (global 4-component vector of float)
+0:23          textureLodOffset (temp 4-component vector of float)
 0:23            Construct combined texture-sampler (temp sampler1DArray)
 0:23              'g_tTex1df4' (layout(binding=0 ) uniform texture1DArray)
 0:23              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -166,7 +166,7 @@
 0:24      Sequence
 0:24        move second child to first child (temp 4-component vector of int)
 0:24          'txval11' (temp 4-component vector of int)
-0:24          textureLodOffset (global 4-component vector of int)
+0:24          textureLodOffset (temp 4-component vector of int)
 0:24            Construct combined texture-sampler (temp isampler1DArray)
 0:24              'g_tTex1di4' (uniform itexture1DArray)
 0:24              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -180,7 +180,7 @@
 0:25      Sequence
 0:25        move second child to first child (temp 4-component vector of uint)
 0:25          'txval12' (temp 4-component vector of uint)
-0:25          textureLodOffset (global 4-component vector of uint)
+0:25          textureLodOffset (temp 4-component vector of uint)
 0:25            Construct combined texture-sampler (temp usampler1DArray)
 0:25              'g_tTex1du4' (uniform utexture1DArray)
 0:25              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -194,7 +194,7 @@
 0:27      Sequence
 0:27        move second child to first child (temp 4-component vector of float)
 0:27          'txval20' (temp 4-component vector of float)
-0:27          textureLodOffset (global 4-component vector of float)
+0:27          textureLodOffset (temp 4-component vector of float)
 0:27            Construct combined texture-sampler (temp sampler2DArray)
 0:27              'g_tTex2df4' (uniform texture2DArray)
 0:27              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -210,7 +210,7 @@
 0:28      Sequence
 0:28        move second child to first child (temp 4-component vector of int)
 0:28          'txval21' (temp 4-component vector of int)
-0:28          textureLodOffset (global 4-component vector of int)
+0:28          textureLodOffset (temp 4-component vector of int)
 0:28            Construct combined texture-sampler (temp isampler2DArray)
 0:28              'g_tTex2di4' (uniform itexture2DArray)
 0:28              'g_sSamp' (layout(binding=0 ) uniform sampler)
@@ -226,7 +226,7 @@
 0:29      Sequence
 0:29        move second child to first child (temp 4-component vector of uint)
 0:29          'txval22' (temp 4-component vector of uint)
-0:29          textureLodOffset (global 4-component vector of uint)
+0:29          textureLodOffset (temp 4-component vector of uint)
 0:29            Construct combined texture-sampler (temp usampler2DArray)
 0:29              'g_tTex2du4' (uniform utexture2DArray)
 0:29              'g_sSamp' (layout(binding=0 ) uniform sampler)
diff --git a/Test/hlsl.sample.sub-vec4.dx10.frag b/Test/hlsl.sample.sub-vec4.dx10.frag
new file mode 100644
index 0000000..991d976
--- /dev/null
+++ b/Test/hlsl.sample.sub-vec4.dx10.frag
@@ -0,0 +1,24 @@
+SamplerState       g_sSamp : register(s0);
+
+Texture1D <float>  g_tTex1df1;
+Texture1D <float2> g_tTex1df2;
+Texture1D <float3> g_tTex1df3;
+Texture1D <float4> g_tTex1df4;
+
+struct PS_OUTPUT
+{
+    float4 Color : SV_Target0;
+};
+
+PS_OUTPUT main()
+{
+   PS_OUTPUT psout;
+
+   float  txval10 = g_tTex1df1 . Sample(g_sSamp, 0.1);
+   float2 txval11 = g_tTex1df2 . Sample(g_sSamp, 0.2);
+   float3 txval12 = g_tTex1df3 . Sample(g_sSamp, 0.2);
+   float4 txval13 = g_tTex1df4 . Sample(g_sSamp, 0.2);
+
+   psout.Color = 1.0;
+   return psout;
+}
diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h
index fb3fb92..6c8cb82 100644
--- a/glslang/Include/Types.h
+++ b/glslang/Include/Types.h
@@ -78,6 +78,7 @@
     bool   combined : 1;  // true means texture is combined with a sampler, false means texture with no sampler
     bool    sampler : 1;  // true means a pure sampler, other fields should be clear()
     bool   external : 1;  // GL_OES_EGL_image_external
+    unsigned int vectorSize : 3;  // return vector size.  TODO: support arbitrary types.
 
     bool isImage()       const { return image && dim != EsdSubpass; }
     bool isSubpass()     const { return dim == EsdSubpass; }
@@ -99,6 +100,7 @@
         combined = false;
         sampler = false;
         external = false;
+        vectorSize = 4;
     }
 
     // make a combined sampler and texture
@@ -164,7 +166,8 @@
               image == right.image &&
            combined == right.combined &&
             sampler == right.sampler &&
-           external == right.external;
+           external == right.external &&
+         vectorSize == right.vectorSize;
     }
 
     bool operator!=(const TSampler& right) const
@@ -823,53 +826,6 @@
         default:              return "none";
         }
     }
-    static int getLayoutComponentCount(TLayoutFormat f)
-    {
-        switch (f) {
-        case ElfRgba32f:      return 4;
-        case ElfRgba16f:      return 4;
-        case ElfRg32f:        return 2;
-        case ElfRg16f:        return 2;
-        case ElfR11fG11fB10f: return 3;
-        case ElfR32f:         return 1;
-        case ElfR16f:         return 1;
-        case ElfRgba16:       return 4;
-        case ElfRgb10A2:      return 4;
-        case ElfRgba8:        return 4;
-        case ElfRg16:         return 2;
-        case ElfRg8:          return 2;
-        case ElfR16:          return 1;
-        case ElfR8:           return 1;
-        case ElfRgba16Snorm:  return 4;
-        case ElfRgba8Snorm:   return 4;
-        case ElfRg16Snorm:    return 2;
-        case ElfRg8Snorm:     return 2;
-        case ElfR16Snorm:     return 1;
-        case ElfR8Snorm:      return 1;
-
-        case ElfRgba32i:      return 4;
-        case ElfRgba16i:      return 4;
-        case ElfRgba8i:       return 4;
-        case ElfRg32i:        return 2;
-        case ElfRg16i:        return 2;
-        case ElfRg8i:         return 2;
-        case ElfR32i:         return 1;
-        case ElfR16i:         return 1;
-        case ElfR8i:          return 1;
-
-        case ElfRgba32ui:     return 4;
-        case ElfRgba16ui:     return 4;
-        case ElfRgba8ui:      return 4;
-        case ElfRg32ui:       return 2;
-        case ElfRg16ui:       return 2;
-        case ElfRgb10a2ui:    return 4;
-        case ElfRg8ui:        return 2;
-        case ElfR32ui:        return 1;
-        case ElfR16ui:        return 1;
-        case ElfR8ui:         return 1;
-        default:              return 4;
-        }
-    }
     static const char* getLayoutDepthString(TLayoutDepth d)
     {
         switch (d) {
diff --git a/gtests/Hlsl.FromFile.cpp b/gtests/Hlsl.FromFile.cpp
index cfca4b9..04e2d17 100644
--- a/gtests/Hlsl.FromFile.cpp
+++ b/gtests/Hlsl.FromFile.cpp
@@ -177,6 +177,7 @@
         {"hlsl.samplelevel.basic.dx10.vert", "main"},
         {"hlsl.samplelevel.offset.dx10.frag", "main"},
         {"hlsl.samplelevel.offsetarray.dx10.frag", "main"},
+        { "hlsl.sample.sub-vec4.dx10.frag", "main"},
         {"hlsl.semicolons.frag", "main"},
         {"hlsl.shapeConv.frag", "main"},
         {"hlsl.shapeConvRet.frag", "main"},
diff --git a/hlsl/hlslGrammar.cpp b/hlsl/hlslGrammar.cpp
index c9c4716..f064f1f 100755
--- a/hlsl/hlslGrammar.cpp
+++ b/hlsl/hlslGrammar.cpp
@@ -907,12 +907,6 @@
             return false;
         }
 
-        // if (txType.getVectorSize() != 1 && txType.getVectorSize() != 4 && !image) {
-        //     // TODO: handle vec2/3 types
-        //     expected("vector size not yet supported in texture type");
-        //     return false;
-        // }
-
         if (ms && acceptTokenClass(EHTokComma)) {
             // read sample count for multisample types, if given
             if (! peekTokenClass(EHTokIntConstant)) {
@@ -957,6 +951,9 @@
             sampler.setTexture(txType.getBasicType(), dim, array, shadow, ms);
         }
     }
+
+    // Remember the declared vector size.
+    sampler.vectorSize = txType.getVectorSize();
     
     type.shallowCopy(TType(sampler, EvqUniform, arraySizes));
     type.getQualifier().layoutFormat = format;
diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp
index 1ba7d08..97999d0 100755
--- a/hlsl/hlslParseHelper.cpp
+++ b/hlsl/hlslParseHelper.cpp
@@ -154,15 +154,15 @@
 {
     const int components = txType.getVectorSize();
 
-    const auto select = [&](TLayoutFormat v1, TLayoutFormat v2, TLayoutFormat v4) {
+    const auto selectFormat = [&components](TLayoutFormat v1, TLayoutFormat v2, TLayoutFormat v4) {
         return components == 1 ? v1 :
                components == 2 ? v2 : v4;
     };
 
     switch (txType.getBasicType()) {
-    case EbtFloat: return select(ElfR32f,  ElfRg32f,  ElfRgba32f);
-    case EbtInt:   return select(ElfR32i,  ElfRg32i,  ElfRgba32i);
-    case EbtUint:  return select(ElfR32ui, ElfRg32ui, ElfRgba32ui);
+    case EbtFloat: return selectFormat(ElfR32f,  ElfRg32f,  ElfRgba32f);
+    case EbtInt:   return selectFormat(ElfR32i,  ElfRg32i,  ElfRgba32i);
+    case EbtUint:  return selectFormat(ElfR32ui, ElfRg32ui, ElfRgba32ui);
     default:
         error(loc, "unknown basic type in image format", "", "");
         return ElfNone;
@@ -286,6 +286,8 @@
     TIntermTyped* object = lhsAsAggregate->getSequence()[0]->getAsTyped();
     TIntermTyped* coord  = lhsAsAggregate->getSequence()[1]->getAsTyped();
 
+    const TSampler& texSampler = object->getType().getSampler();
+
     const TLayoutFormat fmt = object->getType().getQualifier().layoutFormat;
 
     // We only handle this subset of the possible formats.
@@ -293,8 +295,7 @@
            fmt == ElfRg32f   || fmt == ElfRg32i   || fmt == ElfRg32ui   ||
            fmt == ElfR32f    || fmt == ElfR32i    || fmt == ElfR32ui);
 
-    const TType objDerefType(object->getType().getSampler().type, EvqTemporary, 
-                             TQualifier::getLayoutComponentCount(fmt));
+    const TType objDerefType(texSampler.type, EvqTemporary, texSampler.vectorSize);
 
     if (nodeAsBinary) {
         TIntermTyped* rhs = nodeAsBinary->getRight();
@@ -604,10 +605,9 @@
     if (base->getType().getBasicType() == EbtSampler && !base->isArray()) {
         const TSampler& sampler = base->getType().getSampler();
         if (sampler.isImage() || sampler.isTexture()) {
-            const int vecSize = TQualifier::getLayoutComponentCount(base->getType().getQualifier().layoutFormat);
             TIntermAggregate* load = new TIntermAggregate(sampler.isImage() ? EOpImageLoad : EOpTextureFetch);
 
-            load->setType(TType(sampler.type, EvqTemporary, vecSize));
+            load->setType(TType(sampler.type, EvqTemporary, sampler.vectorSize));
             load->setLoc(loc);
             load->getSequence().push_back(base);
             load->getSequence().push_back(index);
@@ -1444,6 +1444,31 @@
     if (!node || !node->getAsOperator())
         return;
 
+    const auto clampReturn = [&loc, &node, this](TIntermTyped* result, const TSampler& sampler) {
+        // Sampler return must always be a vec4, but we can construct a shorter vector
+        result->setType(TType(node->getType().getBasicType(), EvqTemporary, node->getVectorSize()));
+
+        if (sampler.vectorSize < node->getVectorSize()) {
+            // Too many components.  Construct shorter vector from it.
+            const TType clampedType(result->getType().getBasicType(), EvqTemporary, sampler.vectorSize);
+
+            TOperator op;
+
+            switch (sampler.type) {
+            case EbtInt:   op = EOpConstructInt;   break;
+            case EbtUint:  op = EOpConstructUint;  break;
+            case EbtFloat: op = EOpConstructFloat; break;
+            default:
+                error(loc, "unknown basic type in texture op", "", "");
+            }
+
+            result = constructBuiltIn(clampedType, op, result, loc, false);
+        }
+
+        result->setLoc(loc);
+        return result;
+    };
+
     const TOperator op  = node->getAsOperator()->getOp();
     const TIntermAggregate* argAggregate = arguments ? arguments->getAsAggregate() : nullptr;
 
@@ -1452,10 +1477,8 @@
     case EOpTexture:
         {
             // Texture with ddx & ddy is really gradient form in HLSL
-            if (argAggregate->getSequence().size() == 4) {
+            if (argAggregate->getSequence().size() == 4)
                 node->getAsAggregate()->setOperator(EOpTextureGrad);
-                break;
-            }
 
             break;
         }
@@ -1471,14 +1494,16 @@
             TIntermTyped* bias = intermediate.addIndex(EOpIndexDirect, arg1, w, loc);
 
             TOperator constructOp = EOpNull;
-            switch (arg0->getType().getSampler().dim) {
+            const TSampler& sampler = arg0->getType().getSampler();
+
+            switch (sampler.dim) {
             case Esd1D:   constructOp = EOpConstructFloat; break; // 1D
             case Esd2D:   constructOp = EOpConstructVec2;  break; // 2D
             case Esd3D:   constructOp = EOpConstructVec3;  break; // 3D
             case EsdCube: constructOp = EOpConstructVec3;  break; // also 3D
             default: break;
             }
-            
+
             TIntermAggregate* constructCoord = new TIntermAggregate(constructOp);
             constructCoord->getSequence().push_back(arg1);
             constructCoord->setLoc(loc);
@@ -1487,8 +1512,8 @@
             tex->getSequence().push_back(arg0);           // sampler
             tex->getSequence().push_back(constructCoord); // coordinate
             tex->getSequence().push_back(bias);           // bias
-            tex->setLoc(loc);
-            node = tex;
+            
+            node = clampReturn(tex, sampler);
 
             break;
         }
@@ -1502,6 +1527,7 @@
             TIntermTyped* argCoord  = argAggregate->getSequence()[2]->getAsTyped();
             TIntermTyped* argBias   = nullptr;
             TIntermTyped* argOffset = nullptr;
+            const TSampler& sampler = argTex->getType().getSampler();
 
             int nextArg = 3;
 
@@ -1527,9 +1553,7 @@
             if (argOffset != nullptr)
                 txsample->getSequence().push_back(argOffset);
 
-            txsample->setType(node->getType());
-            txsample->setLoc(loc);
-            node = txsample;
+            node = clampReturn(txsample, sampler);
 
             break;
         }
@@ -1542,6 +1566,7 @@
             TIntermTyped* argDDX    = argAggregate->getSequence()[3]->getAsTyped();
             TIntermTyped* argDDY    = argAggregate->getSequence()[4]->getAsTyped();
             TIntermTyped* argOffset = nullptr;
+            const TSampler& sampler = argTex->getType().getSampler();
 
             TOperator textureOp = EOpTextureGrad;
 
@@ -1561,9 +1586,7 @@
             if (argOffset != nullptr)
                 txsample->getSequence().push_back(argOffset);
 
-            txsample->setType(node->getType());
-            txsample->setLoc(loc);
-            node = txsample;
+            node = clampReturn(txsample, sampler);
 
             break;
         }
@@ -1582,9 +1605,9 @@
 
             assert(texType.getBasicType() == EbtSampler);
 
-            const TSampler& texSampler = texType.getSampler();
-            const TSamplerDim dim = texSampler.dim;
-            const bool isImage = texSampler.isImage();
+            const TSampler& sampler = texType.getSampler();
+            const TSamplerDim dim = sampler.dim;
+            const bool isImage = sampler.isImage();
             const int numArgs = (int)argAggregate->getSequence().size();
 
             int numDims = 0;
@@ -1600,11 +1623,11 @@
             }
 
             // Arrayed adds another dimension for the number of array elements
-            if (texSampler.isArrayed())
+            if (sampler.isArrayed())
                 ++numDims;
 
             // Establish whether we're querying mip levels
-            const bool mipQuery = (numArgs > (numDims + 1)) && (!texSampler.isMultiSample());
+            const bool mipQuery = (numArgs > (numDims + 1)) && (!sampler.isMultiSample());
 
             // AST assumes integer return.  Will be converted to float if required.
             TIntermAggregate* sizeQuery = new TIntermAggregate(isImage ? EOpImageQuerySize : EOpTextureQuerySize);
@@ -1662,7 +1685,7 @@
             }
 
             // 2DMS formats query # samples, which needs a different query op
-            if (texSampler.isMultiSample()) {
+            if (sampler.isMultiSample()) {
                 TIntermTyped* outParam = argAggregate->getSequence()[outParamBase + numDims]->getAsTyped();
 
                 TIntermAggregate* samplesQuery = new TIntermAggregate(EOpImageQuerySamples);
@@ -1751,9 +1774,10 @@
             TIntermTyped* lodComponent = nullptr;
             TIntermTyped* coordSwizzle = nullptr;
 
-            const bool isMS = argTex->getType().getSampler().isMultiSample();
-            const bool isBuffer = argTex->getType().getSampler().dim == EsdBuffer;
-            const bool isImage = argTex->getType().getSampler().isImage();
+            const TSampler& sampler = argTex->getType().getSampler();
+            const bool isMS = sampler.isMultiSample();
+            const bool isBuffer = sampler.dim == EsdBuffer;
+            const bool isImage = sampler.isImage();
             const TBasicType coordBaseType = argCoord->getType().getBasicType();
 
             // Last component of coordinate is the mip level, for non-MS.  we separate them here:
@@ -1807,11 +1831,7 @@
                 txfetch->getSequence().push_back(argOffset);
             }
 
-            int vecSize = TQualifier::getLayoutComponentCount(argTex->getType().getQualifier().layoutFormat);
-
-            txfetch->setType(TType(node->getType().getBasicType(), EvqTemporary, vecSize));
-            txfetch->setLoc(loc);
-            node = txfetch;
+            node = clampReturn(txfetch, sampler);
 
             break;
         }
@@ -1823,7 +1843,8 @@
             TIntermTyped* argCoord  = argAggregate->getSequence()[2]->getAsTyped();
             TIntermTyped* argLod    = argAggregate->getSequence()[3]->getAsTyped();
             TIntermTyped* argOffset = nullptr;
-
+            const TSampler& sampler = argTex->getType().getSampler();
+            
             const int  numArgs = (int)argAggregate->getSequence().size();
 
             if (numArgs == 5) // offset, if present
@@ -1841,9 +1862,7 @@
             if (argOffset != nullptr)
                 txsample->getSequence().push_back(argOffset);
 
-            txsample->setType(node->getType());
-            txsample->setLoc(loc);
-            node = txsample;
+            node = clampReturn(txsample, sampler);
 
             break;
         }
diff --git a/hlsl/hlslParseables.cpp b/hlsl/hlslParseables.cpp
index a2d500f..d33cfb8 100755
--- a/hlsl/hlslParseables.cpp
+++ b/hlsl/hlslParseables.cpp
@@ -708,15 +708,15 @@
         { "SampleLevel",        /*!O*/        "V4",    nullptr,   "%@,S,V,S",       "FIU,S,F,",      EShLangAll },
         { "SampleLevel",        /* O*/        "V4",    nullptr,   "%@,S,V,S,V",     "FIU,S,F,,I",    EShLangAll },
 
-        { "Load",               /*!O*/        "V4",    nullptr,   "%@*,V",          "FIU,I",         EShLangAll },
+        { "Load",               /*!O*/        "V4",    nullptr,   "%@,V",           "FIU,I",         EShLangAll },
         { "Load",               /* O*/        "V4",    nullptr,   "%@,V,V",         "FIU,I,I",       EShLangAll },
         { "Load", /* +sampleidex*/            "V4",    nullptr,   "$&,V,S",         "FIU,I,I",       EShLangAll },
         { "Load", /* +samplindex, offset*/    "V4",    nullptr,   "$&,V,S,V",       "FIU,I,I,I",     EShLangAll },
 
         // RWTexture loads
         { "Load",                             "V4",    nullptr,   "!#,V",           "FIU,I",         EShLangAll },
-        // RWBuffer loads
-        { "Load",                             "V4",    nullptr,   "~1,V",           "FIU,I",         EShLangAll },
+        // (RW)Buffer loads
+        { "Load",                             "V4",    nullptr,   "~*1,V",           "FIU,I",         EShLangAll },
 
         { "Gather",             /*!O*/        "V4",    nullptr,   "%@,S,V",         "FIU,S,F",       EShLangAll },
         { "Gather",             /* O*/        "V4",    nullptr,   "%@,S,V,V",       "FIU,S,F,I",     EShLangAll },