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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1406173003: Loosen requirement that there be only one GrDrawTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment 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/GrRenderTarget.cpp » ('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 cd86458c13464da10aaebed649bfb0d33e437ce1..323599dd7035ba9161edc028e847027420107bc8 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -37,7 +37,8 @@ GrDrawTarget::GrDrawTarget(GrGpu* gpu, GrResourceProvider* resourceProvider)
, fResourceProvider(resourceProvider)
, fFlushState(fGpu, fResourceProvider, 0)
, fFlushing(false)
- , fFirstUnpreparedBatch(0) {
+ , fFirstUnpreparedBatch(0)
+ , fClosed(false) {
// TODO: Stop extracting the context (currently needed by GrClipMaskManager)
fContext = fGpu->getContext();
fClipMaskManager.reset(new GrClipMaskManager(this));
@@ -118,6 +119,12 @@ void GrDrawTarget::flush() {
}
fFlushing = true;
+ // Semi-usually the drawTargets are already closed at this point, but sometimes Ganesh
+ // needs to flush mid-draw. In that case, the SkGpuDevice's drawTargets won't be closed
+ // but need to be flushed anyway. Closing such drawTargets here will mean new
+ // drawTargets will be created to replace them if the SkGpuDevice(s) write to them again.
+ this->makeClosed();
+
// Loop over all batches and generate geometry
for (; fFirstUnpreparedBatch < fBatches.count(); ++fFirstUnpreparedBatch) {
fBatches[fFirstUnpreparedBatch]->prepare(&fFlushState);
@@ -406,6 +413,9 @@ 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(!fClosed);
+
// Check if there is a Batch Draw we can batch with by linearly searching back until we either
// 1) check every draw
// 2) intersect with something
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrRenderTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698