diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 3597c0a3..4937f9ca 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -5361,8 +5361,7 @@ bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node) } // A node is trivial if it is a single operation with no side effects. -// Vector results seem ill-defined, currently classifying them as trivial too, -// to avoid scalar bool-based control-flow logic. +// HLSL (and/or vectors) are always trivial, as it does not short circuit. // Otherwise, error on the side of saying non-trivial. // Return true if trivial. bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node) @@ -5370,8 +5369,8 @@ bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node) if (node == nullptr) return false; - // count vectors as trivial - if (node->getType().isVector()) + // count non scalars as trivial, as well as anything coming from HLSL + if (! node->getType().isScalarOrVec1() || glslangIntermediate->getSource() == glslang::EShSourceHlsl) return true; // symbols and constants are trivial diff --git a/Test/baseResults/hlsl.implicitBool.frag.out b/Test/baseResults/hlsl.implicitBool.frag.out index 01c0fe5b..476769bf 100755 --- a/Test/baseResults/hlsl.implicitBool.frag.out +++ b/Test/baseResults/hlsl.implicitBool.frag.out @@ -335,12 +335,12 @@ gl_FragCoord origin is upper left // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 145 +// Id's are bound by 140 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 143 + EntryPoint Fragment 4 "main" 138 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" @@ -352,17 +352,17 @@ gl_FragCoord origin is upper left MemberName 16($Global) 2 "condf1" MemberName 16($Global) 3 "condi1" Name 18 "" - Name 93 "f" - Name 106 "i" - Name 126 "g" - Name 143 "@entryPointOutput" + Name 88 "f" + Name 101 "i" + Name 121 "g" + Name 138 "@entryPointOutput" MemberDecorate 16($Global) 0 Offset 0 MemberDecorate 16($Global) 1 Offset 4 MemberDecorate 16($Global) 2 Offset 8 MemberDecorate 16($Global) 3 Offset 12 Decorate 16($Global) Block Decorate 18 DescriptorSet 0 - Decorate 143(@entryPointOutput) Location 0 + Decorate 138(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -388,25 +388,25 @@ gl_FragCoord origin is upper left 53: 6(float) Constant 1077936128 57: 15(int) Constant 3 64: 6(float) Constant 1082130432 - 88: 6(float) Constant 1084227584 - 92: TypePointer Function 6(float) - 105: TypePointer Function 15(int) - 130: 6(float) Constant 1088421888 - 131: 6(float) Constant 1090519040 - 142: TypePointer Output 7(fvec4) -143(@entryPointOutput): 142(ptr) Variable Output + 83: 6(float) Constant 1084227584 + 87: TypePointer Function 6(float) + 100: TypePointer Function 15(int) + 125: 6(float) Constant 1088421888 + 126: 6(float) Constant 1090519040 + 137: TypePointer Output 7(fvec4) +138(@entryPointOutput): 137(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 144: 7(fvec4) FunctionCall 9(@main() - Store 143(@entryPointOutput) 144 + 139: 7(fvec4) FunctionCall 9(@main() + Store 138(@entryPointOutput) 139 Return FunctionEnd 9(@main(): 7(fvec4) Function None 8 10: Label 12(a): 11(ptr) Variable Function - 93(f): 92(ptr) Variable Function - 106(i): 105(ptr) Variable Function - 126(g): 92(ptr) Variable Function + 88(f): 87(ptr) Variable Function + 101(i): 100(ptr) Variable Function + 121(g): 87(ptr) Variable Function Store 12(a) 14 21: 20(ptr) AccessChain 18 19 22: 15(int) Load 21 @@ -455,98 +455,87 @@ gl_FragCoord origin is upper left 68: 20(ptr) AccessChain 18 19 69: 15(int) Load 68 70: 23(bool) INotEqual 69 25 - SelectionMerge 72 None - BranchConditional 70 71 72 - 71: Label - 73: 35(ptr) AccessChain 18 34 - 74: 6(float) Load 73 - 75: 15(int) ConvertFToS 74 - 76: 23(bool) INotEqual 75 25 - Branch 72 - 72: Label - 77: 23(bool) Phi 70 62 76 71 - 78: 23(bool) LogicalNot 77 - SelectionMerge 80 None - BranchConditional 78 79 80 - 79: Label - 81: 35(ptr) AccessChain 18 46 - 82: 6(float) Load 81 - 83: 23(bool) FOrdNotEqual 82 38 - Branch 80 - 80: Label - 84: 23(bool) Phi 77 72 83 79 - SelectionMerge 86 None - BranchConditional 84 85 86 - 85: Label - 87: 7(fvec4) Load 12(a) - 89: 7(fvec4) CompositeConstruct 88 88 88 88 - 90: 7(fvec4) FAdd 87 89 - ReturnValue 90 - 86: Label - 94: 35(ptr) AccessChain 18 34 - 95: 6(float) Load 94 - Store 93(f) 95 - Branch 96 - 96: Label - LoopMerge 98 99 None - Branch 100 - 100: Label - 101: 6(float) Load 93(f) - 102: 23(bool) FOrdNotEqual 101 38 - BranchConditional 102 97 98 - 97: Label - 103: 6(float) Load 93(f) - 104: 6(float) FSub 103 30 - Store 93(f) 104 - Branch 99 - 99: Label - Branch 96 - 98: Label - 107: 20(ptr) AccessChain 18 19 - 108: 15(int) Load 107 - Store 106(i) 108 - Branch 109 - 109: Label - LoopMerge 111 112 None - Branch 110 - 110: Label - 113: 15(int) Load 106(i) - 114: 15(int) ISub 113 19 - Store 106(i) 114 + 71: 35(ptr) AccessChain 18 34 + 72: 6(float) Load 71 + 73: 15(int) ConvertFToS 72 + 74: 23(bool) INotEqual 73 25 + 75: 23(bool) LogicalAnd 70 74 + 76: 35(ptr) AccessChain 18 46 + 77: 6(float) Load 76 + 78: 23(bool) FOrdNotEqual 77 38 + 79: 23(bool) LogicalOr 75 78 + SelectionMerge 81 None + BranchConditional 79 80 81 + 80: Label + 82: 7(fvec4) Load 12(a) + 84: 7(fvec4) CompositeConstruct 83 83 83 83 + 85: 7(fvec4) FAdd 82 84 + ReturnValue 85 + 81: Label + 89: 35(ptr) AccessChain 18 34 + 90: 6(float) Load 89 + Store 88(f) 90 + Branch 91 + 91: Label + LoopMerge 93 94 None + Branch 95 + 95: Label + 96: 6(float) Load 88(f) + 97: 23(bool) FOrdNotEqual 96 38 + BranchConditional 97 92 93 + 92: Label + 98: 6(float) Load 88(f) + 99: 6(float) FSub 98 30 + Store 88(f) 99 + Branch 94 + 94: Label + Branch 91 + 93: Label + 102: 20(ptr) AccessChain 18 19 + 103: 15(int) Load 102 + Store 101(i) 103 + Branch 104 + 104: Label + LoopMerge 106 107 None + Branch 105 + 105: Label + 108: 15(int) Load 101(i) + 109: 15(int) ISub 108 19 + Store 101(i) 109 + Branch 107 + 107: Label + 110: 15(int) Load 101(i) + 111: 23(bool) INotEqual 110 25 + BranchConditional 111 104 106 + 106: Label Branch 112 112: Label - 115: 15(int) Load 106(i) - 116: 23(bool) INotEqual 115 25 - BranchConditional 116 109 111 - 111: Label - Branch 117 - 117: Label - LoopMerge 119 120 None - Branch 121 - 121: Label - 122: 15(int) Load 106(i) - 123: 23(bool) INotEqual 122 25 - BranchConditional 123 118 119 - 118: Label - 124: 15(int) Load 106(i) - 125: 15(int) ISub 124 19 - Store 106(i) 125 - Branch 120 - 120: Label - Branch 117 - 119: Label - 127: 35(ptr) AccessChain 18 34 - 128: 6(float) Load 127 - 129: 23(bool) FOrdNotEqual 128 38 - 132: 6(float) Select 129 130 131 - Store 126(g) 132 - 133: 6(float) Load 126(g) - 134: 7(fvec4) Load 12(a) - 135: 7(fvec4) CompositeConstruct 133 133 133 133 - 136: 7(fvec4) FAdd 134 135 - Store 12(a) 136 - 137: 7(fvec4) Load 12(a) - 138: 7(fvec4) CompositeConstruct 30 30 30 30 - 139: 7(fvec4) FSub 137 138 - ReturnValue 139 + LoopMerge 114 115 None + Branch 116 + 116: Label + 117: 15(int) Load 101(i) + 118: 23(bool) INotEqual 117 25 + BranchConditional 118 113 114 + 113: Label + 119: 15(int) Load 101(i) + 120: 15(int) ISub 119 19 + Store 101(i) 120 + Branch 115 + 115: Label + Branch 112 + 114: Label + 122: 35(ptr) AccessChain 18 34 + 123: 6(float) Load 122 + 124: 23(bool) FOrdNotEqual 123 38 + 127: 6(float) Select 124 125 126 + Store 121(g) 127 + 128: 6(float) Load 121(g) + 129: 7(fvec4) Load 12(a) + 130: 7(fvec4) CompositeConstruct 128 128 128 128 + 131: 7(fvec4) FAdd 129 130 + Store 12(a) 131 + 132: 7(fvec4) Load 12(a) + 133: 7(fvec4) CompositeConstruct 30 30 30 30 + 134: 7(fvec4) FSub 132 133 + ReturnValue 134 FunctionEnd diff --git a/Test/baseResults/hlsl.isfinite.frag.out b/Test/baseResults/hlsl.isfinite.frag.out index 97212196..3850be9e 100644 --- a/Test/baseResults/hlsl.isfinite.frag.out +++ b/Test/baseResults/hlsl.isfinite.frag.out @@ -173,34 +173,34 @@ gl_FragCoord origin is upper left // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 91 +// Id's are bound by 85 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 89 + EntryPoint Fragment 4 "main" 83 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" Name 11 "test1(f1;" Name 10 "v" Name 15 "@main(" - Name 22 "@finitetmp" - Name 36 "@finitetmp" - Name 39 "$Global" - MemberName 39($Global) 0 "f" - MemberName 39($Global) 1 "f2" - MemberName 39($Global) 2 "f3" - Name 41 "" - Name 57 "@finitetmp" - Name 71 "@finitetmp" - Name 89 "@entryPointOutput" - MemberDecorate 39($Global) 0 Offset 0 - MemberDecorate 39($Global) 1 Offset 4 - MemberDecorate 39($Global) 2 Offset 16 - Decorate 39($Global) Block - Decorate 41 DescriptorSet 0 - Decorate 89(@entryPointOutput) Location 0 + Name 20 "@finitetmp" + Name 32 "@finitetmp" + Name 35 "$Global" + MemberName 35($Global) 0 "f" + MemberName 35($Global) 1 "f2" + MemberName 35($Global) 2 "f3" + Name 37 "" + Name 51 "@finitetmp" + Name 65 "@finitetmp" + Name 83 "@entryPointOutput" + MemberDecorate 35($Global) 0 Offset 0 + MemberDecorate 35($Global) 1 Offset 4 + MemberDecorate 35($Global) 2 Offset 16 + Decorate 35($Global) Block + Decorate 37 DescriptorSet 0 + Decorate 83(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -209,100 +209,85 @@ gl_FragCoord origin is upper left 9: TypeFunction 8(bool) 7(ptr) 13: TypeVector 6(float) 4 14: TypeFunction 13(fvec4) - 37: TypeVector 6(float) 2 - 38: TypeVector 6(float) 3 - 39($Global): TypeStruct 6(float) 37(fvec2) 38(fvec3) - 40: TypePointer Uniform 39($Global) - 41: 40(ptr) Variable Uniform - 42: TypeInt 32 1 - 43: 42(int) Constant 0 - 44: TypePointer Uniform 6(float) - 56: TypePointer Function 37(fvec2) - 58: 42(int) Constant 1 - 59: TypePointer Uniform 37(fvec2) - 63: TypeVector 8(bool) 2 - 70: TypePointer Function 38(fvec3) - 72: 42(int) Constant 2 - 73: TypePointer Uniform 38(fvec3) - 77: TypeVector 8(bool) 3 - 84: 6(float) Constant 0 - 85: 13(fvec4) ConstantComposite 84 84 84 84 - 88: TypePointer Output 13(fvec4) -89(@entryPointOutput): 88(ptr) Variable Output + 33: TypeVector 6(float) 2 + 34: TypeVector 6(float) 3 + 35($Global): TypeStruct 6(float) 33(fvec2) 34(fvec3) + 36: TypePointer Uniform 35($Global) + 37: 36(ptr) Variable Uniform + 38: TypeInt 32 1 + 39: 38(int) Constant 0 + 40: TypePointer Uniform 6(float) + 50: TypePointer Function 33(fvec2) + 52: 38(int) Constant 1 + 53: TypePointer Uniform 33(fvec2) + 57: TypeVector 8(bool) 2 + 64: TypePointer Function 34(fvec3) + 66: 38(int) Constant 2 + 67: TypePointer Uniform 34(fvec3) + 71: TypeVector 8(bool) 3 + 78: 6(float) Constant 0 + 79: 13(fvec4) ConstantComposite 78 78 78 78 + 82: TypePointer Output 13(fvec4) +83(@entryPointOutput): 82(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 90: 13(fvec4) FunctionCall 15(@main() - Store 89(@entryPointOutput) 90 + 84: 13(fvec4) FunctionCall 15(@main() + Store 83(@entryPointOutput) 84 Return FunctionEnd 11(test1(f1;): 8(bool) Function None 9 10(v): 7(ptr) FunctionParameter 12: Label - 22(@finitetmp): 7(ptr) Variable Function + 20(@finitetmp): 7(ptr) Variable Function 17: 6(float) Load 10(v) 18: 8(bool) IsNan 17 19: 8(bool) LogicalNot 18 - SelectionMerge 21 None - BranchConditional 19 20 21 - 20: Label - 23: 6(float) Load 10(v) - Store 22(@finitetmp) 23 - 24: 6(float) Load 22(@finitetmp) - 25: 8(bool) IsNan 24 - 26: 8(bool) LogicalNot 25 - SelectionMerge 28 None - BranchConditional 26 27 28 - 27: Label - 29: 6(float) Load 22(@finitetmp) - 30: 8(bool) IsInf 29 - 31: 8(bool) LogicalNot 30 - Branch 28 - 28: Label - 32: 8(bool) Phi 26 20 31 27 - Branch 21 - 21: Label - 33: 8(bool) Phi 19 12 32 28 - ReturnValue 33 + 21: 6(float) Load 10(v) + Store 20(@finitetmp) 21 + 22: 6(float) Load 20(@finitetmp) + 23: 8(bool) IsNan 22 + 24: 8(bool) LogicalNot 23 + 25: 6(float) Load 20(@finitetmp) + 26: 8(bool) IsInf 25 + 27: 8(bool) LogicalNot 26 + 28: 8(bool) LogicalAnd 24 27 + 29: 8(bool) LogicalAnd 19 28 + ReturnValue 29 FunctionEnd 15(@main(): 13(fvec4) Function None 14 16: Label - 36(@finitetmp): 7(ptr) Variable Function - 57(@finitetmp): 56(ptr) Variable Function - 71(@finitetmp): 70(ptr) Variable Function - 45: 44(ptr) AccessChain 41 43 - 46: 6(float) Load 45 - Store 36(@finitetmp) 46 - 47: 6(float) Load 36(@finitetmp) - 48: 8(bool) IsNan 47 - 49: 8(bool) LogicalNot 48 - SelectionMerge 51 None - BranchConditional 49 50 51 - 50: Label - 52: 6(float) Load 36(@finitetmp) - 53: 8(bool) IsInf 52 - 54: 8(bool) LogicalNot 53 - Branch 51 - 51: Label - 55: 8(bool) Phi 49 16 54 50 - 60: 59(ptr) AccessChain 41 58 - 61: 37(fvec2) Load 60 - Store 57(@finitetmp) 61 - 62: 37(fvec2) Load 57(@finitetmp) - 64: 63(bvec2) IsNan 62 - 65: 63(bvec2) LogicalNot 64 - 66: 37(fvec2) Load 57(@finitetmp) - 67: 63(bvec2) IsInf 66 - 68: 63(bvec2) LogicalNot 67 - 69: 63(bvec2) LogicalAnd 65 68 - 74: 73(ptr) AccessChain 41 72 - 75: 38(fvec3) Load 74 - Store 71(@finitetmp) 75 - 76: 38(fvec3) Load 71(@finitetmp) - 78: 77(bvec3) IsNan 76 - 79: 77(bvec3) LogicalNot 78 - 80: 38(fvec3) Load 71(@finitetmp) - 81: 77(bvec3) IsInf 80 - 82: 77(bvec3) LogicalNot 81 - 83: 77(bvec3) LogicalAnd 79 82 - ReturnValue 85 + 32(@finitetmp): 7(ptr) Variable Function + 51(@finitetmp): 50(ptr) Variable Function + 65(@finitetmp): 64(ptr) Variable Function + 41: 40(ptr) AccessChain 37 39 + 42: 6(float) Load 41 + Store 32(@finitetmp) 42 + 43: 6(float) Load 32(@finitetmp) + 44: 8(bool) IsNan 43 + 45: 8(bool) LogicalNot 44 + 46: 6(float) Load 32(@finitetmp) + 47: 8(bool) IsInf 46 + 48: 8(bool) LogicalNot 47 + 49: 8(bool) LogicalAnd 45 48 + 54: 53(ptr) AccessChain 37 52 + 55: 33(fvec2) Load 54 + Store 51(@finitetmp) 55 + 56: 33(fvec2) Load 51(@finitetmp) + 58: 57(bvec2) IsNan 56 + 59: 57(bvec2) LogicalNot 58 + 60: 33(fvec2) Load 51(@finitetmp) + 61: 57(bvec2) IsInf 60 + 62: 57(bvec2) LogicalNot 61 + 63: 57(bvec2) LogicalAnd 59 62 + 68: 67(ptr) AccessChain 37 66 + 69: 34(fvec3) Load 68 + Store 65(@finitetmp) 69 + 70: 34(fvec3) Load 65(@finitetmp) + 72: 71(bvec3) IsNan 70 + 73: 71(bvec3) LogicalNot 72 + 74: 34(fvec3) Load 65(@finitetmp) + 75: 71(bvec3) IsInf 74 + 76: 71(bvec3) LogicalNot 75 + 77: 71(bvec3) LogicalAnd 73 76 + ReturnValue 79 FunctionEnd diff --git a/Test/baseResults/hlsl.logical.binary.frag.out b/Test/baseResults/hlsl.logical.binary.frag.out index 587e3d5e..730205bd 100644 --- a/Test/baseResults/hlsl.logical.binary.frag.out +++ b/Test/baseResults/hlsl.logical.binary.frag.out @@ -129,106 +129,95 @@ gl_FragCoord origin is upper left // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 62 +// Id's are bound by 57 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 59 + EntryPoint Fragment 4 "main" 54 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" Name 8 "PS_OUTPUT" MemberName 8(PS_OUTPUT) 0 "Color" Name 10 "@main(" - Name 15 "$Global" - MemberName 15($Global) 0 "ival" - MemberName 15($Global) 1 "ival4" - MemberName 15($Global) 2 "fval" - MemberName 15($Global) 3 "fval4" - Name 17 "" - Name 50 "psout" - Name 59 "Color" - MemberDecorate 15($Global) 0 Offset 0 - MemberDecorate 15($Global) 1 Offset 16 - MemberDecorate 15($Global) 2 Offset 32 - MemberDecorate 15($Global) 3 Offset 48 - Decorate 15($Global) Block - Decorate 17 DescriptorSet 0 - Decorate 59(Color) Location 0 + Name 14 "$Global" + MemberName 14($Global) 0 "ival" + MemberName 14($Global) 1 "ival4" + MemberName 14($Global) 2 "fval" + MemberName 14($Global) 3 "fval4" + Name 16 "" + Name 45 "psout" + Name 54 "Color" + MemberDecorate 14($Global) 0 Offset 0 + MemberDecorate 14($Global) 1 Offset 16 + MemberDecorate 14($Global) 2 Offset 32 + MemberDecorate 14($Global) 3 Offset 48 + Decorate 14($Global) Block + Decorate 16 DescriptorSet 0 + Decorate 54(Color) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 8(PS_OUTPUT): TypeStruct 7(fvec4) 9: TypeFunction 8(PS_OUTPUT) - 12: TypeBool - 13: TypeInt 32 1 - 14: TypeVector 13(int) 4 - 15($Global): TypeStruct 13(int) 14(ivec4) 6(float) 7(fvec4) - 16: TypePointer Uniform 15($Global) - 17: 16(ptr) Variable Uniform - 18: 13(int) Constant 0 - 19: TypePointer Uniform 13(int) + 12: TypeInt 32 1 + 13: TypeVector 12(int) 4 + 14($Global): TypeStruct 12(int) 13(ivec4) 6(float) 7(fvec4) + 15: TypePointer Uniform 14($Global) + 16: 15(ptr) Variable Uniform + 17: 12(int) Constant 0 + 18: TypePointer Uniform 12(int) + 21: TypeBool 22: TypeInt 32 0 23: 22(int) Constant 0 - 27: 13(int) Constant 2 - 28: TypePointer Uniform 6(float) - 49: TypePointer Function 8(PS_OUTPUT) - 51: 6(float) Constant 1065353216 - 52: 7(fvec4) ConstantComposite 51 51 51 51 - 53: TypePointer Function 7(fvec4) - 58: TypePointer Output 7(fvec4) - 59(Color): 58(ptr) Variable Output + 25: 12(int) Constant 2 + 26: TypePointer Uniform 6(float) + 44: TypePointer Function 8(PS_OUTPUT) + 46: 6(float) Constant 1065353216 + 47: 7(fvec4) ConstantComposite 46 46 46 46 + 48: TypePointer Function 7(fvec4) + 53: TypePointer Output 7(fvec4) + 54(Color): 53(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 60:8(PS_OUTPUT) FunctionCall 10(@main() - 61: 7(fvec4) CompositeExtract 60 0 - Store 59(Color) 61 + 55:8(PS_OUTPUT) FunctionCall 10(@main() + 56: 7(fvec4) CompositeExtract 55 0 + Store 54(Color) 56 Return FunctionEnd 10(@main():8(PS_OUTPUT) Function None 9 11: Label - 50(psout): 49(ptr) Variable Function - 20: 19(ptr) AccessChain 17 18 - 21: 13(int) Load 20 - 24: 12(bool) INotEqual 21 23 - SelectionMerge 26 None - BranchConditional 24 25 26 - 25: Label - 29: 28(ptr) AccessChain 17 27 - 30: 6(float) Load 29 - 31: 13(int) ConvertFToS 30 - 32: 12(bool) INotEqual 31 23 - Branch 26 - 26: Label - 33: 12(bool) Phi 24 11 32 25 - SelectionMerge 35 None - BranchConditional 33 34 35 - 34: Label - Branch 35 - 35: Label - 36: 19(ptr) AccessChain 17 18 - 37: 13(int) Load 36 - 38: 12(bool) INotEqual 37 23 - 39: 12(bool) LogicalNot 38 - SelectionMerge 41 None - BranchConditional 39 40 41 - 40: Label - 42: 28(ptr) AccessChain 17 27 - 43: 6(float) Load 42 - 44: 13(int) ConvertFToS 43 - 45: 12(bool) INotEqual 44 23 - Branch 41 - 41: Label - 46: 12(bool) Phi 38 35 45 40 - SelectionMerge 48 None - BranchConditional 46 47 48 - 47: Label - Branch 48 - 48: Label - 54: 53(ptr) AccessChain 50(psout) 18 - Store 54 52 - 55:8(PS_OUTPUT) Load 50(psout) - ReturnValue 55 + 45(psout): 44(ptr) Variable Function + 19: 18(ptr) AccessChain 16 17 + 20: 12(int) Load 19 + 24: 21(bool) INotEqual 20 23 + 27: 26(ptr) AccessChain 16 25 + 28: 6(float) Load 27 + 29: 12(int) ConvertFToS 28 + 30: 21(bool) INotEqual 29 23 + 31: 21(bool) LogicalAnd 24 30 + SelectionMerge 33 None + BranchConditional 31 32 33 + 32: Label + Branch 33 + 33: Label + 34: 18(ptr) AccessChain 16 17 + 35: 12(int) Load 34 + 36: 21(bool) INotEqual 35 23 + 37: 26(ptr) AccessChain 16 25 + 38: 6(float) Load 37 + 39: 12(int) ConvertFToS 38 + 40: 21(bool) INotEqual 39 23 + 41: 21(bool) LogicalOr 36 40 + SelectionMerge 43 None + BranchConditional 41 42 43 + 42: Label + Branch 43 + 43: Label + 49: 48(ptr) AccessChain 45(psout) 17 + Store 49 47 + 50:8(PS_OUTPUT) Load 45(psout) + ReturnValue 50 FunctionEnd