diff options
Diffstat (limited to 'src/mesa/drivers/dri/i830')
-rw-r--r-- | src/mesa/drivers/dri/i830/i830_context.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i830/i830_screen.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i830/i830_tex.c | 16 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i830/i830_texmem.c | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i830/i830_texstate.c | 19 |
5 files changed, 59 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i830/i830_context.c b/src/mesa/drivers/dri/i830/i830_context.c index b69f11a0c0d..3e6f8a9a1fb 100644 --- a/src/mesa/drivers/dri/i830/i830_context.c +++ b/src/mesa/drivers/dri/i830/i830_context.c @@ -73,7 +73,7 @@ int I830_DEBUG = (0); * Mesa's Driver Functions ***************************************/ -#define DRIVER_DATE "20040506" +#define DRIVER_DATE "20041007" static const GLubyte *i830DDGetString( GLcontext *ctx, GLenum name ) @@ -372,6 +372,14 @@ GLboolean i830CreateContext( const __GLcontextModes *mesaVis, driInitExtensions( ctx, card_extensions, GL_TRUE ); + if (imesa->glCtx->Mesa_DXTn) { + _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); + _mesa_enable_extension( ctx, "GL_S3_s3tc" ); + } + else if (driQueryOptionb (&imesa->optionCache, "force_s3tc_enable")) { + _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); + } + _mesa_enable_extension( ctx, "GL_3DFX_texture_compression_FXT1" ); /* XXX these should really go right after _mesa_init_driver_functions() */ diff --git a/src/mesa/drivers/dri/i830/i830_screen.c b/src/mesa/drivers/dri/i830/i830_screen.c index 52aa22d9d16..f323baccbfa 100644 --- a/src/mesa/drivers/dri/i830/i830_screen.c +++ b/src/mesa/drivers/dri/i830/i830_screen.c @@ -59,9 +59,10 @@ const char __driConfigOptions[] = DRI_CONF_BEGIN DRI_CONF_SECTION_PERFORMANCE DRI_CONF_MAX_TEXTURE_UNITS(4,2,4) + DRI_CONF_FORCE_S3TC_ENABLE(false) DRI_CONF_SECTION_END DRI_CONF_END; -const GLuint __driNConfigOptions = 1; +const GLuint __driNConfigOptions = 2; #ifdef USE_NEW_INTERFACE static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; diff --git a/src/mesa/drivers/dri/i830/i830_tex.c b/src/mesa/drivers/dri/i830/i830_tex.c index 2fb4cc93249..41b5d929330 100644 --- a/src/mesa/drivers/dri/i830/i830_tex.c +++ b/src/mesa/drivers/dri/i830/i830_tex.c @@ -643,6 +643,22 @@ i830ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_COMPRESSED_RGBA_FXT1_3DFX: return &_mesa_texformat_rgba_fxt1; + case GL_RGB_S3TC: + case GL_RGB4_S3TC: + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + return &_mesa_texformat_rgb_dxt1; + + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + return &_mesa_texformat_rgba_dxt1; + + case GL_RGBA_S3TC: + case GL_RGBA4_S3TC: + case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: + return &_mesa_texformat_rgba_dxt3; + + case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: + return &_mesa_texformat_rgba_dxt5; + default: fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__); return NULL; diff --git a/src/mesa/drivers/dri/i830/i830_texmem.c b/src/mesa/drivers/dri/i830/i830_texmem.c index 6a30b496555..7faf90874ce 100644 --- a/src/mesa/drivers/dri/i830/i830_texmem.c +++ b/src/mesa/drivers/dri/i830/i830_texmem.c @@ -116,6 +116,20 @@ static void i830UploadTexLevel( i830ContextPtr imesa, src += image->Width*2; } } + else if ((t->Setup[I830_TEXREG_TM0S1] & TM0S1_MT_FORMAT_MASK)==MT_COMPRESS_DXT1) + { + for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) { + __memcpy(dst, src, (image->Width*2) ); + src += image->Width*2; + } + } + else if (((t->Setup[I830_TEXREG_TM0S1] & TM0S1_MT_FORMAT_MASK)==MT_COMPRESS_DXT2_3) || ((t->Setup[I830_TEXREG_TM0S1] & TM0S1_MT_FORMAT_MASK)==MT_COMPRESS_DXT4_5)) + { + for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) { + __memcpy(dst, src, (image->Width*4) ); + src += image->Width*4; + } + } } else if (image->Width * image->TexFormat->TexelBytes == t->Pitch) { GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[0][hwlevel].offset); diff --git a/src/mesa/drivers/dri/i830/i830_texstate.c b/src/mesa/drivers/dri/i830/i830_texstate.c index d5440141bfe..358c554f3b3 100644 --- a/src/mesa/drivers/dri/i830/i830_texstate.c +++ b/src/mesa/drivers/dri/i830/i830_texstate.c @@ -117,7 +117,24 @@ static void i830SetTexImages( i830ContextPtr imesa, t->texelBytes = 2; textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1); break; - + case MESA_FORMAT_RGBA_DXT1: + case MESA_FORMAT_RGB_DXT1: + /* + * DXTn pitches are Width/4 * blocksize in bytes + * for DXT1: blocksize=8 so Width/4*8 = Width * 2 + * for DXT3/5: blocksize=16 so Width/4*16 = Width * 4 + */ + t->texelBytes = 2; + textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1); + break; + case MESA_FORMAT_RGBA_DXT3: + t->texelBytes = 4; + textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3); + break; + case MESA_FORMAT_RGBA_DXT5: + t->texelBytes = 4; + textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); + break; default: fprintf(stderr, "%s: bad image format\n", __FUNCTION__); free( t ); |