[Mesa-dev] [PATCH 3/5] mesa: Document some etc1 functions
Chad Versace
chad.versace at linux.intel.com
Mon Jul 9 10:46:58 PDT 2012
- Add doxygen to etc1_texel_fetch().
- Rename ambiguously named `dst` variables to `bgr888` in order to be
better self-documenting.
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
src/mesa/main/texcompress_etc.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/mesa/main/texcompress_etc.c b/src/mesa/main/texcompress_etc.c
index a5482f4..e3b2e83 100644
--- a/src/mesa/main/texcompress_etc.c
+++ b/src/mesa/main/texcompress_etc.c
@@ -122,10 +122,14 @@ etc1_parse_block(struct etc1_block *block, const uint8_t *src)
(src[4] << 24) | (src[5] << 16) | (src[6] << 8) | src[7];
}
+/**
+ * Fetch the texel located at (x, y) within @a block and return it
+ * in @a bgr888.
+ */
static void
etc1_fetch_texel(const struct etc1_block *block,
int x, int y,
- uint8_t *dst)
+ uint8_t *bgr888)
{
const uint8_t *base_color;
int modifier, bit, idx, blk;
@@ -141,9 +145,9 @@ etc1_fetch_texel(const struct etc1_block *block,
base_color = block->base_colors[blk];
modifier = block->modifier_tables[blk][idx];
- dst[0] = etc1_clamp(base_color[0], modifier);
- dst[1] = etc1_clamp(base_color[1], modifier);
- dst[2] = etc1_clamp(base_color[2], modifier);
+ bgr888[0] = etc1_clamp(base_color[0], modifier);
+ bgr888[1] = etc1_clamp(base_color[1], modifier);
+ bgr888[2] = etc1_clamp(base_color[2], modifier);
}
GLboolean
@@ -160,17 +164,17 @@ _mesa_fetch_texel_2d_f_etc1_rgb8(const struct swrast_texture_image *texImage,
GLint i, GLint j, GLint k, GLfloat *texel)
{
struct etc1_block block;
- GLubyte dst[3];
+ uint8_t bgr888[3];
const GLubyte *src;
src = (const GLubyte *) texImage->Map +
(((texImage->RowStride + 3) / 4) * (j / 4) + (i / 4)) * 8;
etc1_parse_block(&block, src);
- etc1_fetch_texel(&block, i % 4, j % 4, dst);
+ etc1_fetch_texel(&block, i % 4, j % 4, bgr888);
- texel[RCOMP] = UBYTE_TO_FLOAT(dst[0]);
- texel[GCOMP] = UBYTE_TO_FLOAT(dst[1]);
- texel[BCOMP] = UBYTE_TO_FLOAT(dst[2]);
+ texel[RCOMP] = UBYTE_TO_FLOAT(bgr888[0]);
+ texel[GCOMP] = UBYTE_TO_FLOAT(bgr888[1]);
+ texel[BCOMP] = UBYTE_TO_FLOAT(bgr888[2]);
texel[ACOMP] = 1.0f;
}
--
1.7.11.1
More information about the mesa-dev
mailing list