Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1001693003: Add terrible workaround to fix stencil clear crash on S3. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index b7901400fbd68c132c4b448e20874b9bb64ba291..51fc42b9954e154f447ddf2bb14c2608112f1b60 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -1210,8 +1210,27 @@ bool GrGLGpu::createStencilBufferForRenderTarget(GrRenderTarget* rt, int width,
}
GL_CALL(ClearStencil(0));
+ // At least some versions of the SGX 54x driver can't handle clearing a stencil
+ // buffer without a color buffer and will crash.
+ GrGLuint tempRB = 0;
+ if (kPowerVR54x_GrGLRenderer == this->ctxInfo().renderer()) {
+ GL_CALL(GenRenderbuffers(1, &tempRB));
+ GL_CALL(BindRenderbuffer(GR_GL_RENDERBUFFER, tempRB));
+ GL_CALL(RenderbufferStorage(GR_GL_RENDERBUFFER, GR_GL_RGBA8, width, height));
+ GL_CALL(FramebufferRenderbuffer(fboTarget,
+ GR_GL_COLOR_ATTACHMENT0,
+ GR_GL_RENDERBUFFER, tempRB));
+ }
+
GL_CALL(Clear(GR_GL_STENCIL_BUFFER_BIT));
+ if (tempRB) {
+ GL_CALL(FramebufferRenderbuffer(fboTarget,
+ GR_GL_COLOR_ATTACHMENT0,
+ GR_GL_RENDERBUFFER, 0));
+ GL_CALL(DeleteRenderbuffers(1, &tempRB));
+ }
+
// Unbind the SB from the FBO so that we don't keep it alive.
GL_CALL(FramebufferRenderbuffer(fboTarget,
GR_GL_STENCIL_ATTACHMENT,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698