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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1437843002: Move GrBatchFlushState from GrDrawTarget to GrDrawingManager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: readd white space Created 5 years, 1 month 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/GrDrawTarget.h ('k') | src/gpu/GrDrawingManager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 3aa7a540f8e89cc6dba35bc716d5403fdd10775b..8f9afbdb38e7d42e02a0c80ac4357bc094f7b765 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -32,14 +32,11 @@
////////////////////////////////////////////////////////////////////////////////
-GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* resourceProvider,
- const Options& options)
+GrDrawTarget::GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider* resourceProvider)
: fGpu(SkRef(gpu))
, fResourceProvider(resourceProvider)
- , fFlushState(fGpu, fResourceProvider)
, fFlushing(false)
, fFlags(0)
- , fOptions(options)
, fRenderTarget(rt) {
// TODO: Stop extracting the context (currently needed by GrClipMaskManager)
fContext = fGpu->getContext();
@@ -176,7 +173,7 @@ bool GrDrawTarget::setupDstReadIfNecessary(const GrPipelineBuilder& pipelineBuil
return true;
}
-void GrDrawTarget::flush() {
+void GrDrawTarget::prepareBatches(GrBatchFlushState* flushState) {
if (fFlushing) {
return;
}
@@ -190,26 +187,21 @@ void GrDrawTarget::flush() {
// Loop over the batches that haven't yet generated their geometry
for (int i = 0; i < fBatches.count(); ++i) {
- fBatches[i]->prepare(&fFlushState);
+ fBatches[i]->prepare(flushState);
}
+}
- // Upload all data to the GPU
- fFlushState.preIssueDraws();
-
+void GrDrawTarget::drawBatches(GrBatchFlushState* flushState) {
// Draw all the generated geometry.
for (int i = 0; i < fBatches.count(); ++i) {
- fBatches[i]->draw(&fFlushState);
+ fBatches[i]->draw(flushState);
}
- SkASSERT(fFlushState.lastFlushedToken() == fFlushState.currentToken());
- this->reset();
-
fFlushing = false;
}
void GrDrawTarget::reset() {
fBatches.reset();
- fFlushState.reset();
}
void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBatch* batch) {
@@ -470,8 +462,6 @@ template <class Left, class Right> static bool intersect(const Left& a, const Ri
void GrDrawTarget::recordBatch(GrBatch* batch) {
// A closed drawTarget should never receive new/more batches
SkASSERT(!this->isClosed());
- // Should never have batches queued up when in immediate mode.
- SkASSERT(!fOptions.fImmediateMode || !fBatches.count());
// Check if there is a Batch Draw we can batch with by linearly searching back until we either
// 1) check every draw
@@ -520,9 +510,6 @@ void GrDrawTarget::recordBatch(GrBatch* batch) {
GrBATCH_INFO("\t\tFirstBatch\n");
}
fBatches.push_back().reset(SkRef(batch));
- if (fOptions.fImmediateMode) {
- this->flush();
- }
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrDrawingManager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698