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. |
*/ |