Mesa (master): mesa: allow glFramebufferTexture1/2/3D(target = GL_READ/ DRAW_FRAMEBUFFER)

Brian Paul brianp at kemper.freedesktop.org
Thu Jan 29 22:28:09 UTC 2009


Module: Mesa
Branch: master
Commit: 5fec84ad0446d4d6d842f5cf740f9787678113be
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5fec84ad0446d4d6d842f5cf740f9787678113be

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Jan 29 15:01:09 2009 -0700

mesa: allow glFramebufferTexture1/2/3D(target = GL_READ/DRAW_FRAMEBUFFER)

This is part of GL_EXT_framebuffer_blit and GL_ARB_framebuffer_obbject.

---

 src/mesa/main/fbobject.c |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index eec8f15..d08ad33 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1367,16 +1367,31 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target,
    struct gl_renderbuffer_attachment *att;
    struct gl_texture_object *texObj = NULL;
    struct gl_framebuffer *fb;
+   GLboolean error = GL_FALSE;
 
    ASSERT_OUTSIDE_BEGIN_END(ctx);
 
-   if (target != GL_FRAMEBUFFER_EXT) {
+   switch (target) {
+   case GL_READ_FRAMEBUFFER_EXT:
+      error = !ctx->Extensions.EXT_framebuffer_blit;
+      fb = ctx->ReadBuffer;
+      break;
+   case GL_DRAW_FRAMEBUFFER_EXT:
+      error = !ctx->Extensions.EXT_framebuffer_blit;
+      /* fall-through */
+   case GL_FRAMEBUFFER_EXT:
+      fb = ctx->DrawBuffer;
+      break;
+   default:
+      error = GL_TRUE;
+   }
+
+   if (error) {
       _mesa_error(ctx, GL_INVALID_ENUM,
-                  "glFramebufferTexture%sEXT(target)", caller);
+                  "glFramebufferTexture%sEXT(target=0x%x)", caller, target);
       return;
    }
 
-   fb = ctx->DrawBuffer;
    ASSERT(fb);
 
    /* check framebuffer binding */
@@ -1518,7 +1533,7 @@ _mesa_FramebufferTexture2DEXT(GLenum target, GLenum attachment,
        (textarget != GL_TEXTURE_RECTANGLE_ARB) &&
        (!IS_CUBE_FACE(textarget))) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "glFramebufferTexture2DEXT(textarget)");
+                  "glFramebufferTexture2DEXT(textarget=0x%x)", textarget);
       return;
    }
 




More information about the mesa-commit mailing list