diff options
author | marha <marha@users.sourceforge.net> | 2012-07-18 08:33:31 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-07-18 08:33:31 +0200 |
commit | 2ff5448bcca8cba4b62026d5493cb08aaf2838d8 (patch) | |
tree | 355bad312548535d148aa058c089aefc81e10ab3 /mesalib/src/mesa/main | |
parent | d09d7be8bbbb39926f44834023d7120535155829 (diff) | |
download | vcxsrv-2ff5448bcca8cba4b62026d5493cb08aaf2838d8.tar.gz vcxsrv-2ff5448bcca8cba4b62026d5493cb08aaf2838d8.tar.bz2 vcxsrv-2ff5448bcca8cba4b62026d5493cb08aaf2838d8.zip |
fontconfig mesa xserver git update 18 Jul 2012
Diffstat (limited to 'mesalib/src/mesa/main')
-rw-r--r-- | mesalib/src/mesa/main/drawpix.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texcompress_etc.c | 32 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texcompress_etc.h | 9 | ||||
-rw-r--r-- | mesalib/src/mesa/main/texcompress_etc_tmp.h | 34 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 4 |
5 files changed, 78 insertions, 3 deletions
diff --git a/mesalib/src/mesa/main/drawpix.c b/mesalib/src/mesa/main/drawpix.c index def55dddd..fdcbcccde 100644 --- a/mesalib/src/mesa/main/drawpix.c +++ b/mesalib/src/mesa/main/drawpix.c @@ -240,7 +240,7 @@ _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, } if (ctx->ReadBuffer->Name != 0 && ctx->ReadBuffer->Visual.samples > 0) { - _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION, + _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyPixels(multisample FBO)"); goto end; } diff --git a/mesalib/src/mesa/main/texcompress_etc.c b/mesalib/src/mesa/main/texcompress_etc.c index 5b331a92a..c645f52b9 100644 --- a/mesalib/src/mesa/main/texcompress_etc.c +++ b/mesalib/src/mesa/main/texcompress_etc.c @@ -69,3 +69,35 @@ _mesa_fetch_texel_2d_f_etc1_rgb8(const struct swrast_texture_image *texImage, texel[BCOMP] = UBYTE_TO_FLOAT(dst[2]); texel[ACOMP] = 1.0f; } + +/** + * Decode texture data in format `MESA_FORMAT_ETC1_RGB8` to + * `MESA_FORMAT_ABGR8888`. + * + * The size of the source data must be a multiple of the ETC1 block size, + * which is 8, even if the texture image's dimensions are not aligned to 4. + * From the GL_OES_compressed_ETC1_RGB8_texture spec: + * The texture is described as a number of 4x4 pixel blocks. If the + * texture (or a particular mip-level) is smaller than 4 pixels in + * any dimension (such as a 2x2 or a 8x1 texture), the texture is + * found in the upper left part of the block(s), and the rest of the + * pixels are not used. For instance, a texture of size 4x2 will be + * placed in the upper half of a 4x4 block, and the lower half of the + * pixels in the block will not be accessed. + * + * \param src_width in pixels + * \param src_height in pixels + * \param dst_stride in bytes + */ +void +_mesa_etc1_unpack_rgba8888(uint8_t *dst_row, + unsigned dst_stride, + const uint8_t *src_row, + unsigned src_stride, + unsigned src_width, + unsigned src_height) +{ + etc1_unpack_rgba8888(dst_row, dst_stride, + src_row, src_stride, + src_width, src_height); +} diff --git a/mesalib/src/mesa/main/texcompress_etc.h b/mesalib/src/mesa/main/texcompress_etc.h index 8e8427f8f..411e1540d 100644 --- a/mesalib/src/mesa/main/texcompress_etc.h +++ b/mesalib/src/mesa/main/texcompress_etc.h @@ -24,6 +24,7 @@ #ifndef TEXCOMPRESS_ETC1_H #define TEXCOMPRESS_ETC1_H +#include <inttypes.h> #include "glheader.h" #include "mfeatures.h" #include "texstore.h" @@ -37,4 +38,12 @@ void _mesa_fetch_texel_2d_f_etc1_rgb8(const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel); +void +_mesa_etc1_unpack_rgba8888(uint8_t *dst_row, + unsigned dst_stride, + const uint8_t *src_row, + unsigned src_stride, + unsigned src_width, + unsigned src_height); + #endif diff --git a/mesalib/src/mesa/main/texcompress_etc_tmp.h b/mesalib/src/mesa/main/texcompress_etc_tmp.h index 5c8c6decf..8bbb2cde8 100644 --- a/mesalib/src/mesa/main/texcompress_etc_tmp.h +++ b/mesalib/src/mesa/main/texcompress_etc_tmp.h @@ -134,3 +134,37 @@ TAG(etc1_fetch_texel)(const struct TAG(etc1_block) *block, dst[1] = TAG(etc1_clamp)(base_color[1], modifier); dst[2] = TAG(etc1_clamp)(base_color[2], modifier); } + +static void +etc1_unpack_rgba8888(uint8_t *dst_row, + unsigned dst_stride, + const uint8_t *src_row, + unsigned src_stride, + unsigned width, + unsigned height) +{ + const unsigned bw = 4, bh = 4, bs = 8, comps = 4; + struct etc1_block block; + unsigned x, y, i, j; + + for (y = 0; y < height; y += bh) { + const uint8_t *src = src_row; + + for (x = 0; x < width; x+= bw) { + etc1_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++) { + etc1_fetch_texel(&block, i, j, dst); + dst[3] = 255; + dst += comps; + } + } + + src += bs; + } + + src_row += src_stride; + } +} diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 126386ebe..64b25a82d 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -2005,7 +2005,7 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions, } if (ctx->ReadBuffer->Visual.samples > 0) { - _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION, + _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexImage%dD(multisample FBO)", dimensions); return GL_TRUE; @@ -2130,7 +2130,7 @@ copytexsubimage_error_check1( struct gl_context *ctx, GLuint dimensions, } if (ctx->ReadBuffer->Visual.samples > 0) { - _mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION, + _mesa_error(ctx, GL_INVALID_OPERATION, "glCopyTexSubImage%dD(multisample FBO)", dimensions); return GL_TRUE; |