SPV: Create more access chains addressing a few swizzling issues.

- Fixes #1233
- Treats local bools like anything else
- more consistently deals with a dynamic component selection
diff --git a/Test/baseResults/spv.boolInBlock.frag.out b/Test/baseResults/spv.boolInBlock.frag.out
index e099c72..1fb2941 100644
--- a/Test/baseResults/spv.boolInBlock.frag.out
+++ b/Test/baseResults/spv.boolInBlock.frag.out
@@ -1,12 +1,12 @@
 spv.boolInBlock.frag
 // Module Version 10000
 // Generated by (magic number): 80003
-// Id's are bound by 107
+// Id's are bound by 102
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 75
+                              EntryPoint Fragment 4  "main" 74
                               ExecutionMode 4 OriginUpperLeft
                               Source GLSL 450
                               Name 4  "main"
@@ -14,24 +14,24 @@
                               Name 12  "paramb4"
                               Name 13  "paramb2"
                               Name 17  "b1"
-                              Name 24  "Buffer"
-                              MemberName 24(Buffer) 0  "b2"
-                              Name 26  ""
-                              Name 39  "Uniform"
-                              MemberName 39(Uniform) 0  "b4"
-                              Name 41  ""
-                              Name 62  "param"
-                              Name 67  "param"
-                              Name 75  "fragColor"
-                              MemberDecorate 24(Buffer) 0 Offset 0
-                              Decorate 24(Buffer) BufferBlock
-                              Decorate 26 DescriptorSet 0
-                              Decorate 26 Binding 1
-                              MemberDecorate 39(Uniform) 0 Offset 0
-                              Decorate 39(Uniform) Block
-                              Decorate 41 DescriptorSet 0
-                              Decorate 41 Binding 0
-                              Decorate 75(fragColor) Location 0
+                              Name 25  "Buffer"
+                              MemberName 25(Buffer) 0  "b2"
+                              Name 27  ""
+                              Name 40  "Uniform"
+                              MemberName 40(Uniform) 0  "b4"
+                              Name 42  ""
+                              Name 60  "param"
+                              Name 66  "param"
+                              Name 74  "fragColor"
+                              MemberDecorate 25(Buffer) 0 Offset 0
+                              Decorate 25(Buffer) BufferBlock
+                              Decorate 27 DescriptorSet 0
+                              Decorate 27 Binding 1
+                              MemberDecorate 40(Uniform) 0 Offset 0
+                              Decorate 40(Uniform) Block
+                              Decorate 42 DescriptorSet 0
+                              Decorate 42 Binding 0
+                              Decorate 74(fragColor) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeBool
@@ -41,111 +41,106 @@
               10:             TypePointer Function 9(bvec2)
               11:             TypeFunction 2 8(ptr) 10(ptr)
               16:             TypePointer Function 6(bool)
-              22:             TypeInt 32 0
-              23:             TypeVector 22(int) 2
-      24(Buffer):             TypeStruct 23(ivec2)
-              25:             TypePointer Uniform 24(Buffer)
-              26:     25(ptr) Variable Uniform
-              27:             TypeInt 32 1
-              28:     27(int) Constant 0
-              29:     6(bool) ConstantFalse
-              30:    9(bvec2) ConstantComposite 29 29
-              31:     22(int) Constant 1
-              32:   23(ivec2) ConstantComposite 31 31
-              33:     22(int) Constant 0
-              34:   23(ivec2) ConstantComposite 33 33
-              36:             TypePointer Uniform 23(ivec2)
-              38:             TypeVector 22(int) 4
-     39(Uniform):             TypeStruct 38(ivec4)
-              40:             TypePointer Uniform 39(Uniform)
-              41:     40(ptr) Variable Uniform
-              42:             TypePointer Uniform 38(ivec4)
-              65:   38(ivec4) ConstantComposite 33 33 33 33
-              72:             TypeFloat 32
-              73:             TypeVector 72(float) 4
-              74:             TypePointer Output 73(fvec4)
-   75(fragColor):     74(ptr) Variable Output
-              87:   72(float) Constant 0
-              88:   72(float) Constant 1065353216
+              18:             TypeInt 32 0
+              19:     18(int) Constant 2
+              24:             TypeVector 18(int) 2
+      25(Buffer):             TypeStruct 24(ivec2)
+              26:             TypePointer Uniform 25(Buffer)
+              27:     26(ptr) Variable Uniform
+              28:             TypeInt 32 1
+              29:     28(int) Constant 0
+              30:     6(bool) ConstantFalse
+              31:    9(bvec2) ConstantComposite 30 30
+              32:     18(int) Constant 1
+              33:   24(ivec2) ConstantComposite 32 32
+              34:     18(int) Constant 0
+              35:   24(ivec2) ConstantComposite 34 34
+              37:             TypePointer Uniform 24(ivec2)
+              39:             TypeVector 18(int) 4
+     40(Uniform):             TypeStruct 39(ivec4)
+              41:             TypePointer Uniform 40(Uniform)
+              42:     41(ptr) Variable Uniform
+              43:             TypePointer Uniform 18(int)
+              61:             TypePointer Uniform 39(ivec4)
+              64:   39(ivec4) ConstantComposite 34 34 34 34
+              71:             TypeFloat 32
+              72:             TypeVector 71(float) 4
+              73:             TypePointer Output 72(fvec4)
+   74(fragColor):     73(ptr) Variable Output
+              84:   71(float) Constant 0
+              85:   71(float) Constant 1065353216
          4(main):           2 Function None 3
                5:             Label
