Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/gpu/GrRODrawState.cpp

Issue 511593004: Make setVertexAttribs in GrDrawState take a stride parameter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "GrRODrawState.h" 8 #include "GrRODrawState.h"
9 #include "GrDrawTargetCaps.h" 9 #include "GrDrawTargetCaps.h"
10 10
11 //////////////////////////////////////////////////////////////////////////////// 11 ////////////////////////////////////////////////////////////////////////////////
12 12
13 bool GrRODrawState::isEqual(const GrRODrawState& that) const { 13 bool GrRODrawState::isEqual(const GrRODrawState& that) const {
14 bool usingVertexColors = this->hasColorVertexAttribute(); 14 bool usingVertexColors = this->hasColorVertexAttribute();
15 if (!usingVertexColors && this->fColor != that.fColor) { 15 if (!usingVertexColors && this->fColor != that.fColor) {
16 return false; 16 return false;
17 } 17 }
18 18
19 if (this->fRenderTarget.get() != that.fRenderTarget.get() || 19 if (this->fRenderTarget.get() != that.fRenderTarget.get() ||
20 this->fColorStages.count() != that.fColorStages.count() || 20 this->fColorStages.count() != that.fColorStages.count() ||
21 this->fCoverageStages.count() != that.fCoverageStages.count() || 21 this->fCoverageStages.count() != that.fCoverageStages.count() ||
22 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) || 22 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) ||
23 this->fSrcBlend != that.fSrcBlend || 23 this->fSrcBlend != that.fSrcBlend ||
24 this->fDstBlend != that.fDstBlend || 24 this->fDstBlend != that.fDstBlend ||
25 this->fBlendConstant != that.fBlendConstant || 25 this->fBlendConstant != that.fBlendConstant ||
26 this->fFlagBits != that.fFlagBits || 26 this->fFlagBits != that.fFlagBits ||
27 this->fVACount != that.fVACount || 27 this->fVACount != that.fVACount ||
28 this->fVAStride != that.fVAStride ||
28 memcmp(this->fVAPtr, that.fVAPtr, this->fVACount * sizeof(GrVertexAttrib )) || 29 memcmp(this->fVAPtr, that.fVAPtr, this->fVACount * sizeof(GrVertexAttrib )) ||
29 this->fStencilSettings != that.fStencilSettings || 30 this->fStencilSettings != that.fStencilSettings ||
30 this->fDrawFace != that.fDrawFace) { 31 this->fDrawFace != that.fDrawFace) {
31 return false; 32 return false;
32 } 33 }
33 34
34 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); 35 bool usingVertexCoverage = this->hasCoverageVertexAttribute();
35 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { 36 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) {
36 return false; 37 return false;
37 } 38 }
38 39
39 bool explicitLocalCoords = this->hasLocalCoordAttribute(); 40 bool explicitLocalCoords = this->hasLocalCoordAttribute();
40 for (int i = 0; i < this->numColorStages(); i++) { 41 for (int i = 0; i < this->numColorStages(); i++) {
41 if (!GrEffectStage::AreCompatible(this->getColorStage(i), that.getColorS tage(i), 42 if (!GrEffectStage::AreCompatible(this->getColorStage(i), that.getColorS tage(i),
42 explicitLocalCoords)) { 43 explicitLocalCoords)) {
43 return false; 44 return false;
44 } 45 }
45 } 46 }
46 for (int i = 0; i < this->numCoverageStages(); i++) { 47 for (int i = 0; i < this->numCoverageStages(); i++) {
47 if (!GrEffectStage::AreCompatible(this->getCoverageStage(i), that.getCov erageStage(i), 48 if (!GrEffectStage::AreCompatible(this->getCoverageStage(i), that.getCov erageStage(i),
48 explicitLocalCoords)) { 49 explicitLocalCoords)) {
49 return false; 50 return false;
50 } 51 }
51 } 52 }
52 53
53 SkASSERT(this->fVertexSize == that.fVertexSize);
54 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices, 54 SkASSERT(0 == memcmp(this->fFixedFunctionVertexAttribIndices,
55 that.fFixedFunctionVertexAttribIndices, 55 that.fFixedFunctionVertexAttribIndices,
56 sizeof(this->fFixedFunctionVertexAttribIndices))); 56 sizeof(this->fFixedFunctionVertexAttribIndices)));
57 57
58 return true; 58 return true;
59 } 59 }
60 60
61 //////////////////////////////////////////////////////////////////////////////// 61 ////////////////////////////////////////////////////////////////////////////////
62 62
63 bool GrRODrawState::validateVertexAttribs() const { 63 bool GrRODrawState::validateVertexAttribs() const {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 find that only 1, ISA, and ISC produce the correct destination when applied to S' and D. 158 find that only 1, ISA, and ISC produce the correct destination when applied to S' and D.
159 Also, if we're directly rendering coverage (isCoverageDrawing) then coverag e is treated as 159 Also, if we're directly rendering coverage (isCoverageDrawing) then coverag e is treated as
160 color by definition. 160 color by definition.
161 */ 161 */
162 return kOne_GrBlendCoeff == fDstBlend || 162 return kOne_GrBlendCoeff == fDstBlend ||
163 kISA_GrBlendCoeff == fDstBlend || 163 kISA_GrBlendCoeff == fDstBlend ||
164 kISC_GrBlendCoeff == fDstBlend || 164 kISC_GrBlendCoeff == fDstBlend ||
165 this->isCoverageDrawing(); 165 this->isCoverageDrawing();
166 } 166 }
167 167
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698