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

Unified Diff: src/gpu/GrInOrderDrawBuffer.cpp

Issue 368913003: Remove deferred version of GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@citer
Patch Set: Created 6 years, 6 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/GrInOrderDrawBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrInOrderDrawBuffer.cpp
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 1cd7f539de3076d9d29599316f9fd75d9b80975b..cdb1d892ce9907bd2dde97540ebb3e858c63ac5a 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -577,10 +577,7 @@ void GrInOrderDrawBuffer::flush() {
GrDrawTarget::AutoClipRestore acr(fDstGpu);
AutoGeometryAndStatePush agasp(fDstGpu, kPreserve_ASRInit);
- GrDrawState playbackState;
- GrDrawState* prevDrawState = fDstGpu->drawState();
- prevDrawState->ref();
- fDstGpu->setDrawState(&playbackState);
+ GrDrawState* prevDrawState = SkRef(fDstGpu->drawState());
GrClipData clipData;
@@ -606,6 +603,7 @@ void GrInOrderDrawBuffer::flush() {
}
switch (strip_trace_bit(fCmds[c])) {
case kDraw_Cmd: {
+ SkASSERT(fDstGpu->drawState() != prevDrawState);
SkAssertResult(drawIter.next());
fDstGpu->setVertexSourceToBuffer(drawIter->fVertexBuffer);
if (drawIter->isIndexed()) {
@@ -615,11 +613,13 @@ void GrInOrderDrawBuffer::flush() {
break;
}
case kStencilPath_Cmd: {
+ SkASSERT(fDstGpu->drawState() != prevDrawState);
SkAssertResult(stencilPathIter.next());
fDstGpu->stencilPath(stencilPathIter->fPath.get(), stencilPathIter->fFill);
break;
}
case kDrawPath_Cmd: {
+ SkASSERT(fDstGpu->drawState() != prevDrawState);
SkAssertResult(drawPathIter.next());
fDstGpu->executeDrawPath(drawPathIter->fPath.get(), drawPathIter->fFill,
NULL != drawPathIter->fDstCopy.texture() ?
@@ -628,6 +628,7 @@ void GrInOrderDrawBuffer::flush() {
break;
}
case kDrawPaths_Cmd: {
+ SkASSERT(fDstGpu->drawState() != prevDrawState);
SkAssertResult(drawPathsIter.next());
const GrDeviceCoordTexture* dstCopy =
NULL !=drawPathsIter->fDstCopy.texture() ? &drawPathsIter->fDstCopy : NULL;
@@ -638,7 +639,7 @@ void GrInOrderDrawBuffer::flush() {
}
case kSetState_Cmd:
SkAssertResult(stateIter.next());
- stateIter->restoreTo(&playbackState);
+ fDstGpu->setDrawState(stateIter.get());
break;
case kSetClip_Cmd:
SkAssertResult(clipIter.next());
@@ -920,7 +921,7 @@ void GrInOrderDrawBuffer::geometrySourceWillPop(
}
bool GrInOrderDrawBuffer::needsNewState() const {
- return fStates.empty() || !fStates.back().isEqual(this->getDrawState());
+ return fStates.empty() || fStates.back() != this->getDrawState();
}
bool GrInOrderDrawBuffer::needsNewClip() const {
@@ -954,7 +955,7 @@ void GrInOrderDrawBuffer::recordClip() {
}
void GrInOrderDrawBuffer::recordState() {
- fStates.push_back().saveFrom(this->getDrawState());
+ fStates.push_back() = this->getDrawState();
this->addToCmdBuffer(kSetState_Cmd);
}
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698