summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texcompress_rgtc.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-04-19 11:44:53 -0700
committerEric Anholt <[email protected]>2013-04-30 10:40:43 -0700
commit0c883e46d871797cd1141498850d51cde6e54b76 (patch)
tree54019d9f77240229e7da69de95be45eb47de4984 /src/mesa/main/texcompress_rgtc.c
parente7ecc11311d142a8ac919627011372a265224bcd (diff)
swrast: Replace ImageOffsets with an ImageSlices pointer.
This is a step toward allowing drivers to use their normal mapping paths, instead of requiring that all slice mappings come from an aligned offset from the first slice's map. This incidentally fixes missing slice handling in FXT1 swrast. v2: Use slice height helper function. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/main/texcompress_rgtc.c')
-rw-r--r--src/mesa/main/texcompress_rgtc.c70
1 files changed, 28 insertions, 42 deletions
diff --git a/src/mesa/main/texcompress_rgtc.c b/src/mesa/main/texcompress_rgtc.c
index a7006614367..7afd8ffa7a6 100644
--- a/src/mesa/main/texcompress_rgtc.c
+++ b/src/mesa/main/texcompress_rgtc.c
@@ -318,12 +318,11 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS)
static void
-fetch_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[],
- GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel)
+fetch_red_rgtc1(const GLubyte *map,
+ GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red;
- GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0;
- unsigned_fetch_texel_rgtc(rowStride, map + sliceOffset, i, j, &red, 1);
+ unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1);
texel[RCOMP] = UBYTE_TO_FLOAT(red);
texel[GCOMP] = 0.0;
texel[BCOMP] = 0.0;
@@ -331,12 +330,11 @@ fetch_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[],
}
static void
-fetch_l_latc1(const GLubyte *map, const GLuint imageOffsets[],
- GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel)
+fetch_l_latc1(const GLubyte *map,
+ GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red;
- GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0;
- unsigned_fetch_texel_rgtc(rowStride, map + sliceOffset, i, j, &red, 1);
+ unsigned_fetch_texel_rgtc(rowStride, map, i, j, &red, 1);
texel[RCOMP] =
texel[GCOMP] =
texel[BCOMP] = UBYTE_TO_FLOAT(red);
@@ -344,13 +342,11 @@ fetch_l_latc1(const GLubyte *map, const GLuint imageOffsets[],
}
static void
-fetch_signed_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[],
- GLint rowStride, GLint i, GLint j, GLint k,
- GLfloat *texel)
+fetch_signed_red_rgtc1(const GLubyte *map,
+ GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red;
- GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0;
- signed_fetch_texel_rgtc(rowStride, (const GLbyte *) map + sliceOffset,
+ signed_fetch_texel_rgtc(rowStride, (const GLbyte *) map,
i, j, &red, 1);
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
texel[GCOMP] = 0.0;
@@ -359,13 +355,11 @@ fetch_signed_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[],
}
static void
-fetch_signed_l_latc1(const GLubyte *map, const GLuint imageOffsets[],
- GLint rowStride, GLint i, GLint j, GLint k,
- GLfloat *texel)
+fetch_signed_l_latc1(const GLubyte *map,
+ GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red;
- GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0;
- signed_fetch_texel_rgtc(rowStride, (GLbyte *) map + sliceOffset,
+ signed_fetch_texel_rgtc(rowStride, (GLbyte *) map,
i, j, &red, 1);
texel[RCOMP] =
texel[GCOMP] =
@@ -374,17 +368,15 @@ fetch_signed_l_latc1(const GLubyte *map, const GLuint imageOffsets[],
}
static void
-fetch_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[],
- GLint rowStride, GLint i, GLint j, GLint k,
- GLfloat *texel)
+fetch_rg_rgtc2(const GLubyte *map,
+ GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red, green;
- GLuint sliceOffset = k ? imageOffsets[k] : 0;
unsigned_fetch_texel_rgtc(rowStride,
- map + sliceOffset,
+ map,
i, j, &red, 2);
unsigned_fetch_texel_rgtc(rowStride,
- map + sliceOffset + 8,
+ map + 8,
i, j, &green, 2);
texel[RCOMP] = UBYTE_TO_FLOAT(red);
texel[GCOMP] = UBYTE_TO_FLOAT(green);
@@ -393,17 +385,15 @@ fetch_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[],
}
static void
-fetch_la_latc2(const GLubyte *map, const GLuint imageOffsets[],
- GLint rowStride, GLint i, GLint j, GLint k,
- GLfloat *texel)
+fetch_la_latc2(const GLubyte *map,
+ GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLubyte red, green;
- GLuint sliceOffset = k ? imageOffsets[k] : 0;
unsigned_fetch_texel_rgtc(rowStride,
- map + sliceOffset,
+ map,
i, j, &red, 2);
unsigned_fetch_texel_rgtc(rowStride,
- map + sliceOffset + 8,
+ map + 8,
i, j, &green, 2);
texel[RCOMP] =
texel[GCOMP] =
@@ -413,17 +403,15 @@ fetch_la_latc2(const GLubyte *map, const GLuint imageOffsets[],
static void
-fetch_signed_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[],
- GLint rowStride, GLint i, GLint j, GLint k,
- GLfloat *texel)
+fetch_signed_rg_rgtc2(const GLubyte *map,
+ GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red, green;
- GLuint sliceOffset = k ? imageOffsets[k] : 0;
signed_fetch_texel_rgtc(rowStride,
- (GLbyte *) map + sliceOffset,
+ (GLbyte *) map,
i, j, &red, 2);
signed_fetch_texel_rgtc(rowStride,
- (GLbyte *) map + sliceOffset + 8,
+ (GLbyte *) map + 8,
i, j, &green, 2);
texel[RCOMP] = BYTE_TO_FLOAT_TEX(red);
texel[GCOMP] = BYTE_TO_FLOAT_TEX(green);
@@ -433,17 +421,15 @@ fetch_signed_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[],
static void
-fetch_signed_la_latc2(const GLubyte *map, const GLuint imageOffsets[],
- GLint rowStride, GLint i, GLint j, GLint k,
- GLfloat *texel)
+fetch_signed_la_latc2(const GLubyte *map,
+ GLint rowStride, GLint i, GLint j, GLfloat *texel)
{
GLbyte red, green;
- GLuint sliceOffset = k ? imageOffsets[k] : 0;
signed_fetch_texel_rgtc(rowStride,
- (GLbyte *) map + sliceOffset,
+ (GLbyte *) map,
i, j, &red, 2);
signed_fetch_texel_rgtc(rowStride,
- (GLbyte *) map + sliceOffset + 8,
+ (GLbyte *) map + 8,
i, j, &green, 2);
texel[RCOMP] =
texel[GCOMP] =