-       62(param):      8(ptr) Variable Function
-       67(param):     10(ptr) Variable Function
-              35:   23(ivec2) Select 30 32 34
-              37:     36(ptr) AccessChain 26 28
-                              Store 37 35
-              43:     42(ptr) AccessChain 41 28
-              44:   38(ivec4) Load 43
-              45:     22(int) CompositeExtract 44 2
-              46:     6(bool) INotEqual 45 33
+       60(param):      8(ptr) Variable Function
+       66(param):     10(ptr) Variable Function
+              36:   24(ivec2) Select 31 33 35
+              38:     37(ptr) AccessChain 27 29
+                              Store 38 36
+              44:     43(ptr) AccessChain 42 29 19
+              45:     18(int) Load 44
+              46:     6(bool) INotEqual 45 34
                               SelectionMerge 48 None
                               BranchConditional 46 47 48
               47:               Label
-              49:     42(ptr)   AccessChain 41 28
-              50:   38(ivec4)   Load 49
-              51:     22(int)   CompositeExtract 50 0
-              52:     6(bool)   INotEqual 51 33
-              53:    9(bvec2)   CompositeConstruct 52 52
-              54:   23(ivec2)   Select 53 32 34
-              55:     36(ptr)   AccessChain 26 28
-                                Store 55 54
+              49:     43(ptr)   AccessChain 42 29 34
+              50:     18(int)   Load 49
+              51:     6(bool)   INotEqual 50 34
+              52:    9(bvec2)   CompositeConstruct 51 51
+              53:   24(ivec2)   Select 52 33 35
+              54:     37(ptr)   AccessChain 27 29
+                                Store 54 53
                                 Branch 48
               48:             Label
