Also do some minor header and coding style modifications to better fit into mesa. Note that this isn't actually used by anything just yet. --- src/mesa/main/txc_compress_dxtn.c | 28 +++++++++++-- src/mesa/main/txc_dxtn.h | 60 +++++++++++++++++----------- src/mesa/main/txc_fetch_dxtn.c | 79 +++++++++++++++++++++++++++++++------ src/mesa/sources.mak | 2 + 4 files changed, 129 insertions(+), 40 deletions(-)
diff --git a/src/mesa/main/txc_compress_dxtn.c b/src/mesa/main/txc_compress_dxtn.c index cf83d08..1683417 100644 --- a/src/mesa/main/txc_compress_dxtn.c +++ b/src/mesa/main/txc_compress_dxtn.c @@ -1,6 +1,6 @@ /* - * libtxc_dxtn - * Version: 1.0 + * Mesa 3-D graphics library + * Version: 7.11 * * Copyright (C) 2004 Roland Scheidegger All Rights Reserved. * @@ -26,6 +26,8 @@ #include <stdlib.h> #include "txc_dxtn.h" +#ifdef ENABLE_PATENTED + /* weights used for error function, basically weights (unsquared 2/4/1) according to rgb->luminance conversion not sure if this really reflects visual perception */ #define REDWEIGHT 4 @@ -755,8 +757,13 @@ static void extractsrccolors( GLubyte srcpixels[4][4][4], const GLchan *srcaddr, } -void tx_compress_dxtn(GLint srccomps, GLint width, GLint height, const GLubyte *srcPixData, - GLenum destFormat, GLubyte *dest, GLint dstRowStride) +void +tx_compress_dxtn(GLint srccomps, + GLint width, GLint height, + const GLubyte *srcPixData, + GLenum destFormat, + GLubyte *dest, + GLint dstRowStride) { GLubyte *blkaddr = dest; GLubyte srcpixels[4][4][4]; @@ -840,4 +847,17 @@ void tx_compress_dxtn(GLint srccomps, GLint width, GLint height, const GLubyte * } } +#else /* ENABLE_PATENTED */ + +void +tx_compress_dxtn(GLint srccomps, + GLint width, GLint height, + const GLubyte *srcPixData, + GLenum destFormat, + GLubyte *dest, + GLint dstRowStride) +{ + assert(0); +} +#endif /* ENABLE_PATENTED */ diff --git a/src/mesa/main/txc_dxtn.h b/src/mesa/main/txc_dxtn.h index cd1095b..24f2604 100644 --- a/src/mesa/main/txc_dxtn.h +++ b/src/mesa/main/txc_dxtn.h @@ -1,6 +1,6 @@ /* - * libtxc_dxtn - * Version: 1.0 + * Mesa 3-D graphics library + * Version: 7.11 * * Copyright (C) 2004 Roland Scheidegger All Rights Reserved. * @@ -25,27 +25,39 @@ #ifndef _TXC_DXTN_H #define _TXC_DXTN_H -#include <GL/gl.h> - -typedef GLubyte GLchan; -#define UBYTE_TO_CHAN(b) (b) -#define CHAN_MAX 255 -#define RCOMP 0 -#define GCOMP 1 -#define BCOMP 2 -#define ACOMP 3 - -void fetch_2d_texel_rgb_dxt1(GLint srcRowStride, const GLubyte *pixdata, - GLint i, GLint j, GLvoid *texel); -void fetch_2d_texel_rgba_dxt1(GLint srcRowStride, const GLubyte *pixdata, - GLint i, GLint j, GLvoid *texel); -void fetch_2d_texel_rgba_dxt3(GLint srcRowStride, const GLubyte *pixdata, - GLint i, GLint j, GLvoid *texel); -void fetch_2d_texel_rgba_dxt5(GLint srcRowStride, const GLubyte *pixdata, - GLint i, GLint j, GLvoid *texel); - -void tx_compress_dxtn(GLint srccomps, GLint width, GLint height, - const GLubyte *srcPixData, GLenum destformat, - GLubyte *dest, GLint dstRowStride); +#include "mtypes.h" +#include "colormac.h" + +void +fetch_2d_texel_rgb_dxt1(GLint srcRowStride, + const GLubyte *pixdata, + GLint i, GLint j, + GLvoid *texel); + +void +fetch_2d_texel_rgba_dxt1(GLint srcRowStride, + const GLubyte *pixdata, + GLint i,GLint j, + GLvoid *texel); + +void +fetch_2d_texel_rgba_dxt3(GLint srcRowStride, + const GLubyte *pixdata, + GLint i, GLint j, + GLvoid *texel); + +void +fetch_2d_texel_rgba_dxt5(GLint srcRowStride, + const GLubyte *pixdata, + GLint i, GLint j, + GLvoid *texel); + +void +tx_compress_dxtn(GLint srccomps, + GLint width, GLint height, + const GLubyte *srcPixData, + GLenum destformat, + GLubyte *dest, + GLint dstRowStride); #endif /* _TXC_DXTN_H */ diff --git a/src/mesa/main/txc_fetch_dxtn.c b/src/mesa/main/txc_fetch_dxtn.c index 7f0db56..9301699 100644 --- a/src/mesa/main/txc_fetch_dxtn.c +++ b/src/mesa/main/txc_fetch_dxtn.c @@ -1,6 +1,6 @@ /* - * libtxc_dxtn - * Version: 1.0 + * Mesa 3-D graphics library + * Version: 7.11 * * Copyright (C) 2004 Roland Scheidegger All Rights Reserved. * @@ -25,6 +25,8 @@ #include <stdio.h> #include "txc_dxtn.h" +#ifdef ENABLE_PATENTED + #define EXP5TO8R(packedcol) \ ((((packedcol) >> 8) & 0xf8) | (((packedcol) >> 13) & 0x7)) @@ -94,8 +96,11 @@ static void dxt135_decode_imageblock ( const GLubyte *img_block_src, } -void fetch_2d_texel_rgb_dxt1(GLint srcRowStride, const GLubyte *pixdata, - GLint i, GLint j, GLvoid *texel) +void +fetch_2d_texel_rgb_dxt1(GLint srcRowStride, + const GLubyte *pixdata, + GLint i, GLint j, + GLvoid *texel) { /* Extract the (i,j) pixel from pixdata and return it * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP]. @@ -106,8 +111,11 @@ void fetch_2d_texel_rgb_dxt1(GLint srcRowStride, const GLubyte *pixdata, } -void fetch_2d_texel_rgba_dxt1(GLint srcRowStride, const GLubyte *pixdata, - GLint i, GLint j, GLvoid *texel) +void +fetch_2d_texel_rgba_dxt1(GLint srcRowStride, + const GLubyte *pixdata, + GLint i, GLint j, + GLvoid *texel) { /* Extract the (i,j) pixel from pixdata and return it * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP]. @@ -117,9 +125,12 @@ void fetch_2d_texel_rgba_dxt1(GLint srcRowStride, const GLubyte *pixdata, dxt135_decode_imageblock(blksrc, (i&3), (j&3), 1, texel); } -void fetch_2d_texel_rgba_dxt3(GLint srcRowStride, const GLubyte *pixdata, - GLint i, GLint j, GLvoid *texel) { - +void +fetch_2d_texel_rgba_dxt3(GLint srcRowStride, + const GLubyte *pixdata, + GLint i, GLint j, + GLvoid *texel) +{ /* Extract the (i,j) pixel from pixdata and return it * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP]. */ @@ -148,9 +159,12 @@ void fetch_2d_texel_rgba_dxt3(GLint srcRowStride, const GLubyte *pixdata, } -void fetch_2d_texel_rgba_dxt5(GLint srcRowStride, const GLubyte *pixdata, - GLint i, GLint j, GLvoid *texel) { - +void +fetch_2d_texel_rgba_dxt5(GLint srcRowStride, + const GLubyte *pixdata, + GLint i, GLint j, + GLvoid *texel) +{ /* Extract the (i,j) pixel from pixdata and return it * in texel[RCOMP], texel[GCOMP], texel[BCOMP], texel[ACOMP]. */ @@ -241,3 +255,44 @@ void fetch_2d_texel_rgba_dxt5(GLint srcRowStride, const GLubyte *pixdata, rgba[ACOMP] = CHAN_MAX; #endif } + +#else /* ENABLE_PATENTED */ + +void +fetch_2d_texel_rgb_dxt1(GLint srcRowStride, + const GLubyte *pixdata, + GLint i, GLint j, + GLvoid *texel) +{ + assert(0); +} + + +void +fetch_2d_texel_rgba_dxt1(GLint srcRowStride, + const GLubyte *pixdata, + GLint i, GLint j, + GLvoid *texel) +{ + assert(0); +} + +void +fetch_2d_texel_rgba_dxt3(GLint srcRowStride, + const GLubyte *pixdata, + GLint i, GLint j, + GLvoid *texel) +{ + assert(0); +} + +void +fetch_2d_texel_rgba_dxt5(GLint srcRowStride, + const GLubyte *pixdata, + GLint i, GLint j, + GLvoid *texel) +{ + assert(0); +} + +#endif /* ENABLE_PATENTED */ diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index ae92e4d..cae3fbb 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -96,6 +96,8 @@ MAIN_SOURCES = \ main/texstate.c \ main/texstore.c \ main/transformfeedback.c \ + main/txc_compress_dxtn.c \ + main/txc_fetch_dxtn.c \ main/uniforms.c \ main/varray.c \ main/version.c \ -- 1.7.3.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev