r600: add support for EXT_texture_sRGB
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 4 Sep 2009 22:45:09 +0000 (18:45 -0400)
committerAlex Deucher <alexdeucher@gmail.com>
Fri, 4 Sep 2009 22:46:16 +0000 (18:46 -0400)
src/mesa/drivers/dri/r600/r600_context.c
src/mesa/drivers/dri/r600/r600_texstate.c

index 7a5bcd9ac23676ff0509063471320163e5b6bac9..07a7bcf11f1d6f336363441aef24bc27766d61d1 100644 (file)
@@ -130,6 +130,7 @@ const struct dri_extension card_extensions[] = {
   {"GL_EXT_texture_lod_bias",          NULL},
   {"GL_EXT_texture_mirror_clamp",      NULL},
   {"GL_EXT_texture_rectangle",         NULL},
+  {"GL_EXT_texture_sRGB",               NULL},
   {"GL_ATI_separate_stencil",          GL_ATI_separate_stencil_functions},
   {"GL_ATI_texture_env_combine3",      NULL},
   {"GL_ATI_texture_mirror_once",       NULL},
index 49b603b65e119504d108d457e619d6879397cc32..fff6e743860e91205924c8a2998968411733409f 100644 (file)
@@ -531,6 +531,49 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, GLuint mesa_fo
                        return GL_FALSE;
                }
                break;
+       /* EXT_texture_sRGB */
+       case MESA_FORMAT_SRGBA8:
+               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);
+               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);
+               SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X,
+                        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;
+       case MESA_FORMAT_SLA8:
+               SETfield(t->SQ_TEX_RESOURCE1, FMT_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_X,
+                        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_X,
+                        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_Y,
+                        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;
+       case MESA_FORMAT_SL8: /* X, X, X, ONE */
+               SETfield(t->SQ_TEX_RESOURCE1, FMT_8,
+                        SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask);
+
+               SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X,
+                        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_X,
+                        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_1,
+                        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;
        default:
                /* Not supported format */
                return GL_FALSE;