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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1421853002: Add immediate mode option for gpu configs in dm (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add assert Created 5 years, 2 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/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 f42ee111ce351b1b6e26190581849dcca1cbd579..1dc26bc8c60fc49a4d3f66e24774d345b492211c 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -32,13 +32,15 @@
////////////////////////////////////////////////////////////////////////////////
-GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider)
+GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider,
+ const Options& options)
: fGpu(SkRef(gpu))
, fResourceProvider(resourceProvider)
, fFlushState(fGpu, fResourceProvider, 0)
, fFlushing(false)
, fFirstUnpreparedBatch(0)
- , fFlags(0) {
+ , fFlags(0)
+ , fOptions(options) {
// TODO: Stop extracting the context (currently needed by GrClipMaskManager)
fContext = fGpu->getContext();
fClipMaskManager.reset(new GrClipMaskManager(this));
@@ -472,6 +474,8 @@ 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
@@ -524,6 +528,9 @@ void GrDrawTarget::recordBatch(GrBatch* batch) {
SkASSERT(fBatches.count() - kMaxLookback - fFirstUnpreparedBatch == 1);
fBatches[fFirstUnpreparedBatch++]->prepare(&fFlushState);
}
+ 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