From 3c9faa448ccef15a514a5580fe76838822dd2a9e Mon Sep 17 00:00:00 2001 From: Daniel Borca Date: Tue, 12 Oct 2004 07:32:11 +0000 Subject: SWTC trick (disabled for now) --- src/mesa/drivers/x11/xm_api.c | 7 +++++++ src/mesa/drivers/x11/xm_dd.c | 21 +++++++++++++++++++++ src/mesa/drivers/x11/xmesaP.h | 3 +++ 3 files changed, 31 insertions(+) (limited to 'src/mesa/drivers/x11') diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 4a8a92a0c8e..6255c3b7942 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1668,6 +1668,13 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) _mesa_enable_1_4_extensions(mesaCtx); _mesa_enable_1_5_extensions(mesaCtx); _mesa_enable_2_0_extensions(mesaCtx); +#if SWTC + if (c->Mesa_DXTn) { + _mesa_enable_extension(c, "GL_EXT_texture_compression_s3tc"); + _mesa_enable_extension(c, "GL_S3_s3tc"); + } + _mesa_enable_extension(c, "GL_3DFX_texture_compression_FXT1"); +#endif /* finish up xmesa context initializations */ c->swapbytes = CHECK_BYTE_ORDER(v) ? GL_FALSE : GL_TRUE; diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 4a290c84db7..db94e40c211 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1148,6 +1148,24 @@ test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, } +/** + * In SW, we don't really compress GL_COMPRESSED_RGB[A] textures! + */ +static const struct gl_texture_format * +choose_tex_format( GLcontext *ctx, GLint internalFormat, + GLenum format, GLenum type ) +{ + switch (internalFormat) { + case GL_COMPRESSED_RGB_ARB: + return &_mesa_texformat_rgb; + case GL_COMPRESSED_RGBA_ARB: + return &_mesa_texformat_rgba; + default: + return _mesa_choose_tex_format(ctx, internalFormat, format, type); + } +} + + /** * Initialize the device driver function table with the functions * we implement in this driver. @@ -1178,6 +1196,9 @@ void xmesa_init_driver_functions( XMesaVisual xmvisual, } #endif driver->TestProxyTexImage = test_proxy_teximage; +#if SWTC + driver->ChooseTextureFormat = choose_tex_format; +#endif } diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index b6fa3a1e1df..085b43401c4 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -521,4 +521,7 @@ extern GLboolean XMesaLoseCurrent(XMesaContext c); extern void XMesaReset( void ); +#define SWTC 0 /* SW texture compression */ + + #endif -- cgit v1.2.3