intel: Fix up x8r8g8b8 renderbuffer format so that alpha=1 spans code happens.
authorEric Anholt <eric@anholt.net>
Thu, 26 Feb 2009 06:54:51 +0000 (22:54 -0800)
committerEric Anholt <eric@anholt.net>
Thu, 26 Feb 2009 07:01:57 +0000 (23:01 -0800)
I was lured into a false sense of security by the fact that the spans code was
already there, and a bunch of tests didn't catch the problem.  oglconform's
mask.c did, though.

Bug #19970.

src/mesa/drivers/dri/intel/intel_fbo.c
src/mesa/drivers/dri/intel/intel_screen.c

index c9fb90f3b2632e5150fc8f008532e215327cc1cb..739a85232e5e58cac7ed6ab9f89fb4fcdbc04653 100644 (file)
@@ -323,6 +323,15 @@ intel_create_renderbuffer(GLenum intFormat)
       irb->Base.BlueBits = 5;
       irb->Base.DataType = GL_UNSIGNED_BYTE;
       break;
+   case GL_RGB8:
+      irb->Base._ActualFormat = GL_RGB8;
+      irb->Base._BaseFormat = GL_RGB;
+      irb->Base.RedBits = 8;
+      irb->Base.GreenBits = 8;
+      irb->Base.BlueBits = 8;
+      irb->Base.AlphaBits = 0;
+      irb->Base.DataType = GL_UNSIGNED_BYTE;
+      break;
    case GL_RGBA8:
       irb->Base._ActualFormat = GL_RGBA8;
       irb->Base._BaseFormat = GL_RGBA;
index d6110b8163ac954f018ea8692e06186848e3fbf6..df404695bcbe2ceefd91ab8384edb2e5f81159d5 100644 (file)
@@ -323,7 +323,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
    else {
       GLboolean swStencil = (mesaVis->stencilBits > 0 &&
                              mesaVis->depthBits != 24);
-      GLenum rgbFormat = (mesaVis->redBits == 5 ? GL_RGB5 : GL_RGBA8);
+      GLenum rgbFormat;
 
       struct intel_framebuffer *intel_fb = CALLOC_STRUCT(intel_framebuffer);
 
@@ -332,6 +332,13 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv,
 
       _mesa_initialize_framebuffer(&intel_fb->Base, mesaVis);
 
+      if (mesaVis->redBits == 5)
+        rgbFormat = GL_RGB5;
+      else if (mesaVis->alphaBits == 0)
+        rgbFormat = GL_RGB8;
+      else
+        rgbFormat = GL_RGBA8;
+
       /* setup the hardware-based renderbuffers */
       intel_fb->color_rb[0] = intel_create_renderbuffer(rgbFormat);
       _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT,