Add resource provider flag to avoid client-side buffers
On some platforms, a newly-created buffer was liable to be CPU backed.
This would break code that expected a VBO (aka instanced rendering).
This change adds an optional flag to GrResourceProvider that requires
a buffer to be created in GPU memory.
It also moves the CPU backing logic into Gr land in order to properly
cache real VBOs on platforms that prefer client-side buffers.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2143333002
Review-Url: https://codereview.chromium.org/2143333002
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index ea3a28a..c0922c0 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -100,7 +100,12 @@
* will occur out of order WRT the operations being flushed.
* Make this automatic: https://bug.skia.org/4156
*/
- kNoPendingIO_Flag = kNoPendingIO_ScratchTextureFlag,
+ kNoPendingIO_Flag = 0x1,
+
+ /** Normally the caps may indicate a preference for client-side buffers. Set this flag when
+ * creating a buffer to guarantee it resides in GPU memory.
+ */
+ kRequireGpuMemory_Flag = 0x2,
};
/**