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

Unified Diff: src/gpu/GrDrawState.h

Issue 439273007: Don't compare constant color and coverage between GrDrawStates when they are provided by vertex att… (Closed) Base URL: https://skia.googlesource.com/skia.git@compat
Patch Set: Remove AutoColorRestore Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawState.h
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index a4db89d643d95acb4d77cc02eecf06c0dfda93d9..90bdc64507dc544356d9cb2d8860f1fe8142a953 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -267,38 +267,6 @@ public:
this->setColor((a << 24) | (a << 16) | (a << 8) | a);
}
- /**
- * Constructor sets the color to be 'color' which is undone by the destructor.
- */
- class AutoColorRestore : public ::SkNoncopyable {
- public:
- AutoColorRestore() : fDrawState(NULL), fOldColor(0) {}
-
- AutoColorRestore(GrDrawState* drawState, GrColor color) {
- fDrawState = NULL;
- this->set(drawState, color);
- }
-
- void reset() {
- if (NULL != fDrawState) {
- fDrawState->setColor(fOldColor);
- fDrawState = NULL;
- }
- }
-
- void set(GrDrawState* drawState, GrColor color) {
- this->reset();
- fDrawState = drawState;
- fOldColor = fDrawState->getColor();
- fDrawState->setColor(color);
- }
-
- ~AutoColorRestore() { this->reset(); }
- private:
- GrDrawState* fDrawState;
- GrColor fOldColor;
- };
-
/// @}
///////////////////////////////////////////////////////////////////////////
@@ -893,10 +861,14 @@ public:
if draws can be batched. The return value indicates whether combining is possible and, if
so, which of the two inputs should be used. */
static CombinedState CombineIfPossible(const GrDrawState& a, const GrDrawState& b) {
+ bool usingVertexColors = a.hasColorVertexAttribute();
+ if (!usingVertexColors && a.fColor != b.fColor) {
+ return kIncompatible_CombinedState;
+ }
+
if (a.fRenderTarget.get() != b.fRenderTarget.get() ||
a.fColorStages.count() != b.fColorStages.count() ||
a.fCoverageStages.count() != b.fCoverageStages.count() ||
- a.fColor != b.fColor ||
!a.fViewMatrix.cheapEqualTo(b.fViewMatrix) ||
a.fSrcBlend != b.fSrcBlend ||
a.fDstBlend != b.fDstBlend ||
@@ -905,11 +877,15 @@ public:
a.fVACount != b.fVACount ||
memcmp(a.fVAPtr, b.fVAPtr, a.fVACount * sizeof(GrVertexAttrib)) ||
a.fStencilSettings != b.fStencilSettings ||
- a.fCoverage != b.fCoverage ||
a.fDrawFace != b.fDrawFace) {
return kIncompatible_CombinedState;
}
+ bool usingVertexCoverage = a.hasCoverageVertexAttribute();
+ if (!usingVertexCoverage && a.fCoverage != b.fCoverage) {
+ return kIncompatible_CombinedState;
+ }
+
bool explicitLocalCoords = a.hasLocalCoordAttribute();
for (int i = 0; i < a.fColorStages.count(); i++) {
if (!GrEffectStage::AreCompatible(a.fColorStages[i], b.fColorStages[i],
« no previous file with comments | « src/gpu/GrDistanceFieldTextContext.cpp ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698