diff options
author | 2017-10-06 16:27:32 -0600 | |
---|---|---|
committer | 2017-10-06 22:48:59 +0000 | |
commit | cc604e5e9e33030a3033d2c6cc22e7759ab4d42e (patch) | |
tree | a6df3bced36be543445e95d5516b395356d563ea /src/gpu/gl/GrGLGpu.cpp | |
parent | 4a6a732352fcb1445802dc95a477a943a31a9ac4 (diff) |
CCPR: Add workaround for PowerVR crash
Bug: skia:
Change-Id: Icd00f81fda5366813f9c959fdc91b0415894cbfc
Reviewed-on: https://skia-review.googlesource.com/55360
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src/gpu/gl/GrGLGpu.cpp')
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 8190206d8f..10dabe4629 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -2619,10 +2619,14 @@ void GrGLGpu::sendInstancedMeshToGpu(const GrPrimitiveProcessor& primProc, GrPri int vertexCount, int baseVertex, const GrBuffer* instanceBuffer, int instanceCount, int baseInstance) { - const GrGLenum glPrimType = gr_primitive_type_to_gl_mode(primitiveType); - this->setupGeometry(primProc, nullptr, vertexBuffer, 0, instanceBuffer, baseInstance); - GL_CALL(DrawArraysInstanced(glPrimType, baseVertex, vertexCount, instanceCount)); - fStats.incNumDraws(); + GrGLenum glPrimType = gr_primitive_type_to_gl_mode(primitiveType); + int maxInstances = this->glCaps().maxInstancesPerDrawArraysWithoutCrashing(instanceCount); + for (int i = 0; i < instanceCount; i += maxInstances) { + this->setupGeometry(primProc, nullptr, vertexBuffer, 0, instanceBuffer, baseInstance + i); + GL_CALL(DrawArraysInstanced(glPrimType, baseVertex, vertexCount, + SkTMin(instanceCount - i, maxInstances))); + fStats.incNumDraws(); + } } void GrGLGpu::sendIndexedInstancedMeshToGpu(const GrPrimitiveProcessor& primProc, |