aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-16 14:33:27 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-16 14:33:27 +0000
commit4453e8b45aaaaea568da35f8144177bdc8d2e171 (patch)
treeed30b517d11bdb6046284fd71d6a2bf08a23339f /src
parentab16445ae8cdb421a42e1d3f963d86112f53ddf8 (diff)
glDiscardFramebuffer() in GrGpuGL::discard uses invalid GLenum
According to the spec: "If a framebuffer object is bound to <target>, then <attachments> may contain COLOR_ATTACHMENT0, DEPTH_ATTACHMENT, and/or STENCIL_ATTACHMENT. If the framebuffer object is not complete, DiscardFramebufferEXT may be ignored. If the default framebuffer is bound to <target>, then <attachment> may contain COLOR, identifying the color buffer; DEPTH, identifying the depth buffer; or STENCIL, identifying the stencil buffer." Do the same as in glInvalidateFramebuffer() case. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> R=bsalomon@google.com BUG=skia:2411 Author: siglesias@igalia.com Review URL: https://codereview.chromium.org/236193007 git-svn-id: http://skia.googlecode.com/svn/trunk@14220 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/gpu/gl/GrGpuGL.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp
index b210433070..4c6f2fcaf1 100644
--- a/src/gpu/gl/GrGpuGL.cpp
+++ b/src/gpu/gl/GrGpuGL.cpp
@@ -1330,9 +1330,18 @@ void GrGpuGL::discard(GrRenderTarget* renderTarget) {
}
break;
case GrGLCaps::kDiscard_InvalidateFBType: {
- static const GrGLenum attachments[] = { GR_GL_COLOR };
- GL_CALL(DiscardFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(attachments),
- attachments));
+ if (0 == glRT->renderFBOID()) {
+ // When rendering to the default framebuffer the legal values for attachments
+ // are GL_COLOR, GL_DEPTH, GL_STENCIL, ... rather than the various FBO attachment
+ // types. See glDiscardFramebuffer() spec.
+ static const GrGLenum attachments[] = { GR_GL_COLOR };
+ GL_CALL(DiscardFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(attachments),
+ attachments));
+ } else {
+ static const GrGLenum attachments[] = { GR_GL_COLOR_ATTACHMENT0 };
+ GL_CALL(DiscardFramebuffer(GR_GL_FRAMEBUFFER, SK_ARRAY_COUNT(attachments),
+ attachments));
+ }
break;
}
}