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

Unified Diff: include/gpu/GrContext.h

Issue 2312123003: Revert of Restructure flushing relationship between GrContext, GrDrawingManager, and GrResourceCache (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrContext.h
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 996b77f2dbf0171ad9b25685d524ee82f2256143..f14c36e35cab1c2443084ea9cde86859a02f4dc9 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -214,10 +214,31 @@
// Misc.
/**
+ * Flags that affect flush() behavior.
+ */
+ enum FlushBits {
+ /**
+ * A client may reach a point where it has partially rendered a frame
+ * through a GrContext that it knows the user will never see. This flag
+ * causes the flush to skip submission of deferred content to the 3D API
+ * during the flush.
+ */
+ kDiscard_FlushBit = 0x2,
+ };
+
+ /**
* Call to ensure all drawing to the context has been issued to the
* underlying 3D API.
- */
- void flush();
+ * @param flagsBitfield flags that control the flushing behavior. See
+ * FlushBits.
+ */
+ void flush(int flagsBitfield = 0);
+
+ void flushIfNecessary() {
+ if (fFlushToReduceCacheSize || this->caps()->immediateFlush()) {
+ this->flush();
+ }
+ }
/**
* These flags can be used with the read/write pixels functions below.
@@ -388,6 +409,8 @@
GrBatchFontCache* fBatchFontCache;
SkAutoTDelete<GrTextBlobCache> fTextBlobCache;
+ // Set by OverbudgetCB() to request that GrContext flush before exiting a draw.
+ bool fFlushToReduceCacheSize;
bool fDidTestPMConversions;
int fPMToUPMConversion;
int fUPMToPMConversion;
@@ -449,6 +472,12 @@
bool didFailPMUPMConversionTest() const;
/**
+ * This callback allows the resource cache to callback into the GrContext
+ * when the cache is still over budget after a purge.
+ */
+ static void OverBudgetCB(void* data);
+
+ /**
* A callback similar to the above for use by the TextBlobCache
* TODO move textblob draw calls below context so we can use the call above.
*/
« no previous file with comments | « no previous file | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698