radeon: fix pixel readback for RGB8 tests
authorDave Airlie <airlied@redhat.com>
Tue, 31 Mar 2009 04:43:14 +0000 (14:43 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 31 Mar 2009 04:43:14 +0000 (14:43 +1000)
src/mesa/drivers/dri/radeon/radeon_fbo.c
src/mesa/drivers/dri/radeon/radeon_screen.c
src/mesa/drivers/dri/radeon/radeon_span.c

index 96ba5d3c60ef4a8f47fccc22ce85f5d1142f4003..d17835bb12c30eba246a16d699eb3ae7f20fbc89 100644 (file)
@@ -274,6 +274,15 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv)
            rrb->base.BlueBits = 5;
            rrb->base.DataType = GL_UNSIGNED_BYTE;
            break;
+       case GL_RGB8:
+           rrb->base._ActualFormat = GL_RGB8;
+           rrb->base._BaseFormat = GL_RGB;
+           rrb->base.RedBits = 8;
+           rrb->base.GreenBits = 8;
+           rrb->base.BlueBits = 8;
+           rrb->base.AlphaBits = 8;
+           rrb->base.DataType = GL_UNSIGNED_BYTE;
+           break;
        case GL_RGBA8:
            rrb->base._ActualFormat = GL_RGBA8;
            rrb->base._BaseFormat = GL_RGBA;
index 3817007e9e56bf912aa3ff52b67d4e08a1ac1fd5..98fa1417f9adf2e851d1530893ce2d7e7e78ef25 100644 (file)
@@ -1234,7 +1234,7 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
     const GLboolean swAccum = mesaVis->accumRedBits > 0;
     const GLboolean swStencil = mesaVis->stencilBits > 0 &&
        mesaVis->depthBits != 24;
-    GLenum rgbFormat = (mesaVis->redBits == 5 ? GL_RGB5 : GL_RGBA8);
+    GLenum rgbFormat;
     struct radeon_framebuffer *rfb;
 
     if (isPixmap)
@@ -1246,6 +1246,13 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv,
 
     _mesa_initialize_framebuffer(&rfb->base, mesaVis);
 
+    if (mesaVis->redBits == 5)
+        rgbFormat = GL_RGB5;
+    else if (mesaVis->alphaBits == 0)
+        rgbFormat = GL_RGB8;
+    else
+        rgbFormat = GL_RGBA8;
+
     /* front color renderbuffer */
     rfb->color_rb[0] = radeon_create_renderbuffer(rgbFormat, driDrawPriv);
     _mesa_add_renderbuffer(&rfb->base, BUFFER_FRONT_LEFT, &rfb->color_rb[0]->base);
index d2211bcbcc6147eb93dd01471ef857efdd02557f..b0c77be7bd37caf28ea7222438ae305c7ae45763 100644 (file)
@@ -261,7 +261,11 @@ s8z24_to_z24s8(uint32_t val)
 
 #define TAG(x)    radeon##x##_xRGB8888
 #define TAG2(x,y) radeon##x##_xRGB8888##y
-#define GET_PTR(X,Y) radeon_ptr32(rrb, (X) + x_off, (Y) + y_off)
+#define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr32(rrb, _x + x_off, _y + y_off)) | 0xff000000))
+#define PUT_VALUE(_x, _y, d) { \
+   GLuint *_ptr = (GLuint*)radeon_ptr32( rrb, _x + x_off, _y + y_off );                \
+   *_ptr = d;                                                          \
+} while (0)
 #include "spantmp2.h"
 
 /* 32 bit, ARGB8888 color spanline and pixel functions