glslang/Test/baseResults/spv.forLoop.frag.out
Jeremy Hayes 6d5b40f051 Generate separate stores for partially swizzled memory stores
Full vector and fully specified vector swizzle stores are not affected by this change, only partial swizzles ie swizzles with fewer components than the vector being stored to.

Previously the vector being stored to loaded and any components not specified in the swizzle were used to create a full store to the vector.

While this change generates more SPIR-V instructions, it is necessary for correctness.

Fixes #2518.
2021-07-28 14:55:45 -06:00

234 lines
10 KiB
Plaintext

spv.forLoop.frag
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 143
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 11 24 28 36 53 111
ExecutionMode 4 OriginUpperLeft
Source GLSL 140
Name 4 "main"
Name 9 "color"
Name 11 "BaseColor"
Name 15 "i"
Name 24 "Count"
Name 28 "bigColor"
Name 36 "gl_FragColor"
Name 39 "sum"
Name 41 "i"
Name 53 "v4"
Name 63 "i"
Name 71 "tv4"
Name 88 "r"
Name 101 "i"
Name 111 "f"
Name 129 "i"
Decorate 11(BaseColor) Location 1
Decorate 24(Count) Flat
Decorate 24(Count) Location 3
Decorate 28(bigColor) Location 0
Decorate 36(gl_FragColor) Location 0
Decorate 53(v4) Flat
Decorate 53(v4) Location 4
Decorate 111(f) Location 2
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: TypePointer Input 7(fvec4)
11(BaseColor): 10(ptr) Variable Input
13: TypeInt 32 1
14: TypePointer Function 13(int)
16: 13(int) Constant 0
23: TypePointer Input 13(int)
24(Count): 23(ptr) Variable Input
26: TypeBool
28(bigColor): 10(ptr) Variable Input
33: 13(int) Constant 1
35: TypePointer Output 7(fvec4)
36(gl_FragColor): 35(ptr) Variable Output
38: TypePointer Function 6(float)
40: 6(float) Constant 0
48: 13(int) Constant 4
50: TypeInt 32 0
51: TypeVector 50(int) 4
52: TypePointer Input 51(ivec4)
53(v4): 52(ptr) Variable Input
55: TypePointer Input 50(int)
76: 50(int) Constant 4
89: TypeVector 6(float) 3
92: 50(int) Constant 0
95: 50(int) Constant 1
98: 50(int) Constant 2
110: TypePointer Input 6(float)
111(f): 110(ptr) Variable Input
113: 50(int) Constant 3
122: TypePointer Output 6(float)
136: 13(int) Constant 16
4(main): 2 Function None 3
5: Label
9(color): 8(ptr) Variable Function
15(i): 14(ptr) Variable Function
39(sum): 38(ptr) Variable Function
41(i): 14(ptr) Variable Function
63(i): 14(ptr) Variable Function
71(tv4): 8(ptr) Variable Function
88(r): 8(ptr) Variable Function
101(i): 14(ptr) Variable Function
129(i): 14(ptr) Variable Function
12: 7(fvec4) Load 11(BaseColor)
Store 9(color) 12
Store 15(i) 16
Branch 17
17: Label
LoopMerge 19 20 None
Branch 21
21: Label
22: 13(int) Load 15(i)
25: 13(int) Load 24(Count)
27: 26(bool) SLessThan 22 25
BranchConditional 27 18 19
18: Label
29: 7(fvec4) Load 28(bigColor)
30: 7(fvec4) Load 9(color)
31: 7(fvec4) FAdd 30 29
Store 9(color) 31
Branch 20
20: Label
32: 13(int) Load 15(i)
34: 13(int) IAdd 32 33
Store 15(i) 34
Branch 17
19: Label
37: 7(fvec4) Load 9(color)
Store 36(gl_FragColor) 37
Store 39(sum) 40
Store 41(i) 16
Branch 42
42: Label
LoopMerge 44 45 None
Branch 46
46: Label
47: 13(int) Load 41(i)
49: 26(bool) SLessThan 47 48
BranchConditional 49 43 44
43: Label
54: 13(int) Load 41(i)
56: 55(ptr) AccessChain 53(v4) 54
57: 50(int) Load 56
58: 6(float) ConvertUToF 57
59: 6(float) Load 39(sum)
60: 6(float) FAdd 59 58
Store 39(sum) 60
Branch 45
45: Label
61: 13(int) Load 41(i)
62: 13(int) IAdd 61 33
Store 41(i) 62
Branch 42
44: Label
Store 63(i) 16
Branch 64
64: Label
LoopMerge 66 67 None
Branch 68
68: Label
69: 13(int) Load 63(i)
70: 26(bool) SLessThan 69 48
BranchConditional 70 65 66
65: Label
72: 13(int) Load 63(i)
73: 13(int) Load 63(i)
74: 55(ptr) AccessChain 53(v4) 73
75: 50(int) Load 74
77: 50(int) IMul 75 76
78: 6(float) ConvertUToF 77
79: 38(ptr) AccessChain 71(tv4) 72
Store 79 78
Branch 67
67: Label
80: 13(int) Load 63(i)
81: 13(int) IAdd 80 33
Store 63(i) 81
Branch 64
66: Label
82: 6(float) Load 39(sum)
83: 7(fvec4) CompositeConstruct 82 82 82 82
84: 7(fvec4) Load 71(tv4)
85: 7(fvec4) FAdd 83 84
86: 7(fvec4) Load 36(gl_FragColor)
87: 7(fvec4) FAdd 86 85
Store 36(gl_FragColor) 87
90: 7(fvec4) Load 11(BaseColor)
91: 89(fvec3) VectorShuffle 90 90 0 1 2
93: 38(ptr) AccessChain 88(r) 92
94: 6(float) CompositeExtract 91 0
Store 93 94
96: 38(ptr) AccessChain 88(r) 95
97: 6(float) CompositeExtract 91 1
Store 96 97
99: 38(ptr) AccessChain 88(r) 98
100: 6(float) CompositeExtract 91 2
Store 99 100
Store 101(i) 16
Branch 102
102: Label
LoopMerge 104 105 None
Branch 106
106: Label
107: 13(int) Load 101(i)
108: 13(int) Load 24(Count)
109: 26(bool) SLessThan 107 108
BranchConditional 109 103 104
103: Label
112: 6(float) Load 111(f)
114: 38(ptr) AccessChain 88(r) 113
Store 114 112
Branch 105
105: Label
115: 13(int) Load 101(i)
116: 13(int) IAdd 115 33
Store 101(i) 116
Branch 102
104: Label
117: 7(fvec4) Load 88(r)
118: 89(fvec3) VectorShuffle 117 117 0 1 2
119: 7(fvec4) Load 36(gl_FragColor)
120: 89(fvec3) VectorShuffle 119 119 0 1 2
121: 89(fvec3) FAdd 120 118
123: 122(ptr) AccessChain 36(gl_FragColor) 92
124: 6(float) CompositeExtract 121 0
Store 123 124
125: 122(ptr) AccessChain 36(gl_FragColor) 95
126: 6(float) CompositeExtract 121 1
Store 125 126
127: 122(ptr) AccessChain 36(gl_FragColor) 98
128: 6(float) CompositeExtract 121 2
Store 127 128
Store 129(i) 16
Branch 130
130: Label
LoopMerge 132 133 None
Branch 134
134: Label
135: 13(int) Load 129(i)
137: 26(bool) SLessThan 135 136
BranchConditional 137 131 132
131: Label
138: 6(float) Load 111(f)
139: 7(fvec4) Load 36(gl_FragColor)
140: 7(fvec4) VectorTimesScalar 139 138
Store 36(gl_FragColor) 140
Branch 133
133: Label
141: 13(int) Load 129(i)
142: 13(int) IAdd 141 48
Store 129(i) 142
Branch 130
132: Label
Return
FunctionEnd