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
This commit is contained in:
commit-bot@chromium.org 2014-04-16 14:33:27 +00:00
parent ab16445ae8
commit 4453e8b45a

View File

@ -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;
}
}