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
This commit is contained in:
parent
a1c511b870
commit
96966a5a1f
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -21,6 +21,7 @@ typedef uint32_t GrGLSLVersion;
|
||||
*/
|
||||
enum GrGLVendor {
|
||||
kIntel_GrGLVendor,
|
||||
kARM_GrGLVendor,
|
||||
kOther_GrGLVendor,
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user