aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-21 16:34:21 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-21 16:34:21 +0000
commit96966a5a1ffc2f03eef1b5523308299aa4195f50 (patch)
tree31ff4279d562df89c5b8bf379b395299edc1ba05 /src
parenta1c511b8704c6c266b90860a4c68f30ca7514f9b (diff)
Use CPU arrays for dynamic indices/vertices on ARM GPUs.
Review URL: https://codereview.appspot.com/7365047 git-svn-id: http://skia.googlecode.com/svn/trunk@7810 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-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
5 files changed, 19 insertions, 2 deletions
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;