[Mesa-dev] [PATCH 05/15] mesa/gallium: remove GLchan from latc, rgtc code
Brian Paul
brian.e.paul at gmail.com
Sat Sep 17 15:41:18 PDT 2011
From: Brian Paul <brianp at vmware.com>
---
src/gallium/auxiliary/util/u_format_latc.c | 8 ++++----
src/gallium/auxiliary/util/u_format_rgtc.c | 22 +++++++++++-----------
src/mesa/main/texcompress_rgtc.c | 28 ++++++++++++++--------------
src/mesa/main/texcompress_rgtc_tmp.h | 2 +-
4 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_format_latc.c b/src/gallium/auxiliary/util/u_format_latc.c
index e84c493..2b34c71 100644
--- a/src/gallium/auxiliary/util/u_format_latc.c
+++ b/src/gallium/auxiliary/util/u_format_latc.c
@@ -27,13 +27,13 @@
#include "u_format_rgtc.h"
#include "u_format_latc.h"
-static void u_format_unsigned_encode_rgtc_chan(uint8_t *blkaddr, uint8_t srccolors[4][4],
+static void u_format_unsigned_encode_rgtc_ubyte(uint8_t *blkaddr, uint8_t srccolors[4][4],
int numxpixels, int numypixels);
static void u_format_unsigned_fetch_texel_rgtc(unsigned srcRowStride, const uint8_t *pixdata,
unsigned i, unsigned j, uint8_t *value, unsigned comps);
-static void u_format_signed_encode_rgtc_chan(int8_t *blkaddr, int8_t srccolors[4][4],
+static void u_format_signed_encode_rgtc_ubyte(int8_t *blkaddr, int8_t srccolors[4][4],
int numxpixels, int numypixels);
static void u_format_signed_fetch_texel_rgtc(unsigned srcRowStride, const int8_t *pixdata,
@@ -43,8 +43,8 @@ void
util_format_latc1_unorm_fetch_rgba_8unorm(uint8_t *dst, const uint8_t *src, unsigned i, unsigned j)
{
/* Fix warnings here: */
- (void) u_format_unsigned_encode_rgtc_chan;
- (void) u_format_signed_encode_rgtc_chan;
+ (void) u_format_unsigned_encode_rgtc_ubyte;
+ (void) u_format_signed_encode_rgtc_ubyte;
u_format_unsigned_fetch_texel_rgtc(0, src, i, j, dst, 1);
}
diff --git a/src/gallium/auxiliary/util/u_format_rgtc.c b/src/gallium/auxiliary/util/u_format_rgtc.c
index c929fd4..2371bab 100644
--- a/src/gallium/auxiliary/util/u_format_rgtc.c
+++ b/src/gallium/auxiliary/util/u_format_rgtc.c
@@ -26,13 +26,13 @@
#include "u_format.h"
#include "u_format_rgtc.h"
-static void u_format_unsigned_encode_rgtc_chan(uint8_t *blkaddr, uint8_t srccolors[4][4],
+static void u_format_unsigned_encode_rgtc_ubyte(uint8_t *blkaddr, uint8_t srccolors[4][4],
int numxpixels, int numypixels);
static void u_format_unsigned_fetch_texel_rgtc(unsigned srcRowStride, const uint8_t *pixdata,
unsigned i, unsigned j, uint8_t *value, unsigned comps);
-static void u_format_signed_encode_rgtc_chan(int8_t *blkaddr, int8_t srccolors[4][4],
+static void u_format_signed_encode_rgtc_ubyte(int8_t *blkaddr, int8_t srccolors[4][4],
int numxpixels, int numypixels);
static void u_format_signed_fetch_texel_rgtc(unsigned srcRowStride, const int8_t *pixdata,
@@ -82,7 +82,7 @@ util_format_rgtc1_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
tmp[j][i] = src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4];
}
}
- u_format_unsigned_encode_rgtc_chan(dst, tmp, 4, 4);
+ u_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
@@ -129,7 +129,7 @@ util_format_rgtc1_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
tmp[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
}
}
- u_format_unsigned_encode_rgtc_chan(dst, tmp, 4, 4);
+ u_format_unsigned_encode_rgtc_ubyte(dst, tmp, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
@@ -180,7 +180,7 @@ util_format_rgtc1_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
tmp[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4]);
}
}
- u_format_signed_encode_rgtc_chan(dst, tmp, 4, 4);
+ u_format_signed_encode_rgtc_ubyte(dst, tmp, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
@@ -272,8 +272,8 @@ util_format_rgtc2_unorm_pack_rgba_8unorm(uint8_t *dst_row, unsigned dst_stride,
tmp_g[j][i] = src_row[((y + j)*src_stride/sizeof(*src_row) + (x + i)*4) + 1];
}
}
- u_format_unsigned_encode_rgtc_chan(dst, tmp_r, 4, 4);
- u_format_unsigned_encode_rgtc_chan(dst + 8, tmp_g, 4, 4);
+ u_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
+ u_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
@@ -297,8 +297,8 @@ util_format_rxtc2_unorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
tmp_g[j][i] = float_to_ubyte(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
}
}
- u_format_unsigned_encode_rgtc_chan(dst, tmp_r, 4, 4);
- u_format_unsigned_encode_rgtc_chan(dst + 8, tmp_g, 4, 4);
+ u_format_unsigned_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
+ u_format_unsigned_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
@@ -411,8 +411,8 @@ util_format_rxtc2_snorm_pack_rgba_float(uint8_t *dst_row, unsigned dst_stride, c
tmp_g[j][i] = float_to_byte_tex(src_row[(y + j)*src_stride/sizeof(*src_row) + (x + i)*4 + chan2off]);
}
}
- u_format_signed_encode_rgtc_chan(dst, tmp_r, 4, 4);
- u_format_signed_encode_rgtc_chan(dst + 8, tmp_g, 4, 4);
+ u_format_signed_encode_rgtc_ubyte(dst, tmp_r, 4, 4);
+ u_format_signed_encode_rgtc_ubyte(dst + 8, tmp_g, 4, 4);
dst += bytes_per_block;
}
dst_row += dst_stride / sizeof(*dst_row);
diff --git a/src/mesa/main/texcompress_rgtc.c b/src/mesa/main/texcompress_rgtc.c
index f18a966..398f612 100644
--- a/src/mesa/main/texcompress_rgtc.c
+++ b/src/mesa/main/texcompress_rgtc.c
@@ -48,9 +48,9 @@
#define RGTC_DEBUG 0
-static void unsigned_encode_rgtc_chan(GLubyte *blkaddr, GLubyte srccolors[4][4],
+static void unsigned_encode_rgtc_ubyte(GLubyte *blkaddr, GLubyte srccolors[4][4],
GLint numxpixels, GLint numypixels);
-static void signed_encode_rgtc_chan(GLbyte *blkaddr, GLbyte srccolors[4][4],
+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,
@@ -59,15 +59,15 @@ static void unsigned_fetch_texel_rgtc(unsigned srcRowStride, const GLubyte *pixd
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 GLchan *srcaddr,
+static void extractsrc_u( GLubyte srcpixels[4][4], const GLubyte *srcaddr,
GLint srcRowStride, GLint numxpixels, GLint numypixels, GLint comps)
{
GLubyte i, j;
- const GLchan *curaddr;
+ const GLubyte *curaddr;
for (j = 0; j < numypixels; j++) {
curaddr = srcaddr + j * srcRowStride * comps;
for (i = 0; i < numxpixels; i++) {
- srcpixels[j][i] = *curaddr / (CHAN_MAX / 255);
+ srcpixels[j][i] = *curaddr;
curaddr += comps;
}
}
@@ -96,7 +96,7 @@ _mesa_texstore_red_rgtc1(TEXSTORE_PARAMS)
const GLubyte *tempImage = NULL;
int i, j;
int numxpixels, numypixels;
- const GLchan *srcaddr;
+ const GLubyte *srcaddr;
GLubyte srcpixels[4][4];
GLubyte *blkaddr;
GLint dstRowDiff;
@@ -132,7 +132,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_chan(blkaddr, srcpixels, numxpixels, numypixels);
+ unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
srcaddr += numxpixels;
blkaddr += 8;
}
@@ -187,7 +187,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_chan(blkaddr, srcpixels, numxpixels, numypixels);
+ signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
srcaddr += numxpixels;
blkaddr += 8;
}
@@ -207,7 +207,7 @@ _mesa_texstore_rg_rgtc2(TEXSTORE_PARAMS)
const GLubyte *tempImage = NULL;
int i, j;
int numxpixels, numypixels;
- const GLchan *srcaddr;
+ const GLubyte *srcaddr;
GLubyte srcpixels[4][4];
GLubyte *blkaddr;
GLint dstRowDiff;
@@ -243,11 +243,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_chan(blkaddr, srcpixels, numxpixels, numypixels);
+ unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
- extractsrc_u(srcpixels, (GLchan *)srcaddr + 1, srcWidth, numxpixels, numypixels, 2);
- unsigned_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
+ extractsrc_u(srcpixels, (GLubyte *)srcaddr + 1, srcWidth, numxpixels, numypixels, 2);
+ unsigned_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
@@ -306,11 +306,11 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
else numxpixels = srcWidth - i;
extractsrc_s(srcpixels, srcaddr, srcWidth, numxpixels, numypixels, 2);
- signed_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
+ signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
extractsrc_s(srcpixels, srcaddr + 1, srcWidth, numxpixels, numypixels, 2);
- signed_encode_rgtc_chan(blkaddr, srcpixels, numxpixels, numypixels);
+ signed_encode_rgtc_ubyte(blkaddr, srcpixels, numxpixels, numypixels);
blkaddr += 8;
srcaddr += numxpixels * 2;
diff --git a/src/mesa/main/texcompress_rgtc_tmp.h b/src/mesa/main/texcompress_rgtc_tmp.h
index 48bbd37..277d69b 100644
--- a/src/mesa/main/texcompress_rgtc_tmp.h
+++ b/src/mesa/main/texcompress_rgtc_tmp.h
@@ -73,7 +73,7 @@ static void TAG(write_rgtc_encoded_channel)(TYPE *blkaddr,
*blkaddr++ = (alphaenc[13] >> 1) | (alphaenc[14] << 2) | (alphaenc[15] << 5);
}
-static void TAG(encode_rgtc_chan)(TYPE *blkaddr, TYPE srccolors[4][4],
+static void TAG(encode_rgtc_ubyte)(TYPE *blkaddr, TYPE srccolors[4][4],
int numxpixels, int numypixels)
{
TYPE alphabase[2], alphause[2];
--
1.7.3.4
More information about the mesa-dev
mailing list