OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrOptDrawState.h" | 8 #include "GrOptDrawState.h" |
9 | 9 |
10 #include "GrDrawState.h" | 10 #include "GrDrawState.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 } | 160 } |
161 memcpy(dst, src, sizeof(GrVertexAttrib)); | 161 memcpy(dst, src, sizeof(GrVertexAttrib)); |
162 ++newIdx; | 162 ++newIdx; |
163 ++dst; | 163 ++dst; |
164 } | 164 } |
165 fVACount -= numToRemove; | 165 fVACount -= numToRemove; |
166 fVAPtr = fOptVA.get(); | 166 fVAPtr = fOptVA.get(); |
167 } | 167 } |
168 | 168 |
169 void GrOptDrawState::copyEffectiveColorStages(const GrDrawState& ds) { | 169 void GrOptDrawState::copyEffectiveColorStages(const GrDrawState& ds) { |
170 // If color write is disabled, then we don't want to copy any color stages a nd we should remove | |
171 // the fixed function color vertex attribute as well | |
172 if (this->isColorWriteDisabled()) { | |
bsalomon
2014/10/06 14:29:04
Greg is this the right place for this? Anywhere el
egdaniel
2014/10/07 13:46:13
It is already checked in the normal flow of creati
| |
173 fColorStages.reset(); | |
174 this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribBindi ng); | |
175 return; | |
176 } | |
177 | |
170 int firstColorStage = 0; | 178 int firstColorStage = 0; |
171 | 179 |
172 // Set up color and flags for ConstantColorComponent checks | 180 // Set up color and flags for ConstantColorComponent checks |
173 GrProcessor::InvariantOutput inout; | 181 GrProcessor::InvariantOutput inout; |
174 inout.fIsSingleComponent = false; | 182 inout.fIsSingleComponent = false; |
175 if (!this->hasColorVertexAttribute()) { | 183 if (!this->hasColorVertexAttribute()) { |
176 inout.fColor = ds.getColor(); | 184 inout.fColor = ds.getColor(); |
177 inout.fValidFlags = kRGBA_GrColorComponentFlags; | 185 inout.fValidFlags = kRGBA_GrColorComponentFlags; |
178 } else { | 186 } else { |
179 if (ds.vertexColorsAreOpaque()) { | 187 if (ds.vertexColorsAreOpaque()) { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 } | 339 } |
332 } | 340 } |
333 | 341 |
334 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, | 342 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, |
335 that.fFixedFunctionVertexAttribIndices, | 343 that.fFixedFunctionVertexAttribIndices, |
336 sizeof(this->fFixedFunctionVertexAttribIndices))); | 344 sizeof(this->fFixedFunctionVertexAttribIndices))); |
337 | 345 |
338 return true; | 346 return true; |
339 } | 347 } |
340 | 348 |
OLD | NEW |