aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/gpu/gl/GrGLConfig.h8
-rw-r--r--include/gpu/gl/GrGLConfig_chrome.h3
-rw-r--r--src/gpu/gl/GrGLCaps.cpp7
-rw-r--r--src/gpu/gl/GrGLCaps.h6
-rw-r--r--src/gpu/gl/GrGLUtil.cpp3
-rw-r--r--src/gpu/gl/GrGLUtil.h1
-rw-r--r--src/gpu/gl/GrGpuGL.cpp4
7 files changed, 30 insertions, 2 deletions
diff --git a/include/gpu/gl/GrGLConfig.h b/include/gpu/gl/GrGLConfig.h
index 20d9031264..ea2403728b 100644
--- a/include/gpu/gl/GrGLConfig.h
+++ b/include/gpu/gl/GrGLConfig.h
@@ -96,6 +96,10 @@
* GR_GL_USE_NV_PATH_RENDERING: Enable experimental support for
* GL_NV_path_rendering. There are known issues with clipping, non-AA paths, and
* perspective.
+ *
+ * GR_GL_MUST_USE_VBO: Indicates that all vertices and indices must be rendered
+ * from VBOs. Chromium's command buffer doesn't allow glVertexAttribArray with
+ * ARARY_BUFFER 0 bound or glDrawElements with ELEMENT_ARRAY_BUFFER 0 bound.
*/
#if !defined(GR_GL_LOG_CALLS)
@@ -146,6 +150,10 @@
#define GR_GL_USE_NV_PATH_RENDERING 0
#endif
+#if !defined(GR_GL_MUST_USE_VBO)
+ #define GR_GL_MUST_USE_VBO 0
+#endif
+
/**
* There is a strange bug that occurs on Macs with NVIDIA GPUs. We don't
* fully understand it. When (element) array buffers are continually
diff --git a/include/gpu/gl/GrGLConfig_chrome.h b/include/gpu/gl/GrGLConfig_chrome.h
index 50ea34c6d3..3a74abadb0 100644
--- a/include/gpu/gl/GrGLConfig_chrome.h
+++ b/include/gpu/gl/GrGLConfig_chrome.h
@@ -34,4 +34,7 @@
// CheckFramebufferStatus in chrome synchronizes the gpu and renderer processes.
#define GR_GL_CHECK_FBO_STATUS_ONCE_PER_FORMAT 1
+// Non-VBO vertices and indices are not allowed in Chromium.
+#define GR_GL_MUST_USE_VBO 1
+
#endif
diff --git a/src/gpu/gl/GrGLCaps.cpp b/src/gpu/gl/GrGLCaps.cpp
index b140a100da..bd18e56b4b 100644
--- a/src/gpu/gl/GrGLCaps.cpp
+++ b/src/gpu/gl/GrGLCaps.cpp
@@ -37,6 +37,7 @@ void GrGLCaps::reset() {
fImagingSupport = false;
fTwoFormatLimit = false;
fFragCoordsConventionSupport = false;
+ fUseNonVBOVertexAndIndexDynamicData = false;
}
GrGLCaps::GrGLCaps(const GrGLCaps& caps) {
@@ -67,6 +68,7 @@ GrGLCaps& GrGLCaps::operator = (const GrGLCaps& caps) {
fImagingSupport = caps.fImagingSupport;
fTwoFormatLimit = caps.fTwoFormatLimit;
fFragCoordsConventionSupport = caps.fFragCoordsConventionSupport;
+ fUseNonVBOVertexAndIndexDynamicData = caps.fUseNonVBOVertexAndIndexDynamicData;
return *this;
}
@@ -167,6 +169,11 @@ void GrGLCaps::init(const GrGLContextInfo& ctxInfo) {
ctxInfo.hasExtension("GL_ARB_fragment_coord_conventions");
}
+ // Perhaps we should look at the renderer string and limit to Mali GPUs.
+ if (kARM_GrGLVendor == ctxInfo.vendor() && !GR_GL_MUST_USE_VBO) {
+ fUseNonVBOVertexAndIndexDynamicData = true;
+ }
+
this->initFSAASupport(ctxInfo);
this->initStencilFormats(ctxInfo);
}
diff --git a/src/gpu/gl/GrGLCaps.h b/src/gpu/gl/GrGLCaps.h
index 9dfbf23cb4..4143868ed8 100644
--- a/src/gpu/gl/GrGLCaps.h
+++ b/src/gpu/gl/GrGLCaps.h
@@ -219,6 +219,11 @@ public:
/// Is GL_ARB_fragment_coord_conventions supported?
bool fragCoordConventionsSupport() const { return fFragCoordsConventionSupport; }
+ // Use indices or vertices in CPU arrays rather than VBOs for dynamic content.
+ bool useNonVBOVertexAndIndexDynamicData() const {
+ return fUseNonVBOVertexAndIndexDynamicData;
+ }
+
// Does ReadPixels support the provided format/type combo?
bool readPixelsSupported(const GrGLInterface* intf,
GrGLenum format,
@@ -297,6 +302,7 @@ private:
bool fImagingSupport : 1;
bool fTwoFormatLimit : 1;
bool fFragCoordsConventionSupport : 1;
+ bool fUseNonVBOVertexAndIndexDynamicData : 1;
};
#endif
diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp
index 3f110cc49f..225650c106 100644
--- a/src/gpu/gl/GrGLUtil.cpp
+++ b/src/gpu/gl/GrGLUtil.cpp
@@ -171,6 +171,9 @@ GrGLVendor GrGLGetVendorFromString(const char* vendorString) {
if (0 == strcmp(vendorString, "Intel")) {
return kIntel_GrGLVendor;
}
+ if (0 == strcmp(vendorString, "ARM")) {
+ return kARM_GrGLVendor;
+ }
}
return kOther_GrGLVendor;
diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h
index 997207a1c7..da0c7c32a3 100644
--- a/src/gpu/gl/GrGLUtil.h
+++ b/src/gpu/gl/GrGLUtil.h
@@ -21,6 +21,7 @@ typedef uint32_t GrGLSLVersion;
*/
enum GrGLVendor {
kIntel_GrGLVendor,
+ kARM_GrGLVendor,
kOther_GrGLVendor,
};
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index 235811c3fb..b75ab322c1 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -1231,7 +1231,7 @@ GrVertexBuffer* GrGpuGL::onCreateVertexBuffer(uint32_t size, bool dynamic) {
desc.fSizeInBytes = size;
desc.fIsWrapped = false;
- if (false && desc.fDynamic) {
+ if (this->glCaps().useNonVBOVertexAndIndexDynamicData() && desc.fDynamic) {
desc.fID = 0;
GrGLVertexBuffer* vertexBuffer = SkNEW_ARGS(GrGLVertexBuffer, (this, desc));
return vertexBuffer;
@@ -1266,7 +1266,7 @@ GrIndexBuffer* GrGpuGL::onCreateIndexBuffer(uint32_t size, bool dynamic) {
desc.fSizeInBytes = size;
desc.fIsWrapped = false;
- if (false && desc.fDynamic) {
+ if (this->glCaps().useNonVBOVertexAndIndexDynamicData() && desc.fDynamic) {
desc.fID = 0;
GrIndexBuffer* indexBuffer = SkNEW_ARGS(GrGLIndexBuffer, (this, desc));
return indexBuffer;