summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/fbobject.c
diff options
context:
space:
mode:
authorTapani Pälli <[email protected]>2013-02-18 09:12:27 +0200
committerChad Versace <[email protected]>2013-02-20 10:01:45 -0800
commit413941e1a3155b29a190ab7ecfd844b1a5c2e460 (patch)
treeb753485b24252ebb5e328d6e7f7bd539d4feeb62 /src/mesa/main/fbobject.c
parent73bf626713f7efc43164f7649fc143f4a94299cb (diff)
gles2: a stub implementation for GL_EXT_discard_framebuffer
This patch implements a stub for GL_EXT_discard_framebuffer with required checks listed by the extension specification. This extension is required by GLBenchmark 2.5 when compiled with OpenGL ES 2.0 as the rendering backend. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-and-tested-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa/main/fbobject.c')
-rw-r--r--src/mesa/main/fbobject.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 257f839a666..89bc5750932 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -3310,3 +3310,56 @@ _mesa_InvalidateFramebuffer(GLenum target, GLsizei numAttachments,
0, 0, MAX_VIEWPORT_WIDTH, MAX_VIEWPORT_HEIGHT,
"glInvalidateFramebuffer");
}
+
+void GLAPIENTRY
+_mesa_DiscardFramebufferEXT(GLenum target, GLsizei numAttachments,
+ const GLenum *attachments)
+{
+ struct gl_framebuffer *fb;
+ GLint i;
+
+ GET_CURRENT_CONTEXT(ctx);
+
+ fb = get_framebuffer_target(ctx, target);
+ if (!fb) {
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glDiscardFramebufferEXT(target %s)",
+ _mesa_lookup_enum_by_nr(target));
+ return;
+ }
+
+ if (numAttachments < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glDiscardFramebufferEXT(numAttachments < 0)");
+ return;
+ }
+
+ for (i = 0; i < numAttachments; i++) {
+ switch (attachments[i]) {
+ case GL_COLOR:
+ case GL_DEPTH:
+ case GL_STENCIL:
+ if (_mesa_is_user_fbo(fb))
+ goto invalid_enum;
+ break;
+ case GL_COLOR_ATTACHMENT0:
+ case GL_DEPTH_ATTACHMENT:
+ case GL_STENCIL_ATTACHMENT:
+ if (_mesa_is_winsys_fbo(fb))
+ goto invalid_enum;
+ break;
+ default:
+ goto invalid_enum;
+ }
+ }
+
+ if (ctx->Driver.DiscardFramebuffer)
+ ctx->Driver.DiscardFramebuffer(ctx, target, numAttachments, attachments);
+
+ return;
+
+invalid_enum:
+ _mesa_error(ctx, GL_INVALID_ENUM,
+ "glDiscardFramebufferEXT(attachment %s)",
+ _mesa_lookup_enum_by_nr(attachments[i]));
+}