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/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index 4313906..6a34a30 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -41,7 +41,6 @@
fMultiDrawIndirectSupport = false;
fBaseInstanceSupport = false;
fCanDrawIndirectToFloat = false;
- fUseNonVBOVertexAndIndexDynamicData = false;
fIsCoreProfile = false;
fBindFragDataLocationSupport = false;
fRectangleTextureSupport = false;
@@ -132,18 +131,6 @@
fImagingSupport = kGL_GrGLStandard == standard &&
ctxInfo.hasExtension("GL_ARB_imaging");
- // SGX and Mali GPUs that are based on a tiled-deferred architecture that have trouble with
- // frequently changing VBOs. We've measured a performance increase using non-VBO vertex
- // data for dynamic content on these GPUs. Perhaps we should read the renderer string and
- // limit this decision to specific GPU families rather than basing it on the vendor alone.
- if (!GR_GL_MUST_USE_VBO &&
- !fIsCoreProfile &&
- (kARM_GrGLVendor == ctxInfo.vendor() ||
- kImagination_GrGLVendor == ctxInfo.vendor() ||
- kQualcomm_GrGLVendor == ctxInfo.vendor())) {
- fUseNonVBOVertexAndIndexDynamicData = true;
- }
-
// A driver but on the nexus 6 causes incorrect dst copies when invalidate is called beforehand.
// Thus we are blacklisting this extension for now on Adreno4xx devices.
if (kAdreno4xx_GrGLRenderer != ctxInfo.renderer() &&
@@ -344,6 +331,18 @@
}
}
+ // SGX and Mali GPUs that are based on a tiled-deferred architecture that have trouble with
+ // frequently changing VBOs. We've measured a performance increase using non-VBO vertex
+ // data for dynamic content on these GPUs. Perhaps we should read the renderer string and
+ // limit this decision to specific GPU families rather than basing it on the vendor alone.
+ if (!GR_GL_MUST_USE_VBO &&
+ !fIsCoreProfile &&
+ (kARM_GrGLVendor == ctxInfo.vendor() ||
+ kImagination_GrGLVendor == ctxInfo.vendor() ||
+ kQualcomm_GrGLVendor == ctxInfo.vendor())) {
+ fPreferClientSideDynamicBuffers = true;
+ }
+
// fUsesMixedSamples must be set before calling initFSAASupport.
this->initFSAASupport(ctxInfo, gli);
this->initBlendEqationSupport(ctxInfo);
@@ -1122,8 +1121,6 @@
r.appendf("Multi draw indirect support: %s\n", (fMultiDrawIndirectSupport ? "YES" : "NO"));
r.appendf("Base instance support: %s\n", (fBaseInstanceSupport ? "YES" : "NO"));
r.appendf("Can draw indirect to float: %s\n", (fCanDrawIndirectToFloat ? "YES" : "NO"));
- r.appendf("Use non-VBO for dynamic data: %s\n",
- (fUseNonVBOVertexAndIndexDynamicData ? "YES" : "NO"));
r.appendf("RGBA 8888 pixel ops are slow: %s\n", (fRGBA8888PixelsOpsAreSlow ? "YES" : "NO"));
r.appendf("Partial FBO read is slow: %s\n", (fPartialFBOReadIsSlow ? "YES" : "NO"));
r.appendf("Bind uniform location support: %s\n", (fBindUniformLocationSupport ? "YES" : "NO"));