[Mesa-dev] [PATCH 05/27] mesa: Add necessary support to decode multiple ETC2 texture formats
Anuj Phogat
anuj.phogat at gmail.com
Fri Oct 19 16:28:40 PDT 2012
Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
src/mesa/main/texcompress_etc.c | 17 +++++++++--------
src/mesa/main/texcompress_etc.h | 3 ++-
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index cf8b687..8294144 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -23,9 +23,9 @@
/**
* \file texcompress_etc.c
+ * GL_OES_compressed_ETC1_RGB8_texture support.
* Supported ETC2 texture formats are:
* GL_COMPRESSED_RGB8_ETC2
- * GL_OES_compressed_ETC1_RGB8_texture support.
*/
@@ -289,7 +289,7 @@ etc2_clamp(int color)
}
static void
-etc2_parse_block(struct etc2_block *block, const GLubyte *src)
+etc2_rgb8_parse_block(struct etc2_block *block, const GLubyte *src)
{
unsigned i;
GLboolean diffbit = src[3] & 0x2;
@@ -408,7 +408,7 @@ etc2_parse_block(struct etc2_block *block, const GLubyte *src)
}
static void
-etc2_fetch_texel(const struct etc2_block *block,
+etc2_rgb8_fetch_texel(const struct etc2_block *block,
int x, int y, GLubyte *dst)
{
const GLubyte *base_color;
@@ -475,12 +475,12 @@ etc2_unpack_rgb8(uint8_t *dst_row,
const uint8_t *src = src_row;
for (x = 0; x < width; x+= bw) {
- etc2_parse_block(&block, src);
+ etc2_rgb8_parse_block(&block, src);
for (j = 0; j < bh; j++) {
uint8_t *dst = dst_row + (y + j) * dst_stride + x * comps;
for (i = 0; i < bw; i++) {
- etc2_fetch_texel(&block, i, j, dst);
+ etc2_rgb8_fetch_texel(&block, i, j, dst);
dst[3] = 255;
dst += comps;
}
@@ -514,8 +514,8 @@ _mesa_fetch_texel_2d_f_etc2_rgb8(const struct swrast_texture_image *texImage,
src = (const GLubyte *) texImage->Map +
(((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 8;
- etc2_parse_block(&block, src);
- etc2_fetch_texel(&block, i % 4, j % 4, dst);
+ etc2_rgb8_parse_block(&block, src);
+ etc2_rgb8_fetch_texel(&block, i % 4, j % 4, dst);
texel[RCOMP] = UBYTE_TO_FLOAT(dst[0]);
texel[GCOMP] = UBYTE_TO_FLOAT(dst[1]);
@@ -541,7 +541,8 @@ _mesa_unpack_etc2_format(uint8_t *dst_row,
const uint8_t *src_row,
unsigned src_stride,
unsigned src_width,
- unsigned src_height)
+ unsigned src_height,
+ gl_format format)
{
etc2_unpack_rgb8(dst_row, dst_stride,
src_row, src_stride,
diff --git a/src/mesa/main/texcompress_etc.h b/src/mesa/main/texcompress_etc.h
index 8c6a40d..2508f5f 100644
--- a/src/mesa/main/texcompress_etc.h
+++ b/src/mesa/main/texcompress_etc.h
@@ -56,5 +56,6 @@ _mesa_unpack_etc2_format(uint8_t *dst_row,
const uint8_t *src_row,
unsigned src_stride,
unsigned src_width,
- unsigned src_height);
+ unsigned src_height,
+ gl_format format);
#endif
--
1.7.7.6
More information about the mesa-dev
mailing list