Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 40575 Details for
Bug 65621
[PATCH] S3TC support in x11-base/xorg-x11-6.8.0-r1
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
v1, 6.8.0-dri-s3tc-040908.patch
6.8.0-dri-s3tc-040908.patch (text/plain), 45.58 KB, created by
Eric Shattow
on 2004-09-27 19:19:15 UTC
(
hide
)
Description:
v1, 6.8.0-dri-s3tc-040908.patch
Filename:
MIME Type:
Creator:
Eric Shattow
Created:
2004-09-27 19:19:15 UTC
Size:
45.58 KB
patch
obsolete
>diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/common/xmlpool.h xc/extras/Mesa/src/mesa/drivers/dri/common/xmlpool.h >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/common/xmlpool.h 2004-06-16 04:17:57.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/common/xmlpool.h 2004-09-27 19:37:25.456508007 -0500 >@@ -159,6 +159,12 @@ > DRI_CONF_DESC(de,"Verbiete negativen Textur-LOD-Bias") \ > DRI_CONF_OPT_END > >+#define DRI_CONF_FORCE_S3TC_ENABLE(def) \ >+DRI_CONF_OPT_BEGIN(force_s3tc_enable,bool,def) \ >+ DRI_CONF_DESC(en,"enable s3tc even if software support is not available") \ >+ DRI_CONF_DESC(de,"Benutze s3tc auch ohne Softwareunterstuetzung") \ >+DRI_CONF_OPT_END >+ > #define DRI_CONF_COLOR_REDUCTION_ROUND 0 > #define DRI_CONF_COLOR_REDUCTION_DITHER 1 > #define DRI_CONF_COLOR_REDUCTION(def) \ >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.c xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.c 2004-06-16 04:18:06.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_context.c 2004-09-27 19:53:35.420821138 -0500 >@@ -290,6 +290,10 @@ > 12, > GL_FALSE ); > >+ /* adjust max texture size a bit. Hack, but I really want to use larger textures >+ which will work just fine in 99.999999% of all cases, especially with texture compression... */ >+ if (ctx->Const.MaxTextureLevels < 12) ctx->Const.MaxTextureLevels += 1; >+ > ctx->Const.MaxTextureMaxAnisotropy = 2.0; > > ctx->Const.MinLineWidth = 1.0; >@@ -372,6 +376,14 @@ > > 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 -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.c xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.c 2004-07-22 01:51:36.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_screen.c 2004-09-27 19:54:33.559718449 -0500 >@@ -59,9 +59,10 @@ > 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 -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.c xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.c 2004-06-16 04:18:08.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_tex.c 2004-09-27 19:55:50.886311093 -0500 >@@ -643,6 +643,22 @@ > 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 -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_texmem.c xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_texmem.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_texmem.c 2004-07-22 01:51:38.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_texmem.c 2004-09-27 19:59:24.176229114 -0500 >@@ -116,6 +116,20 @@ > 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 -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_texstate.c xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_texstate.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_texstate.c 2004-07-22 01:51:37.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i830/i830_texstate.c 2004-09-27 20:01:26.903903164 -0500 >@@ -118,6 +118,25 @@ > 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 ); >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/i830_texstate.c xc/extras/Mesa/src/mesa/drivers/dri/i915/i830_texstate.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/i830_texstate.c 2004-07-22 01:52:15.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i915/i830_texstate.c 2004-09-27 19:40:38.987924428 -0500 >@@ -112,6 +112,25 @@ > 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->intel.texelBytes = 2; >+ textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1); >+ break; >+ case MESA_FORMAT_RGBA_DXT3: >+ t->intel.texelBytes = 4; >+ textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3); >+ break; >+ case MESA_FORMAT_RGBA_DXT5: >+ t->intel.texelBytes = 4; >+ textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); >+ break; >+ > default: > fprintf(stderr, "%s: bad image format\n", __FUNCTION__); > abort(); >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/i915_texstate.c xc/extras/Mesa/src/mesa/drivers/dri/i915/i915_texstate.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/i915_texstate.c 2004-07-22 01:52:17.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i915/i915_texstate.c 2004-09-27 19:42:09.880061906 -0500 >@@ -127,6 +127,24 @@ > t->intel.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->intel.texelBytes = 2; >+ textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1); >+ break; >+ case MESA_FORMAT_RGBA_DXT3: >+ t->intel.texelBytes = 4; >+ textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3); >+ break; >+ case MESA_FORMAT_RGBA_DXT5: >+ t->intel.texelBytes = 4; >+ textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); >+ break; > > default: > fprintf(stderr, "%s: bad image format\n", __FUNCTION__); >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.c xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.c 2004-07-22 01:52:17.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.c 2004-09-27 19:43:13.929018513 -0500 >@@ -352,6 +352,14 @@ > > driInitExtensions( ctx, card_extensions, GL_TRUE ); > >+ if (intel->ctx.Mesa_DXTn) { >+ _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); >+ _mesa_enable_extension( ctx, "GL_S3_s3tc" ); >+ } >+ else if (driQueryOptionb (&intelScreen->optionCache, "force_s3tc_enable")) { >+ _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); >+ } >+ > /* driInitTextureObjects( ctx, & intel->swapped, */ > /* DRI_TEXMGR_DO_TEXTURE_1D | */ > /* DRI_TEXMGR_DO_TEXTURE_2D | */ >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.h xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.h >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.h 2004-07-22 02:03:04.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_context.h 2004-09-27 19:44:04.932261210 -0500 >@@ -230,6 +230,11 @@ > __DRIscreenPrivate *driScreen; > intelScreenPrivate *intelScreen; > drmI830Sarea *sarea; >+ >+ /** >+ * Configuration cache >+ */ >+ driOptionCache optionCache; > }; > > >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.c xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.c 2004-07-22 01:52:18.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.c 2004-09-27 19:47:30.023877200 -0500 >@@ -30,6 +30,7 @@ > #include "matrix.h" > #include "simple_list.h" > #include "utils.h" >+#include "xmlpool.h" > > > #include "intel_screen.h" >@@ -43,8 +44,13 @@ > > #include "i830_dri.h" > >-const char __driConfigOptions[] = { 0 }; >-const GLuint __driNConfigOptions = 0; >+const char __driConfigOptions[] = >+DRI_CONF_BEGIN >+ DRI_CONF_SECTION_PERFORMANCE >+ DRI_CONF_FORCE_S3TC_ENABLE(false) >+ DRI_CONF_SECTION_END >+DRI_CONF_END; >+const GLuint __driNConfigOptions = 1; > > #ifdef USE_NEW_INTERFACE > static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; >@@ -78,6 +84,9 @@ > fprintf(stderr,"\nERROR! Allocating private area failed\n"); > return GL_FALSE; > } >+ /* parse information in __driConfigOptions */ >+ driParseOptionInfo (&intelScreen->optionCache, >+ __driConfigOptions, __driNConfigOptions); > > intelScreen->driScrnPriv = sPriv; > sPriv->private = (void *)intelScreen; >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.h xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.h >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.h 2004-07-22 01:52:18.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_screen.h 2004-09-27 19:48:37.392742570 -0500 >@@ -30,7 +30,7 @@ > > #include <sys/time.h> > #include "dri_util.h" >- >+#include "xmlconfig.h" > > typedef struct { > drm_handle_t handle; >@@ -76,6 +76,11 @@ > > int irq_active; > int allow_batchbuffer; >+ >+ /** >+ * Configuration cache with default values for all contexts >+ */ >+ driOptionCache optionCache; > } intelScreenPrivate; > > >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.c xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.c 2004-07-22 01:52:18.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/i915/intel_tex.c 2004-09-27 19:51:57.961842992 -0500 >@@ -554,6 +554,22 @@ > 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; >@@ -628,11 +644,24 @@ > { > case GL_COMPRESSED_RGB_FXT1_3DFX: > case GL_COMPRESSED_RGBA_FXT1_3DFX: >+ case GL_RGB_S3TC: >+ case GL_RGB4_S3TC: >+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: >+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: > for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) { > __memcpy(dst, src, row_len ); > src += row_len; > } > break; >+ case GL_RGBA_S3TC: >+ case GL_RGBA4_S3TC: >+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: >+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: >+ for (j = 0 ; j < image->Height/4 ; j++, dst += (t->Pitch)) { >+ __memcpy(dst, src, (image->Width*4) ); >+ src += image->Width*4; >+ } >+ break; > default: > fprintf(stderr,"Internal Compressed format not supported %d\n", image->IntFormat); > break; >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.c xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.c 2004-07-22 01:51:45.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_context.c 2004-09-27 20:03:48.165485992 -0500 >@@ -350,6 +350,10 @@ > 12, > GL_FALSE ); > >+/* adjust max texture size a bit. Hack, but I really want to use larger textures >+ which will work just fine in 99.999999% of all cases, especially with texture compression... */ >+ if (ctx->Const.MaxTextureLevels < 12) ctx->Const.MaxTextureLevels += 1; >+ > ctx->Const.MaxTextureMaxAnisotropy = 16.0; > > /* No wide points. >@@ -400,6 +404,14 @@ > _math_matrix_set_identity( &rmesa->tmpmat ); > > driInitExtensions( ctx, card_extensions, GL_TRUE ); >+ if (rmesa->glCtx->Mesa_DXTn) { >+ _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); >+ _mesa_enable_extension( ctx, "GL_S3_s3tc" ); >+ } >+ else if (driQueryOptionb (&rmesa->optionCache, "force_s3tc_enable")) { >+ _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); >+ } >+ > if (rmesa->r200Screen->drmSupportsCubeMaps) > _mesa_enable_extension( ctx, "GL_ARB_texture_cube_map" ); > if (rmesa->r200Screen->drmSupportsBlendColor) { >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.c xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.c 2004-07-22 01:51:46.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_screen.c 2004-09-27 20:08:03.418610147 -0500 >@@ -68,6 +68,7 @@ > DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB) > DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0") > DRI_CONF_NO_NEG_LOD_BIAS(false) >+ DRI_CONF_FORCE_S3TC_ENABLE(false) > DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER) > DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC) > DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF) >@@ -76,7 +77,7 @@ > DRI_CONF_NO_RAST(false) > DRI_CONF_SECTION_END > DRI_CONF_END; >-static const GLuint __driNConfigOptions = 11; >+static const GLuint __driNConfigOptions = 12; /* S3TC: was 11. (13->14?) */ > > #if 1 > /* Including xf86PciInfo.h introduces a bunch of errors... >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.c xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.c 2004-07-22 01:51:49.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_tex.c 2004-09-27 20:15:41.224172287 -0500 >@@ -420,6 +420,36 @@ > else > return &_mesa_texformat_ycbcr_rev; > >+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: >+ return &_mesa_texformat_rgb_dxt1; >+ >+ case GL_RGB_S3TC: >+ case GL_RGB4_S3TC: >+ /* only return this format if software compression/decompression is available, since >+ no app will ever use this for precompressed textures */ >+/* if (ctx->Mesa_DXTn) */ >+ return &_mesa_texformat_rgb_dxt1; >+/* else */ >+ /* mesa will crash if we return uncompressed format unfortunately */ >+/* return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565; */ >+ >+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: >+ return &_mesa_texformat_rgba_dxt1; >+ >+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: >+ return &_mesa_texformat_rgba_dxt3; >+ >+ case GL_RGBA_S3TC: >+ case GL_RGBA4_S3TC: >+/* if (ctx->Mesa_DXTn) */ >+ return &_mesa_texformat_rgba_dxt3; >+/* else */ >+ /* mesa will crash if we return uncompressed format unfortunately */ >+/* return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444; */ >+ >+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: >+ return &_mesa_texformat_rgba_dxt5; >+ > default: > _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__); > return NULL; >@@ -708,6 +738,116 @@ > } > > >+static void r200CompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, >+ GLint internalFormat, >+ GLint width, GLint height, GLint border, >+ GLsizei imageSize, const GLvoid *data, >+ struct gl_texture_object *texObj, >+ struct gl_texture_image *texImage ) >+{ >+ driTextureObject * t = (driTextureObject *) texObj->DriverData; >+ GLuint face; >+ >+ /* which cube face or ordinary 2D image */ >+ switch (target) { >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: >+ face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X; >+ ASSERT(face < 6); >+ break; >+ default: >+ face = 0; >+ } >+ >+ if ( t != NULL ) { >+ driSwapOutTextureObject( t ); >+ } >+ else { >+ t = (driTextureObject *) r200AllocTexObj( texObj ); >+ if (!t) { >+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); >+ return; >+ } >+ } >+ >+ texImage->IsClientData = GL_FALSE; >+/* can't call this, different parameters. Would never evaluate to true anyway currently >+ if (r200ValidateClientStorage( ctx, target, >+ internalFormat, >+ width, height, >+ format, type, pixels, >+ packing, texObj, texImage)) { >+ if (R200_DEBUG & DEBUG_TEXTURE) >+ fprintf(stderr, "%s: Using client storage\n", __FUNCTION__); >+ } >+ else */{ >+ if (R200_DEBUG & DEBUG_TEXTURE) >+ fprintf(stderr, "%s: Using normal storage\n", __FUNCTION__); >+ >+ /* Normal path: copy (to cached memory) and eventually upload >+ * via another copy to GART memory and then a blit... Could >+ * eliminate one copy by going straight to (permanent) GART. >+ * >+ * Note, this will call r200ChooseTextureFormat. >+ */ >+ _mesa_store_compressed_teximage2d(ctx, target, level, internalFormat, width, >+ height, border, imageSize, data, texObj, texImage); >+ >+ t->dirty_images[face] |= (1 << level); >+ } >+} >+ >+ >+static void r200CompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint level, >+ GLint xoffset, GLint yoffset, >+ GLsizei width, GLsizei height, >+ GLenum format, >+ GLsizei imageSize, const GLvoid *data, >+ struct gl_texture_object *texObj, >+ struct gl_texture_image *texImage ) >+{ >+ driTextureObject * t = (driTextureObject *) texObj->DriverData; >+ GLuint face; >+ >+ >+ /* which cube face or ordinary 2D image */ >+ switch (target) { >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: >+ face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X; >+ ASSERT(face < 6); >+ break; >+ default: >+ face = 0; >+ } >+ >+ assert( t ); /* this _should_ be true */ >+ if ( t ) { >+ driSwapOutTextureObject( t ); >+ } >+ else { >+ t = (driTextureObject *) r200AllocTexObj( texObj ); >+ if (!t) { >+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2D"); >+ return; >+ } >+ } >+ >+ _mesa_store_compressed_texsubimage2d(ctx, target, level, xoffset, yoffset, width, >+ height, format, imageSize, data, texObj, texImage); >+ >+ t->dirty_images[face] |= (1 << level); >+} >+ >+ > #if ENABLE_HW_3D_TEXTURE > static void r200TexImage3D( GLcontext *ctx, GLenum target, GLint level, > GLint internalFormat, >@@ -1034,6 +1174,9 @@ > functions->TexParameter = r200TexParameter; > functions->TexGen = r200TexGen; > >+ functions->CompressedTexImage2D = r200CompressedTexImage2D; >+ functions->CompressedTexSubImage2D = r200CompressedTexSubImage2D; >+ > driInitTextureFormats(); > > #if 000 >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_texmem.c xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_texmem.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_texmem.c 2004-06-16 04:18:19.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_texmem.c 2004-09-27 20:17:05.661425207 -0500 >@@ -379,6 +379,23 @@ > tex.height = imageHeight; > if (tex.height < 4) > tex.height = 4; >+ /* In case of for instance 8x8 texture (2x2 dxt blocks), padding after the first two blocks is >+ needed (only with dxt1 since 2 dxt3/dxt5 blocks already use 32 Byte). */ >+ /* set tex.height to 1/4 since 1 "macropixel" (dxt-block) has 4 real pixels. Needed >+ so the kernel module reads the right amount of data. */ >+ tex.height = (imageHeight + 3) / 4; >+ tex.width = (imageWidth + 3) / 4; >+ switch (t->pp_txformat & R200_TXFORMAT_FORMAT_MASK) { >+ case R200_TXFORMAT_DXT1: >+ tex.width *= 8; >+ break; >+ case R200_TXFORMAT_DXT23: >+ case R200_TXFORMAT_DXT45: >+ tex.width *= 16; >+ break; >+ default: >+ fprintf(stderr, "unknown compressed tex format in uploadSubImage\n"); >+ } > } > tex.image = &tmp; > >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c 2004-07-22 01:51:49.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/r200/r200_texstate.c 2004-09-27 20:20:16.732638502 -0500 >@@ -53,6 +53,10 @@ > #define R200_TXFORMAT_AL88 R200_TXFORMAT_AI88 > #define R200_TXFORMAT_YCBCR R200_TXFORMAT_YVYU422 > #define R200_TXFORMAT_YCBCR_REV R200_TXFORMAT_VYUY422 >+#define R200_TXFORMAT_RGB_DXT1 R200_TXFORMAT_DXT1 >+#define R200_TXFORMAT_RGBA_DXT1 R200_TXFORMAT_DXT1 >+#define R200_TXFORMAT_RGBA_DXT3 R200_TXFORMAT_DXT23 >+#define R200_TXFORMAT_RGBA_DXT5 R200_TXFORMAT_DXT45 > > #define _COLOR(f) \ > [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, 0 } >@@ -66,7 +70,7 @@ > [ MESA_FORMAT_ ## f ] = { R200_TXFORMAT_ ## f, R200_YUV_TO_RGB } > #define _INVALID(f) \ > [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 } >-#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_YCBCR_REV) \ >+#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5) \ > && (tx_table[f].format != 0xffffffff) ) > > static const struct { >@@ -93,6 +97,12 @@ > _INVALID(CI8), > _YUV(YCBCR), > _YUV(YCBCR_REV), >+ _INVALID(RGB_FXT1), >+ _INVALID(RGBA_FXT1), >+ _COLOR(RGB_DXT1), >+ _ALPHA(RGBA_DXT1), >+ _ALPHA(RGBA_DXT3), >+ _ALPHA(RGBA_DXT5), > }; > > #undef _COLOR >@@ -165,7 +175,24 @@ > > /* find image size in bytes */ > if (texImage->IsCompressed) { >- size = texImage->CompressedSize; >+ /* need to calculate the size AFTER padding even though the texture is >+ submitted without padding. >+ Only handle pot textures currently - don't know if npot is even possible, >+ size calculation would certainly need (trivial) adjustments. >+ Align (and later pad) to 32byte, not sure what that 64byte blit width is >+ good for? */ >+ if ((t->pp_txformat & R200_TXFORMAT_FORMAT_MASK) == R200_TXFORMAT_DXT1) { >+ /* RGB_DXT1/RGBA_DXT1, 8 bytes per block */ >+ if ((texImage->Width + 3) < 8) /* width one block */ >+ size = texImage->CompressedSize * 4; >+ else if ((texImage->Width + 3) < 16) >+ size = texImage->CompressedSize * 2; >+ else size = texImage->CompressedSize; >+ } >+ else /* DXT3/5, 16 bytes per block */ >+ if ((texImage->Width + 3) < 8) >+ size = texImage->CompressedSize * 2; >+ else size = texImage->CompressedSize; > } > else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) { > size = ((texImage->Width * texImage->TexFormat->TexelBytes + 63) >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.c xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.c 2004-07-22 01:51:51.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_context.c 2004-09-27 20:21:56.588828269 -0500 >@@ -329,6 +329,10 @@ > 12, > GL_FALSE ); > >+/* adjust max texture size a bit. Hack, but I really want to use larger textures >+ which will work just fine in 99.999999% of all cases, especially with texture compression... */ >+ if (ctx->Const.MaxTextureLevels < 12) ctx->Const.MaxTextureLevels += 1; >+ > ctx->Const.MaxTextureMaxAnisotropy = 16.0; > > /* No wide points. >@@ -397,6 +401,13 @@ > _math_matrix_set_identity( &rmesa->tmpmat ); > > driInitExtensions( ctx, card_extensions, GL_TRUE ); >+ if (rmesa->glCtx->Mesa_DXTn) { >+ _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); >+ _mesa_enable_extension( ctx, "GL_S3_s3tc" ); >+ } >+ else if (driQueryOptionb (&rmesa->optionCache, "force_s3tc_enable")) { >+ _mesa_enable_extension( ctx, "GL_EXT_texture_compression_s3tc" ); >+ } > > if (rmesa->dri.drmMinor >= 9) > _mesa_enable_extension( ctx, "GL_NV_texture_rectangle"); >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c 2004-07-22 01:51:52.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_screen.c 2004-09-27 20:22:43.009575487 -0500 >@@ -65,6 +65,7 @@ > DRI_CONF_TEXTURE_DEPTH(DRI_CONF_TEXTURE_DEPTH_FB) > DRI_CONF_DEF_MAX_ANISOTROPY(1.0,"1.0,2.0,4.0,8.0,16.0") > DRI_CONF_NO_NEG_LOD_BIAS(false) >+ DRI_CONF_FORCE_S3TC_ENABLE(false) > DRI_CONF_COLOR_REDUCTION(DRI_CONF_COLOR_REDUCTION_DITHER) > DRI_CONF_ROUND_MODE(DRI_CONF_ROUND_TRUNC) > DRI_CONF_DITHER_MODE(DRI_CONF_DITHER_XERRORDIFF) >@@ -73,7 +74,7 @@ > DRI_CONF_NO_RAST(false) > DRI_CONF_SECTION_END > DRI_CONF_END; >-static const GLuint __driNConfigOptions = 10; >+static const GLuint __driNConfigOptions = 11; > > #if 1 > /* Including xf86PciInfo.h introduces a bunch of errors... >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.c xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.c 2004-07-22 01:51:55.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_tex.c 2004-09-27 20:29:22.356357041 -0500 >@@ -382,6 +382,36 @@ > else > return &_mesa_texformat_ycbcr_rev; > >+ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: >+ return &_mesa_texformat_rgb_dxt1; >+ >+ case GL_RGB_S3TC: >+ case GL_RGB4_S3TC: >+ /* only return this format if software compression/decompression is available, since >+ no app will ever use this for precompressed textures */ >+/* if (ctx->Mesa_DXTn) */ >+ return &_mesa_texformat_rgb_dxt1; >+/* else */ >+ /* mesa will crash if we return uncompressed format unfortunately */ >+/* return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_rgb565; */ >+ >+ case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: >+ return &_mesa_texformat_rgba_dxt1; >+ >+ case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: >+ return &_mesa_texformat_rgba_dxt3; >+ >+ case GL_RGBA_S3TC: >+ case GL_RGBA4_S3TC: >+/* if (ctx->Mesa_DXTn) */ >+ return &_mesa_texformat_rgba_dxt3; >+/* else */ >+ /* mesa will crash if we return uncompressed format unfortunately */ >+/* return do32bpt ? &_mesa_texformat_rgba8888 : &_mesa_texformat_argb4444; */ >+ >+ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: >+ return &_mesa_texformat_rgba_dxt5; >+ > default: > _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__); > return NULL; >@@ -544,7 +574,94 @@ > t->dirty_images[face] |= (1 << level); > } > >+static void radeonCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, >+ GLint internalFormat, >+ GLint width, GLint height, GLint border, >+ GLsizei imageSize, const GLvoid *data, >+ struct gl_texture_object *texObj, >+ struct gl_texture_image *texImage ) >+{ >+ driTextureObject * t = (driTextureObject *) texObj->DriverData; >+ GLuint face; >+ >+ /* which cube face or ordinary 2D image */ >+ switch (target) { >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: >+ face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X; >+ ASSERT(face < 6); >+ break; >+ default: >+ face = 0; >+ } >+ >+ if ( t != NULL ) { >+ driSwapOutTextureObject( t ); >+ } >+ else { >+ t = (driTextureObject *) radeonAllocTexObj( texObj ); >+ if (!t) { >+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); >+ return; >+ } >+ } >+ >+ /* Note, this will call ChooseTextureFormat */ >+ _mesa_store_compressed_teximage2d(ctx, target, level, internalFormat, width, >+ height, border, imageSize, data, texObj, texImage); >+ >+ t->dirty_images[face] |= (1 << level); >+} >+ >+ >+static void radeonCompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint level, >+ GLint xoffset, GLint yoffset, >+ GLsizei width, GLsizei height, >+ GLenum format, >+ GLsizei imageSize, const GLvoid *data, >+ struct gl_texture_object *texObj, >+ struct gl_texture_image *texImage ) >+{ >+ driTextureObject * t = (driTextureObject *) texObj->DriverData; >+ GLuint face; >+ >+ >+ /* which cube face or ordinary 2D image */ >+ switch (target) { >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: >+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: >+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: >+ face = (GLuint) target - (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X; >+ ASSERT(face < 6); >+ break; >+ default: >+ face = 0; >+ } >+ >+ assert( t ); /* this _should_ be true */ >+ if ( t ) { >+ driSwapOutTextureObject( t ); >+ } >+ else { >+ t = (driTextureObject *) radeonAllocTexObj( texObj ); >+ if (!t) { >+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2D"); >+ return; >+ } >+ } >+ >+ _mesa_store_compressed_texsubimage2d(ctx, target, level, xoffset, yoffset, width, >+ height, format, imageSize, data, texObj, texImage); > >+ t->dirty_images[face] |= (1 << level); >+} > > #define SCALED_FLOAT_TO_BYTE( x, scale ) \ > (((GLuint)((255.0F / scale) * (x))) / 2) >@@ -756,5 +873,8 @@ > functions->TexParameter = radeonTexParameter; > functions->TexGen = radeonTexGen; > >+ functions->CompressedTexImage2D = radeonCompressedTexImage2D; >+ functions->CompressedTexSubImage2D = radeonCompressedTexSubImage2D; >+ > driInitTextureFormats(); > } >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texmem.c xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texmem.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texmem.c 2004-06-16 04:18:23.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texmem.c 2004-09-27 20:30:23.271341055 -0500 >@@ -259,10 +259,21 @@ > tex.height = imageHeight; > } > else { >- tex.width = imageWidth; /* compressed */ >- tex.height = imageHeight; >- if (tex.height < 4) >- tex.height = 4; >+ /* In case of for instance 8x8 texture (2x2 dxt blocks), padding after the first two blocks is >+ needed (only with dxt1 since 2 dxt3/dxt5 blocks already use 32 Byte). */ >+ /* set tex.height to 1/4 since 1 "macropixel" (dxt-block) has 4 real pixels. Needed >+ so the kernel module reads the right amount of data. */ >+ tex.height = (imageHeight + 3) / 4; >+ tex.width = (imageWidth + 3) / 4; >+ switch (t->pp_txformat & RADEON_TXFORMAT_FORMAT_MASK) { >+ case RADEON_TXFORMAT_DXT1: >+ tex.width *= 8; >+ break; >+ case RADEON_TXFORMAT_DXT23: >+ case RADEON_TXFORMAT_DXT45: >+ tex.width *= 16; >+ break; >+ } > } > tex.image = &tmp; > >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texstate.c xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texstate.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texstate.c 2004-07-22 01:51:55.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/drivers/dri/radeon/radeon_texstate.c 2004-09-27 20:32:40.877125001 -0500 >@@ -55,6 +55,10 @@ > #define RADEON_TXFORMAT_AL88 RADEON_TXFORMAT_AI88 > #define RADEON_TXFORMAT_YCBCR RADEON_TXFORMAT_YVYU422 > #define RADEON_TXFORMAT_YCBCR_REV RADEON_TXFORMAT_VYUY422 >+#define RADEON_TXFORMAT_RGB_DXT1 RADEON_TXFORMAT_DXT1 >+#define RADEON_TXFORMAT_RGBA_DXT1 RADEON_TXFORMAT_DXT1 >+#define RADEON_TXFORMAT_RGBA_DXT3 RADEON_TXFORMAT_DXT23 >+#define RADEON_TXFORMAT_RGBA_DXT5 RADEON_TXFORMAT_DXT45 > > #define _COLOR(f) \ > [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f, 0 } >@@ -68,7 +72,7 @@ > [ MESA_FORMAT_ ## f ] = { RADEON_TXFORMAT_ ## f, RADEON_YUV_TO_RGB } > #define _INVALID(f) \ > [ MESA_FORMAT_ ## f ] = { 0xffffffff, 0 } >-#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_YCBCR_REV) \ >+#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5) \ > && (tx_table[f].format != 0xffffffff) ) > > static const struct { >@@ -95,6 +99,12 @@ > _INVALID(CI8), > _YUV(YCBCR), > _YUV(YCBCR_REV), >+ _INVALID(RGB_FXT1), >+ _INVALID(RGBA_FXT1), >+ _COLOR(RGB_DXT1), >+ _ALPHA(RGBA_DXT1), >+ _ALPHA(RGBA_DXT3), >+ _ALPHA(RGBA_DXT5), > }; > > #undef _COLOR >@@ -167,7 +177,24 @@ > > /* find image size in bytes */ > if (texImage->IsCompressed) { >- size = texImage->CompressedSize; >+ /* need to calculate the size AFTER padding even though the texture is >+ submitted without padding. >+ Only handle pot textures currently - don't know if npot is even possible, >+ size calculation would certainly need (trivial) adjustments. >+ Align (and later pad) to 32byte, not sure what that 64byte blit width is >+ good for? */ >+ if ((t->pp_txformat & RADEON_TXFORMAT_FORMAT_MASK) == RADEON_TXFORMAT_DXT1) { >+ /* RGB_DXT1/RGBA_DXT1, 8 bytes per block */ >+ if ((texImage->Width + 3) < 8) /* width one block */ >+ size = texImage->CompressedSize * 4; >+ else if ((texImage->Width + 3) < 16) >+ size = texImage->CompressedSize * 2; >+ else size = texImage->CompressedSize; >+ } >+ else /* DXT3/5, 16 bytes per block */ >+ if ((texImage->Width + 3) < 8) >+ size = texImage->CompressedSize * 2; >+ else size = texImage->CompressedSize; > } > else if (tObj->Target == GL_TEXTURE_RECTANGLE_NV) { > size = ((texImage->Width * texImage->TexFormat->TexelBytes + 63) >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/main/mtypes.h xc/extras/Mesa/src/mesa/main/mtypes.h >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/main/mtypes.h 2004-07-22 01:53:00.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/main/mtypes.h 2004-09-27 20:33:08.087183962 -0500 >@@ -2386,6 +2386,9 @@ > /** Dither disable via MESA_NO_DITHER env var */ > GLboolean NoDither; > >+ /** software compression/decompression supported or not */ >+ GLboolean Mesa_DXTn; >+ > /** Core tnl module support */ > struct gl_tnl_module TnlModule; > >diff -burN /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/main/texcompress_s3tc.c xc/extras/Mesa/src/mesa/main/texcompress_s3tc.c >--- /var/tmp/portage/xorg-x11-6.8.0-r1/work/xc/extras/Mesa/src/mesa/main/texcompress_s3tc.c 2004-06-16 04:19:15.000000000 -0500 >+++ xc/extras/Mesa/src/mesa/main/texcompress_s3tc.c 2004-09-27 20:44:58.622701077 -0500 >@@ -28,6 +28,11 @@ > * GL_EXT_texture_compression_s3tc support. > */ > >+#if defined(XFree86LOADER) && defined(IN_MODULE) >+#define USE_EXTERNAL_DXTN_LIB 0 >+#else >+#define USE_EXTERNAL_DXTN_LIB 1 >+#endif > > #include "glheader.h" > #include "imports.h" >@@ -39,12 +44,76 @@ > #include "texformat.h" > #include "texstore.h" > >+#if USE_EXTERNAL_DXTN_LIB >+#include <dlfcn.h> >+#endif >+ >+typedef void (*dxtFetchTexelFuncExt)( GLint srcRowstride, GLubyte *pixdata, GLint col, GLint row, GLvoid *texelOut ); >+dxtFetchTexelFuncExt fetch_ext_rgb_dxt1; >+dxtFetchTexelFuncExt fetch_ext_rgba_dxt1; >+dxtFetchTexelFuncExt fetch_ext_rgba_dxt3; >+dxtFetchTexelFuncExt fetch_ext_rgba_dxt5; > >+typedef void (*dxtCompressTexFuncExt)(GLint srccomps, GLint width, GLint height, const GLubyte *srcPixData, GLenum destformat, GLubyte *dest); >+dxtCompressTexFuncExt ext_tx_compress_dxtn; >+ >+void *dxtlibhandle = NULL; > > void > _mesa_init_texture_s3tc( GLcontext *ctx ) > { > /* called during context initialization */ >+ ctx->Mesa_DXTn = GL_FALSE; >+#if USE_EXTERNAL_DXTN_LIB >+ if (!dxtlibhandle) { >+ char *error; >+ >+ dxtlibhandle = dlopen ("libtxc_dxtn.so", RTLD_LAZY | RTLD_GLOBAL); >+ if (!dxtlibhandle) { >+ _mesa_debug(ctx, "couldn't open libtxc_dxtn.so, " >+ "software DXTn compression/decompression unavailable\n"); >+ } >+ else { >+ /* the fetch functions are not per context! Might be problematic... */ >+ fetch_ext_rgb_dxt1 = dlsym(dxtlibhandle, "fetch_2d_texel_rgb_dxt1"); >+ error = dlerror(); >+ if (error == NULL) { >+ fetch_ext_rgba_dxt1 = dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt1"); >+ error = dlerror(); >+ } >+ if (error == NULL) { >+ fetch_ext_rgba_dxt3 = dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt3"); >+ error = dlerror(); >+ } >+ if (error == NULL) { >+ fetch_ext_rgba_dxt5 = dlsym(dxtlibhandle, "fetch_2d_texel_rgba_dxt5"); >+ error = dlerror(); >+ } >+ if (error == NULL) { >+ ext_tx_compress_dxtn = dlsym(dxtlibhandle, "tx_compress_dxtn"); >+ error = dlerror(); >+ } >+ >+ if (error) { >+ _mesa_debug(ctx, "couldn't reference all symbols in libtxc_dxtn.so, " >+ "software DXTn compression/decompression unavailable\n"); >+ fetch_ext_rgb_dxt1 = NULL; >+ fetch_ext_rgba_dxt1 = NULL; >+ fetch_ext_rgba_dxt3 = NULL; >+ fetch_ext_rgba_dxt5 = NULL; >+ ext_tx_compress_dxtn = NULL; >+ dlclose(dxtlibhandle); >+ dxtlibhandle = NULL; >+ } >+ } >+ } >+ if (dxtlibhandle) { >+ ctx->Mesa_DXTn = GL_TRUE; >+ _mesa_debug(ctx, "software DXTn compression/decompression available\n"); >+ } >+#else >+ (void) ctx; >+#endif > } > > >@@ -93,10 +162,12 @@ > GL_COMPRESSED_RGB_S3TC_DXT1_EXT, > texWidth, (GLubyte *) dstAddr); > >-#if 0 >- compress_dxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride, >- dst, dstRowStride); >-#endif >+ if (ext_tx_compress_dxtn) { >+ (*ext_tx_compress_dxtn)(3, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, dst); >+ } >+ else { >+ _mesa_problem(ctx, "external dxt library not available"); >+ } > > if (tempImage) > _mesa_free((void *) tempImage); >@@ -149,10 +220,13 @@ > dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, > GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, > texWidth, (GLubyte *) dstAddr); >-#if 0 >- compress_dxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride, >- dst, dstRowStride); >-#endif >+ if (ext_tx_compress_dxtn) { >+ (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, dst); >+ } >+ else { >+ _mesa_problem(ctx, "external dxt library not available"); >+ } >+ > if (tempImage) > _mesa_free((void*) tempImage); > >@@ -203,10 +277,13 @@ > dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, > GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, > texWidth, (GLubyte *) dstAddr); >-#if 0 >- compress_rgba_dxt3(ctx, srcWidth, srcHeight, pixels, >- srcRowStride, dst, dstRowStride); >-#endif >+ if (ext_tx_compress_dxtn) { >+ (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, dst); >+ } >+ else { >+ _mesa_problem(ctx, "external dxt library not available"); >+ } >+ > if (tempImage) > _mesa_free((void *) tempImage); > >@@ -257,10 +334,13 @@ > dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, > GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, > texWidth, (GLubyte *) dstAddr); >-#if 0 >- compress_rgba_dxt5(ctx, srcWidth, srcHeight, pixels, >- srcRowStride, dst, dstRowStride); >-#endif >+ if (ext_tx_compress_dxtn) { >+ (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, dst); >+ } >+ else { >+ _mesa_problem(ctx, "external dxt library not available"); >+ } >+ > if (tempImage) > _mesa_free((void *) tempImage); > >@@ -272,6 +352,12 @@ > fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage, > GLint i, GLint j, GLint k, GLchan *texel ) > { >+ (void) k; >+ if (fetch_ext_rgb_dxt1) { >+ ASSERT (sizeof(GLchan) == sizeof(GLubyte)); >+ (*fetch_ext_rgb_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel); >+ } >+ else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); > } > > >@@ -293,6 +379,11 @@ > fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage, > GLint i, GLint j, GLint k, GLchan *texel ) > { >+ (void) k; >+ if (fetch_ext_rgba_dxt1) { >+ (*fetch_ext_rgba_dxt1)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel); >+ } >+ else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); > } > > >@@ -314,6 +405,12 @@ > fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage, > GLint i, GLint j, GLint k, GLchan *texel ) > { >+ (void) k; >+ if (fetch_ext_rgba_dxt3) { >+ ASSERT (sizeof(GLchan) == sizeof(GLubyte)); >+ (*fetch_ext_rgba_dxt3)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel); >+ } >+ else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); > } > > >@@ -335,6 +432,11 @@ > fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage, > GLint i, GLint j, GLint k, GLchan *texel ) > { >+ (void) k; >+ if (fetch_ext_rgba_dxt5) { >+ (*fetch_ext_rgba_dxt5)((texImage)->RowStride, (GLubyte *)(texImage)->Data, i, j, texel); >+ } >+ else _mesa_debug(NULL, "attempted to decode s3tc texture without library available\n"); > } > >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 65621
: 40575 |
40576