Mesa (master): mesa: Allow GL_ALPHA FBOs with ARB_framebuffer_object.

Eric Anholt anholt at kemper.freedesktop.org
Wed Jun 9 23:00:21 UTC 2010


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

Author: Eric Anholt <eric at anholt.net>
Date:   Tue May 25 08:00:51 2010 -0700

mesa: Allow GL_ALPHA FBOs with ARB_framebuffer_object.

Drivers still reject them today, but cairo would like to use these.

---

 src/mesa/main/fbobject.c    |    7 +++++--
 src/mesa/main/framebuffer.c |    3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index f33e027..1a2e9b1 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -393,7 +393,9 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format,
 
       if (format == GL_COLOR) {
          if (baseFormat != GL_RGB &&
-             baseFormat != GL_RGBA) {
+             baseFormat != GL_RGBA &&
+	     (!ctx->Extensions.ARB_framebuffer_object ||
+	      baseFormat != GL_ALPHA)) {
             att_incomplete("bad format");
             att->Complete = GL_FALSE;
             return;
@@ -572,7 +574,8 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb)
          f = texImg->_BaseFormat;
          numImages++;
          if (f != GL_RGB && f != GL_RGBA && f != GL_DEPTH_COMPONENT
-             && f != GL_DEPTH_STENCIL_EXT) {
+             && f != GL_DEPTH_STENCIL_EXT
+	     && (!ctx->Extensions.ARB_framebuffer_object || f != GL_ALPHA)) {
             fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
             fbo_incomplete("texture attachment incomplete", -1);
             return;
diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c
index 31689c8..01f8418 100644
--- a/src/mesa/main/framebuffer.c
+++ b/src/mesa/main/framebuffer.c
@@ -544,7 +544,8 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb)
          const GLenum baseFormat = _mesa_get_format_base_format(rb->Format);
          const gl_format fmt = rb->Format;
          
-         if (baseFormat == GL_RGBA || baseFormat == GL_RGB) {
+         if (baseFormat == GL_RGBA || baseFormat == GL_RGB ||
+	     baseFormat == GL_ALPHA) {
             fb->Visual.redBits = _mesa_get_format_bits(fmt, GL_RED_BITS);
             fb->Visual.greenBits = _mesa_get_format_bits(fmt, GL_GREEN_BITS);
             fb->Visual.blueBits = _mesa_get_format_bits(fmt, GL_BLUE_BITS);




More information about the mesa-commit mailing list