Revert of Incrementally flush GrDrawTarget (patchset #8 id:130001 of https://codereview.chromium.org/1386463004/ )

Reason for revert:
breaking bots

Original issue's description:
> Incrementally flush GrDrawTarget
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/a7e878064509ef96b54d5507dab0b50def66dc13

TBR=robertphillips@google.com,bsalomon@google.com,joshualitt@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/1386683002
This commit is contained in:
joshualitt 2015-10-02 10:16:03 -07:00 committed by Commit bot
parent 44dcb8a84b
commit 0737f61f23
2 changed files with 10 additions and 16 deletions

View File

@ -35,9 +35,8 @@
GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider)
: fGpu(SkRef(gpu))
, fResourceProvider(resourceProvider)
, fFlushState(fGpu, fResourceProvider, 0)
, fFlushing(false)
, fFirstUnpreparedBatch(0) {
, fLastFlushToken(0) {
// TODO: Stop extracting the context (currently needed by GrClipMaskManager)
fContext = fGpu->getContext();
fClipMaskManager.reset(new GrClipMaskManager(this));
@ -118,26 +117,28 @@ void GrDrawTarget::flush() {
}
fFlushing = true;
GrBatchFlushState flushState(fGpu, fResourceProvider, fLastFlushToken);
// Loop over all batches and generate geometry
for (; fFirstUnpreparedBatch < fBatches.count(); ++fFirstUnpreparedBatch) {
fBatches[fFirstUnpreparedBatch]->prepare(&fFlushState);
for (int i = 0; i < fBatches.count(); ++i) {
fBatches[i]->prepare(&flushState);
}
// Upload all data to the GPU
fFlushState.preIssueDraws();
flushState.preIssueDraws();
// Draw all the generated geometry.
for (int i = 0; i < fBatches.count(); ++i) {
fBatches[i]->draw(&fFlushState);
fBatches[i]->draw(&flushState);
}
this->reset();
fLastFlushToken = flushState.lastFlushedToken();
fFlushing = false;
this->reset();
}
void GrDrawTarget::reset() {
fFirstUnpreparedBatch = 0;
fBatches.reset();
}
@ -433,10 +434,6 @@ void GrDrawTarget::recordBatch(GrBatch* batch) {
GrBATCH_INFO("\t\tFirstBatch\n");
}
fBatches.push_back().reset(SkRef(batch));
if (fBatches.count() > kMaxLookback) {
SkASSERT(fBatches.count() - kMaxLookback - fFirstUnpreparedBatch == 1);
fBatches[fFirstUnpreparedBatch++]->prepare(&fFlushState);
}
}
///////////////////////////////////////////////////////////////////////////////

View File

@ -8,7 +8,6 @@
#ifndef GrDrawTarget_DEFINED
#define GrDrawTarget_DEFINED
#include "GrBatchFlushState.h"
#include "GrClip.h"
#include "GrClipMaskManager.h"
#include "GrContext.h"
@ -34,7 +33,6 @@
#include "SkXfermode.h"
class GrBatch;
class GrBatchFlushState;
class GrClip;
class GrCaps;
class GrPath;
@ -230,9 +228,8 @@ private:
GrContext* fContext;
GrGpu* fGpu;
GrResourceProvider* fResourceProvider;
GrBatchFlushState fFlushState;
bool fFlushing;
int fFirstUnpreparedBatch;
GrBatchToken fLastFlushToken;
typedef SkRefCnt INHERITED;
};