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.
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
spv.forLoop.frag
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 8000a
|
||||
// Id's are bound by 131
|
||||
// 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 104
|
||||
EntryPoint Fragment 4 "main" 11 24 28 36 53 111
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 140
|
||||
Name 4 "main"
|
||||
@@ -22,9 +22,9 @@ spv.forLoop.frag
|
||||
Name 63 "i"
|
||||
Name 71 "tv4"
|
||||
Name 88 "r"
|
||||
Name 94 "i"
|
||||
Name 104 "f"
|
||||
Name 117 "i"
|
||||
Name 101 "i"
|
||||
Name 111 "f"
|
||||
Name 129 "i"
|
||||
Decorate 11(BaseColor) Location 1
|
||||
Decorate 24(Count) Flat
|
||||
Decorate 24(Count) Location 3
|
||||
@@ -32,7 +32,7 @@ spv.forLoop.frag
|
||||
Decorate 36(gl_FragColor) Location 0
|
||||
Decorate 53(v4) Flat
|
||||
Decorate 53(v4) Location 4
|
||||
Decorate 104(f) Location 2
|
||||
Decorate 111(f) Location 2
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
@@ -60,10 +60,14 @@ spv.forLoop.frag
|
||||
55: TypePointer Input 50(int)
|
||||
76: 50(int) Constant 4
|
||||
89: TypeVector 6(float) 3
|
||||
103: TypePointer Input 6(float)
|
||||
104(f): 103(ptr) Variable Input
|
||||
106: 50(int) Constant 3
|
||||
124: 13(int) Constant 16
|
||||
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
|
||||
@@ -73,8 +77,8 @@ spv.forLoop.frag
|
||||
63(i): 14(ptr) Variable Function
|
||||
71(tv4): 8(ptr) Variable Function
|
||||
88(r): 8(ptr) Variable Function
|
||||
94(i): 14(ptr) Variable Function
|
||||
117(i): 14(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
|
||||
@@ -160,58 +164,70 @@ spv.forLoop.frag
|
||||
Store 36(gl_FragColor) 87
|
||||
90: 7(fvec4) Load 11(BaseColor)
|
||||
91: 89(fvec3) VectorShuffle 90 90 0 1 2
|
||||
92: 7(fvec4) Load 88(r)
|
||||
93: 7(fvec4) VectorShuffle 92 91 4 5 6 3
|
||||
Store 88(r) 93
|
||||
Store 94(i) 16
|
||||
Branch 95
|
||||
95: Label
|
||||
LoopMerge 97 98 None
|
||||
Branch 99
|
||||
99: Label
|
||||
100: 13(int) Load 94(i)
|
||||
101: 13(int) Load 24(Count)
|
||||
102: 26(bool) SLessThan 100 101
|
||||
BranchConditional 102 96 97
|
||||
96: Label
|
||||
105: 6(float) Load 104(f)
|
||||
107: 38(ptr) AccessChain 88(r) 106
|
||||
Store 107 105
|
||||
Branch 98
|
||||
98: Label
|
||||
108: 13(int) Load 94(i)
|
||||
109: 13(int) IAdd 108 33
|
||||
Store 94(i) 109
|
||||
Branch 95
|
||||
97: Label
|
||||
110: 7(fvec4) Load 88(r)
|
||||
111: 89(fvec3) VectorShuffle 110 110 0 1 2
|
||||
112: 7(fvec4) Load 36(gl_FragColor)
|
||||
113: 89(fvec3) VectorShuffle 112 112 0 1 2
|
||||
114: 89(fvec3) FAdd 113 111
|
||||
115: 7(fvec4) Load 36(gl_FragColor)
|
||||
116: 7(fvec4) VectorShuffle 115 114 4 5 6 3
|
||||
Store 36(gl_FragColor) 116
|
||||
Store 117(i) 16
|
||||
Branch 118
|
||||
118: Label
|
||||
LoopMerge 120 121 None
|
||||
Branch 122
|
||||
122: Label
|
||||
123: 13(int) Load 117(i)
|
||||
125: 26(bool) SLessThan 123 124
|
||||
BranchConditional 125 119 120
|
||||
119: Label
|
||||
126: 6(float) Load 104(f)
|
||||
127: 7(fvec4) Load 36(gl_FragColor)
|
||||
128: 7(fvec4) VectorTimesScalar 127 126
|
||||
Store 36(gl_FragColor) 128
|
||||
Branch 121
|
||||
121: Label
|
||||
129: 13(int) Load 117(i)
|
||||
130: 13(int) IAdd 129 48
|
||||
Store 117(i) 130
|
||||
Branch 118
|
||||
120: Label
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user