EXT_texture_sRGB support on i965

This commit is contained in:
Zou Nan hai 2007-08-02 14:26:12 +08:00
parent 394e7575a3
commit 6bf81a5edf
5 changed files with 53 additions and 0 deletions

View file

@ -168,6 +168,25 @@ brwChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_DEPTH_COMPONENT32:
return &_mesa_texformat_z16;
case GL_SRGB_EXT:
case GL_SRGB8_EXT:
case GL_SRGB_ALPHA_EXT:
case GL_SRGB8_ALPHA8_EXT:
case GL_SLUMINANCE_EXT:
case GL_SLUMINANCE8_EXT:
case GL_SLUMINANCE_ALPHA_EXT:
case GL_SLUMINANCE8_ALPHA8_EXT:
case GL_COMPRESSED_SRGB_EXT:
case GL_COMPRESSED_SRGB_ALPHA_EXT:
case GL_COMPRESSED_SLUMINANCE_EXT:
case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT:
return &_mesa_texformat_srgb_dxt1;
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
return &_mesa_texformat_srgb_dxt1;
default:
fprintf(stderr, "unexpected texture format %s in %s\n",
_mesa_lookup_enum_by_nr(internalFormat),

View file

@ -120,6 +120,11 @@ static GLuint translate_tex_format( GLuint mesa_format )
case MESA_FORMAT_RGB_DXT1:
return BRW_SURFACEFORMAT_DXT1_RGB;
case MESA_FORMAT_SRGBA8:
return BRW_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB;
case MESA_FORMAT_SRGB_DXT1:
return BRW_SURFACEFORMAT_BC1_UNORM_SRGB;
default:
assert(0);
return 0;

View file

@ -182,6 +182,7 @@ const struct dri_extension card_extensions[] =
{ "GL_EXT_texture_env_dot3", NULL },
{ "GL_EXT_texture_filter_anisotropic", NULL },
{ "GL_EXT_texture_lod_bias", NULL },
{ "GL_EXT_texture_sRGB", NULL },
{ "GL_3DFX_texture_compression_FXT1", NULL },
{ "GL_APPLE_client_storage", NULL },
{ "GL_MESA_pack_invert", NULL },

View file

@ -577,6 +577,32 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = {
NULL /* StoreTexel */
};
#if FEATURE_EXT_texture_sRGB
const struct gl_texture_format _mesa_texformat_srgb_dxt1 = {
MESA_FORMAT_SRGB_DXT1, /* MesaFormat */
GL_RGB, /* BaseFormat */
GL_UNSIGNED_NORMALIZED_ARB, /* DataType */
4, /*approx*/ /* RedBits */
4, /*approx*/ /* GreenBits */
4, /*approx*/ /* BlueBits */
0, /* AlphaBits */
0, /* LuminanceBits */
0, /* IntensityBits */
0, /* IndexBits */
0, /* DepthBits */
0, /* StencilBits */
0, /* TexelBytes */
texstore_rgb_dxt1, /* StoreTexImageFunc */
NULL, /*impossible*/ /* FetchTexel1D */
fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */
NULL, /*impossible*/ /* FetchTexel3D */
NULL, /*impossible*/ /* FetchTexel1Df */
fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */
NULL, /*impossible*/ /* FetchTexel3Df */
NULL /* StoreTexel */
};
#endif
const struct gl_texture_format _mesa_texformat_rgba_dxt1 = {
MESA_FORMAT_RGBA_DXT1, /* MesaFormat */
GL_RGBA, /* BaseFormat */

View file

@ -97,6 +97,7 @@ enum _format {
MESA_FORMAT_SRGBA8,
MESA_FORMAT_SL8,
MESA_FORMAT_SLA8,
MESA_FORMAT_SRGB_DXT1,
/*@}*/
#endif
@ -168,6 +169,7 @@ extern const struct gl_texture_format _mesa_texformat_srgb8;
extern const struct gl_texture_format _mesa_texformat_srgba8;
extern const struct gl_texture_format _mesa_texformat_sl8;
extern const struct gl_texture_format _mesa_texformat_sla8;
extern const struct gl_texture_format _mesa_texformat_srgb_dxt1;
/*@}*/
#endif