radeon: Differentiate 16 bpp destination formats.
authorMichel Dänzer <daenzer@vmware.com>
Tue, 14 Jul 2009 06:25:27 +0000 (08:25 +0200)
committerMichel Dänzer <daenzer@vmware.com>
Tue, 14 Jul 2009 06:25:27 +0000 (08:25 +0200)
Fixes those formats in fbo_firecube.

Only tested with r300, radeon and r200 compile tested only.

src/mesa/drivers/dri/r200/r200_state_init.c
src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/radeon/radeon_state_init.c

index c7df4b2587e2ed2fd83acd29cbc24d99ebf04b40..bc871d99048adbb77299388ac52186fd9ebbf568 100644 (file)
@@ -484,8 +484,17 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom)
    atom->cmd[CTX_RB3D_CNTL] &= ~(0xf << 10);
    if (rrb->cpp == 4)
        atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB8888;
-   else
+   else switch (rrb->base._ActualFormat) {
+   case GL_RGB5:
        atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_RGB565;
+       break;
+   case GL_RGBA4:
+       atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB4444;
+       break;
+   case GL_RGB5_A1:
+       atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB1555;
+       break;
+   }
 
    cbpitch = (rrb->pitch / rrb->cpp);
    if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE)
index 90ca45b3e77a6843c3d4f0ee564d411ba2c309c4..248297897d375f1f717d864077e678aeabc75748 100644 (file)
@@ -269,8 +269,17 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom)
        cbpitch = (rrb->pitch / rrb->cpp);
        if (rrb->cpp == 4)
                cbpitch |= R300_COLOR_FORMAT_ARGB8888;
-       else
+       else switch (rrb->base._ActualFormat) {
+       case GL_RGB5:
                cbpitch |= R300_COLOR_FORMAT_RGB565;
+               break;
+       case GL_RGBA4:
+               cbpitch |= R300_COLOR_FORMAT_ARGB4444;
+               break;
+       case GL_RGB5_A1:
+               cbpitch |= R300_COLOR_FORMAT_ARGB1555;
+               break;
+       }
 
        if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE)
                cbpitch |= R300_COLOR_TILE_ENABLE;
index a55cd6dfcba0d31f0f0aeb1df10beb50e4f6d1e2..aaa82b1d6a4be3e5bbc9c9e1b6ea0b30676dc880 100644 (file)
@@ -390,8 +390,17 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom)
    atom->cmd[CTX_RB3D_CNTL] &= ~(0xf << 10);
    if (rrb->cpp == 4)
        atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB8888;
-   else
+   else switch (rrb->base._ActualFormat) {
+   case GL_RGB5:
        atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_RGB565;
+       break;
+   case GL_RGBA4:
+       atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB4444;
+       break;
+   case GL_RGB5_A1:
+       atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB1555;
+       break;
+   }
 
    cbpitch = (rrb->pitch / rrb->cpp);
    if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE)