radeon: Use MESA_FORMAT_SARGB8 for sRGB formats
authorHenri Verbeet <hverbeet@gmail.com>
Mon, 9 Aug 2010 19:06:02 +0000 (15:06 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Mon, 9 Aug 2010 19:06:02 +0000 (15:06 -0400)
This can be supported on r600 without using the endian swapper, and is a
better fit for (typical) uploads using GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV
anyway.

src/mesa/drivers/dri/r300/r300_texstate.c
src/mesa/drivers/dri/r600/r600_blit.c
src/mesa/drivers/dri/r600/r600_tex.c
src/mesa/drivers/dri/r600/r600_texstate.c
src/mesa/drivers/dri/r600/r700_chip.c
src/mesa/drivers/dri/radeon/radeon_texture.c

index 4ba6740e3d921ad7078a9b52b7ddad888fe1b9fc..94588698265da3498d270ac47e6ad2c9232fd1ad 100644 (file)
@@ -152,8 +152,8 @@ int32_t r300TranslateTexFormat(gl_format mesaFormat)
                case MESA_FORMAT_Z32:
                        return R300_EASY_TX_FORMAT(X, X, X, X, X32);
                /* EXT_texture_sRGB */
-               case MESA_FORMAT_SRGBA8:
-                       return R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8) | R300_TX_FORMAT_GAMMA;
+               case MESA_FORMAT_SARGB8:
+                       return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8) | R300_TX_FORMAT_GAMMA;
                case MESA_FORMAT_SLA8:
                        return R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8) | R300_TX_FORMAT_GAMMA;
                case MESA_FORMAT_SL8:
index d92d846dbc4de54bbe3ad2515142387d95e2e909..27acff9c166d7cab65ae64e95259ac7ed6ad87f8 100644 (file)
@@ -72,7 +72,7 @@ unsigned r600_check_blit(gl_format mesa_format)
     case MESA_FORMAT_Z24_S8:
     case MESA_FORMAT_Z16:
     case MESA_FORMAT_Z32:
-    case MESA_FORMAT_SRGBA8:
+    case MESA_FORMAT_SARGB8:
     case MESA_FORMAT_SLA8:
     case MESA_FORMAT_SL8:
            break;
@@ -320,9 +320,9 @@ set_render_target(context_t *context, struct radeon_bo *bo, gl_format mesa_forma
            CLEARbit(cb_color0_info, SOURCE_FORMAT_bit);
            SETfield(cb_color0_info, NUMBER_UNORM, NUMBER_TYPE_shift, NUMBER_TYPE_mask);
             break;
-    case MESA_FORMAT_SRGBA8:
+    case MESA_FORMAT_SARGB8:
             format = COLOR_8_8_8_8;
-            comp_swap = SWAP_STD_REV;
+            comp_swap = SWAP_ALT;
            SETbit(cb_color0_info, SOURCE_FORMAT_bit);
            SETfield(cb_color0_info, NUMBER_SRGB, NUMBER_TYPE_shift, NUMBER_TYPE_mask);
             break;
@@ -1050,17 +1050,17 @@ set_tex_resource(context_t * context,
            SETfield(sq_tex_resource4, SQ_SEL_X,
                     SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
            break;
-    case MESA_FORMAT_SRGBA8:
+    case MESA_FORMAT_SARGB8:
            SETfield(sq_tex_resource1, FMT_8_8_8_8,
                     SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
 
-           SETfield(sq_tex_resource4, SQ_SEL_W,
-                    SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
            SETfield(sq_tex_resource4, SQ_SEL_Z,
-                    SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+                    SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
            SETfield(sq_tex_resource4, SQ_SEL_Y,
-                    SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+                    SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
            SETfield(sq_tex_resource4, SQ_SEL_X,
+                    SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+           SETfield(sq_tex_resource4, SQ_SEL_W,
                     SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
            SETbit(sq_tex_resource4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit);
            break;
index 41419f846015b75c4d0ef56fc1248f88fef7cabf..512a52ede3e1919229b1bb613805b3ccb0762da2 100644 (file)
@@ -431,7 +431,7 @@ unsigned r600IsFormatRenderable(gl_format mesa_format)
        case MESA_FORMAT_Z24_S8:
        case MESA_FORMAT_Z16:
        case MESA_FORMAT_Z32:
-       case MESA_FORMAT_SRGBA8:
+       case MESA_FORMAT_SARGB8:
        case MESA_FORMAT_SLA8:
        case MESA_FORMAT_SL8:
                return 1;
index 1600033b9bd17e38430e8c5abd258141bd014b01..ba3690b70ed80b5acb1e37b37857e7f5c80740df 100644 (file)
@@ -605,17 +605,17 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa
                }
                break;
        /* EXT_texture_sRGB */
-       case MESA_FORMAT_SRGBA8:
+       case MESA_FORMAT_SARGB8:
                SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8,
                         SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
 
-               SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W,
-                        SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
                SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Z,
-                        SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
+                        SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_X_mask);
                SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_Y,
-                        SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+                        SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask);
                SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X,
+                        SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask);
+               SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W,
                         SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask);
                SETbit(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__FORCE_DEGAMMA_bit);
                break;
index 1e955b93b2b372a63c807835eb3872d3b81dc655..dc4998265a91208b44b4ac35f049abd6c5ded3c2 100644 (file)
@@ -523,9 +523,9 @@ static void r700SetRenderTarget(context_t *context, int id)
                     CB_COLOR0_INFO__ARRAY_MODE_shift, CB_COLOR0_INFO__ARRAY_MODE_mask);
            CLEARbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit);
             break;
-    case MESA_FORMAT_SRGBA8:
+    case MESA_FORMAT_SARGB8:
             format = COLOR_8_8_8_8;
-            comp_swap = SWAP_STD_REV;
+            comp_swap = SWAP_ALT;
            number_type = NUMBER_SRGB;
            SETbit(r700->render_target[id].CB_COLOR0_INFO.u32All, SOURCE_FORMAT_bit);
             break;
index d2b190e42e0ec2e46e50aefd1cbedc2a4525266d..8c6a50d2f0df824da5dff8c7cc16a41c6a3d40bd 100644 (file)
@@ -551,7 +551,7 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx,
        case GL_SRGB8_ALPHA8:
        case GL_COMPRESSED_SRGB:
        case GL_COMPRESSED_SRGB_ALPHA:
-               return MESA_FORMAT_SRGBA8;
+               return MESA_FORMAT_SARGB8;
 
        case GL_SLUMINANCE:
        case GL_SLUMINANCE8: