r300: add support for EXT_texture_sRGB
authorMaciej Cencora <m.cencora@gmail.com>
Fri, 12 Jun 2009 17:08:44 +0000 (19:08 +0200)
committerMaciej Cencora <m.cencora@gmail.com>
Fri, 12 Jun 2009 17:08:44 +0000 (19:08 +0200)
Tested with glean/texture_srgb and wine/d3d9 tests on RV535

src/mesa/drivers/dri/r300/r300_context.c
src/mesa/drivers/dri/r300/r300_reg.h
src/mesa/drivers/dri/r300/r300_texstate.c
src/mesa/drivers/dri/radeon/radeon_texture.c

index 394521a051f13a976564a7b95e75654e8bab9cbe..76881e49282d7b727a53d16063d89c63d3c6b2fb 100644 (file)
@@ -124,6 +124,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_EXT_vertex_array_bgra",         NULL},
   {"GL_ATI_separate_stencil",          GL_ATI_separate_stencil_functions},
   {"GL_ATI_texture_env_combine3",      NULL},
index c22616b95f681214fbecfa8ddc99d310c4888108..357c600af974ce87852db6cae3a253ba1a76ed78 100644 (file)
@@ -1467,6 +1467,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
 #      define R300_TX_FORMAT_3D                   (1 << 25)
 #      define R300_TX_FORMAT_CUBIC_MAP            (2 << 25)
 
+#      define R300_TX_FORMAT_GAMMA                     (1 << 21)
+
        /* gap */
        /* Floating point formats */
        /* Note - hardware supports both 16 and 32 bit floating point */
index 6d6a90aa88a288b02fe41519c042aa8e7454cd39..6e47321246ab50452aaae8c80c5c11c08ec1e170 100644 (file)
@@ -119,6 +119,10 @@ static const struct tx_table {
        _ASSIGN(Z24_S8, R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8)),
        _ASSIGN(S8_Z24, R300_EASY_TX_FORMAT(Y, Y, Y, Y, X24_Y8)),
        _ASSIGN(Z32, R300_EASY_TX_FORMAT(X, X, X, X, X32)),
+       /* EXT_texture_sRGB */
+       _ASSIGN(SRGBA8, R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8) | R300_TX_FORMAT_GAMMA),
+       _ASSIGN(SLA8, R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8) | R300_TX_FORMAT_GAMMA),
+       _ASSIGN(SL8, R300_EASY_TX_FORMAT(X, X, X, ONE, X8) | R300_TX_FORMAT_GAMMA),
        /* *INDENT-ON* */
 };
 
index 0d87f152e99601326d792647e461b2dd4b790b14..3fc750c005d59d4fec54527d92eb30e10c50f255 100644 (file)
@@ -477,6 +477,26 @@ const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx,
        case GL_DEPTH_STENCIL_EXT:
        case GL_DEPTH24_STENCIL8_EXT:
                return &_mesa_texformat_s8_z24;
+
+       /* EXT_texture_sRGB */
+       case GL_SRGB:
+       case GL_SRGB8:
+       case GL_SRGB_ALPHA:
+       case GL_SRGB8_ALPHA8:
+       case GL_COMPRESSED_SRGB:
+       case GL_COMPRESSED_SRGB_ALPHA:
+               return &_mesa_texformat_srgba8;
+
+       case GL_SLUMINANCE:
+       case GL_SLUMINANCE8:
+       case GL_COMPRESSED_SLUMINANCE:
+               return &_mesa_texformat_sl8;
+
+       case GL_SLUMINANCE_ALPHA:
+       case GL_SLUMINANCE8_ALPHA8:
+       case GL_COMPRESSED_SLUMINANCE_ALPHA:
+               return &_mesa_texformat_sla8;
+
        default:
                _mesa_problem(ctx,
                              "unexpected internalFormat 0x%x in %s",