aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/texcompress_rgtc.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-09-21 18:11:28 +0200
committermarha <marha@users.sourceforge.net>2014-09-21 18:11:28 +0200
commit438af0c7d4bf60b408b259c88205ff2193195466 (patch)
tree46fd6465cb7431f64a3cb475a40587a261983af4 /mesalib/src/mesa/main/texcompress_rgtc.c
parentd0f70707dde032e662dbd5bc70df6ac915403abe (diff)
downloadvcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.tar.gz
vcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.tar.bz2
vcxsrv-438af0c7d4bf60b408b259c88205ff2193195466.zip
libxtrans xkeyboard-config xserver mesa plink glproto git update 21 Sep 2014
plink revision 10233 xserver commit 28337cb14e4347e1dd7936c5393a22e042866687 xkeyboard-config commit 48e1c0b351b6711edc0f167cbb81e4424b75291a glproto commit bd3d751e1eb17efb39f65093271bb4ac071aa9e0 libxtrans commit fb7f198c88e97d22c8c89e76e9cd06b2b2720a96 mesa commit 4eb2bbefd2bf0359aff7ebbb8e931a1c7833606f
Diffstat (limited to 'mesalib/src/mesa/main/texcompress_rgtc.c')
-rw-r--r--mesalib/src/mesa/main/texcompress_rgtc.c79
1 files changed, 19 insertions, 60 deletions
diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c
index 1012699f5..f7ee24d47 100644
--- a/mesalib/src/mesa/main/texcompress_rgtc.c
+++ b/mesalib/src/mesa/main/texcompress_rgtc.c
@@ -40,23 +40,10 @@
#include "macros.h"
#include "mipmap.h"
#include "texcompress.h"
+#include "util/rgtc.h"
#include "texcompress_rgtc.h"
#include "texstore.h"
-
-#define RGTC_DEBUG 0
-
-static void unsigned_encode_rgtc_ubyte(GLubyte *blkaddr, GLubyte srccolors[4][4],
- GLint numxpixels, GLint numypixels);
-static void signed_encode_rgtc_ubyte(GLbyte *blkaddr, GLbyte srccolors[4][4],
- GLint numxpixels, GLint numypixels);
-
-static void unsigned_fetch_texel_rgtc(unsigned srcRowStride, const GLubyte *pixdata,
- unsigned i, unsigned j, GLubyte *value, unsigned comps);
-
-static void signed_fetch_texel_rgtc(unsigned srcRowStride, const GLbyte *pixdata,
- unsigned i, unsigned j, GLbyte *value, unsigned comps);
-
static void extractsrc_u( GLubyte srcpixels[4][4], const GLubyte *srcaddr,
GLint srcRowStride, GLint numxpixels, GLint numypixels, GLint comps)
{
@@ -121,7 +108,7 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS)
if (srcWidth > i + 3) numxpixels = 4;
else numxpixels = srcWidth - i;
extractsrc_u(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 1);
- unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
srcaddr += numxpixels;
blkaddr += 8;
}
@@ -168,7 +155,7 @@ _mesa_texstore_signed_red_rgtc1(TEXSTORE_PARAMS)
if (srcWidth > i + 3) numxpixels = 4;
else numxpixels = srcWidth - i;
extractsrc_s(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 1);
- signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
srcaddr += numxpixels;
blkaddr += 8;
}
@@ -216,11 +203,11 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS)
if (srcWidth > i + 3) numxpixels = 4;
else numxpixels = srcWidth - i;
extractsrc_u(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 2);
- unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
extractsrc_u(srcpixels, (GLubyte *)srcaddr + 1, srcWidth, numxpixels, numypixels, 2);
- unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
@@ -271,11 +258,11 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
else numxpixels = srcWidth - i;
extractsrc_s(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 2);
- signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
extractsrc_s(srcpixels, srcaddr + 1, srcWidth, numxpixels, numypixels, 2);
- signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
+ util_format_signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
srcaddr += numxpixels * 2;
@@ -289,40 +276,12 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
return GL_TRUE;
}
-
-#define TAG(x) unsigned_##x
-
-#define TYPE GLubyte
-#define T_MIN 0
-#define T_MAX 0xff
-
-#include "texcompress_rgtc_tmp.h"
-
-#undef TAG
-#undef TYPE
-#undef T_MIN
-#undef T_MAX
-
-#define TAG(x) signed_##x
-#define TYPE GLbyte
-#define T_MIN (GLbyte)-128
-#define T_MAX (GLbyte)127
-
-#include "texcompress_rgtc_tmp.h"
-
-#undef TAG
-#undef TYPE
-#undef T_MIN
-#undef T_MAX
-
-
-
static void
fetch_red_rgtc1(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red;
- unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1);
+ util_format_unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1);
texel[RCOMP] = UBYTE_TO_FLOAT(red);
texel[GCOMP] = 0.0;
texel[BCOMP] = 0.0;
@@ -334,7 +293,7 @@ fetch_l_latc1(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red;
- unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1);
+ util_format_unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1);
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = UBYTE_TO_FLOAT(red);
@@ -346,7 +305,7 @@ fetch_signed_red_rgtc1(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red;
- signed_fetch_texel_rgtc(rowStride, (const GLbyte *) map,
+ util_format_signed_fetch_texel_rgtc(rowStride, (const GLbyte *) map,
i, j, &red, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
texel[GCOMP] = 0.0;
@@ -359,7 +318,7 @@ fetch_signed_l_latc1(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red;
- signed_fetch_texel_rgtc(rowStride, (GLbyte *) map,
+ util_format_signed_fetch_texel_rgtc(rowStride, (GLbyte *) map,
i, j, &red, 1);
texel[RCOMP] =
texel[GCOMP] =
@@ -372,10 +331,10 @@ fetch_rg_rgtc2(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red, green;
- unsigned_fetch_texel_rgtc(rowStride,
+ util_format_unsigned_fetch_texel_rgtc(rowStride,
map,
i, j, &red, 2);
- unsigned_fetch_texel_rgtc(rowStride,
+ util_format_unsigned_fetch_texel_rgtc(rowStride,
map + 8,
i, j, &green, 2);
texel[RCOMP] = UBYTE_TO_FLOAT(red);
@@ -389,10 +348,10 @@ fetch_la_latc2(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red, green;
- unsigned_fetch_texel_rgtc(rowStride,
+ util_format_unsigned_fetch_texel_rgtc(rowStride,
map,
i, j, &red, 2);
- unsigned_fetch_texel_rgtc(rowStride,
+ util_format_unsigned_fetch_texel_rgtc(rowStride,
map + 8,
i, j, &green, 2);
texel[RCOMP] =
@@ -407,10 +366,10 @@ fetch_signed_rg_rgtc2(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red, green;
- signed_fetch_texel_rgtc(rowStride,
+ util_format_signed_fetch_texel_rgtc(rowStride,
(GLbyte *) map,
i, j, &red, 2);
- signed_fetch_texel_rgtc(rowStride,
+ util_format_signed_fetch_texel_rgtc(rowStride,
(GLbyte *) map + 8,
i, j, &green, 2);
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
@@ -425,10 +384,10 @@ fetch_signed_la_latc2(const GLubyte *map,
GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red, green;
- signed_fetch_texel_rgtc(rowStride,
+ util_format_signed_fetch_texel_rgtc(rowStride,
(GLbyte *) map,
i, j, &red, 2);
- signed_fetch_texel_rgtc(rowStride,
+ util_format_signed_fetch_texel_rgtc(rowStride,
(GLbyte *) map + 8,
i, j, &green, 2);
texel[RCOMP] =