-              56:     36(ptr) AccessChain 26 28
-              57:   23(ivec2) Load 56
-              58:     22(int) CompositeExtract 57 0
-              59:     6(bool) INotEqual 58 33
-                              SelectionMerge 61 None
-                              BranchConditional 59 60 61
-              60:               Label
-              63:     42(ptr)   AccessChain 41 28
-              64:   38(ivec4)   Load 63
-              66:    7(bvec4)   INotEqual 64 65
-                                Store 62(param) 66
-              68:           2   FunctionCall 14(foo(vb4;vb2;) 62(param) 67(param)
-              69:    9(bvec2)   Load 67(param)
-              70:   23(ivec2)   Select 69 32 34
-              71:     36(ptr)   AccessChain 26 28
-                                Store 71 70
-                                Branch 61
-              61:             Label
-              76:     42(ptr) AccessChain 41 28
-              77:   38(ivec4) Load 76
-              78:     22(int) CompositeExtract 77 0
-              79:     6(bool) INotEqual 78 33
-                              SelectionMerge 81 None
-                              BranchConditional 79 80 81
-              80:               Label
-              82:     42(ptr)   AccessChain 41 28
-              83:   38(ivec4)   Load 82
-              84:     22(int)   CompositeExtract 83 1
-              85:     6(bool)   INotEqual 84 33
-                                Branch 81
-              81:             Label
-              86:     6(bool) Phi 79 61 85 80
-              89:   72(float) Select 86 88 87
-              90:   73(fvec4) CompositeConstruct 89 89 89 89
-                              Store 75(fragColor) 90
-              91:     42(ptr) AccessChain 41 28
-              92:   38(ivec4) Load 91
-              93:     22(int) CompositeExtract 92 0
-              94:     6(bool) INotEqual 93 33
-              95:     6(bool) LogicalNot 94
-                              SelectionMerge 97 None
-                              BranchConditional 95 96 97
-              96:               Label
-              98:     42(ptr)   AccessChain 41 28
-              99:   38(ivec4)   Load 98
-             100:     22(int)   CompositeExtract 99 1
-             101:     6(bool)   INotEqual 100 33
-                                Branch 97
-              97:             Label
-             102:     6(bool) Phi 94 81 101 96
-             103:   72(float) Select 102 88 87
-             104:   73(fvec4) CompositeConstruct 103 103 103 103
-             105:   73(fvec4) Load 75(fragColor)
-             106:   73(fvec4) FSub 105 104
-                              Store 75(fragColor) 106
+              55:     43(ptr) AccessChain 27 29 34
+              56:     18(int) Load 55
+              57:     6(bool) INotEqual 56 34
+                              SelectionMerge 59 None
+                              BranchConditional 57 58 59
+              58:               Label
+              62:     61(ptr)   AccessChain 42 29
+              63:   39(ivec4)   Load 62
+              65:    7(bvec4)   INotEqual 63 64
+                                Store 60(param) 65
+              67:           2   FunctionCall 14(foo(vb4;vb2;) 60(param) 66(param)
+              68:    9(bvec2)   Load 66(param)
+              69:   24(ivec2)   Select 68 33 35
+              70:     37(ptr)   AccessChain 27 29
+                                Store 70 69
+                                Branch 59
+              59:             Label
+              75:     43(ptr) AccessChain 42 29 34
+              76:     18(int) Load 75
+              77:     6(bool) INotEqual 76 34
+                              SelectionMerge 79 None
+                              BranchConditional 77 78 79
+              78:               Label
+              80:     43(ptr)   AccessChain 42 29 32
+              81:     18(int)   Load 80
+              82:     6(bool)   INotEqual 81 34
+                                Branch 79
+              79:             Label
+              83:     6(bool) Phi 77 59 82 78
+              86:   71(float) Select 83 85 84
+              87:   72(fvec4) CompositeConstruct 86 86 86 86
+                              Store 74(fragColor) 87
+              88:     43(ptr) AccessChain 42 29 34
+              89:     18(int) Load 88
+              90:     6(bool) INotEqual 89 34
+              91:     6(bool) LogicalNot 90
+                              SelectionMerge 93 None
+                              BranchConditional 91 92 93
+              92:               Label
+              94:     43(ptr)   AccessChain 42 29 32
+              95:     18(int)   Load 94
+              96:     6(bool)   INotEqual 95 34
+                                Branch 93
+              93:             Label
+              97:     6(bool) Phi 90 79 96 92
+              98:   71(float) Select 97 85 84
+              99:   72(fvec4) CompositeConstruct 98 98 98 98
+             100:   72(fvec4) Load 74(fragColor)
+             101:   72(fvec4) FSub 100 99
+                              Store 74(fragColor) 101
                               Return
                               FunctionEnd
 14(foo(vb4;vb2;):           2 Function None 11
@@ -153,11 +148,11 @@
      13(paramb2):     10(ptr) FunctionParameter
               15:             Label
           17(b1):     16(ptr) Variable Function
-              18:    7(bvec4) Load 12(paramb4)
-              19:     6(bool) CompositeExtract 18 2
-                              Store 17(b1) 19
-              20:     6(bool) Load 17(b1)
-              21:    9(bvec2) CompositeConstruct 20 20
-                              Store 13(paramb2) 21
+              20:     16(ptr) AccessChain 12(paramb4) 19
+              21:     6(bool) Load 20
+                              Store 17(b1) 21
+              22:     6(bool) Load 17(b1)
+              23:    9(bvec2) CompositeConstruct 22 22
+                              Store 13(paramb2) 23
                               Return
                               FunctionEnd