diff options
author | marha <marha@users.sourceforge.net> | 2012-12-17 11:51:13 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-12-17 11:51:13 +0100 |
commit | 840c8745518b92303d40f6834e9c616587242231 (patch) | |
tree | 097a30453fb59b6a88708c3f576e824e8f237c52 /mesalib/src/mesa/main/texcompress_rgtc.c | |
parent | b395c3c85251d4e8761704d8e3a3c9f9fa5b45cc (diff) | |
download | vcxsrv-840c8745518b92303d40f6834e9c616587242231.tar.gz vcxsrv-840c8745518b92303d40f6834e9c616587242231.tar.bz2 vcxsrv-840c8745518b92303d40f6834e9c616587242231.zip |
libXft pixman mesa git update 17 dec 2012
libXft: 835cd2a6cb4aa8f89e6e7dead66483643a6e7ee8
pixman: 526dc06e5694172abf979c03a5cf530207fe2d27
mesa: 1358f3a905448f6fb546aba951e317f743a83c76
Diffstat (limited to 'mesalib/src/mesa/main/texcompress_rgtc.c')
-rw-r--r-- | mesalib/src/mesa/main/texcompress_rgtc.c | 243 |
1 files changed, 136 insertions, 107 deletions
diff --git a/mesalib/src/mesa/main/texcompress_rgtc.c b/mesalib/src/mesa/main/texcompress_rgtc.c index 5773459d7..fa9172aa2 100644 --- a/mesalib/src/mesa/main/texcompress_rgtc.c +++ b/mesalib/src/mesa/main/texcompress_rgtc.c @@ -43,7 +43,6 @@ #include "texcompress.h" #include "texcompress_rgtc.h" #include "texstore.h" -#include "swrast/s_context.h" #define RGTC_DEBUG 0 @@ -291,113 +290,120 @@ _mesa_texstore_signed_rg_rgtc2(TEXSTORE_PARAMS) return GL_TRUE; } -void -_mesa_fetch_texel_red_rgtc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) + +#define TAG(x) unsigned_##x + +#define TYPE GLubyte +#define T_MIN 0 +#define T_MAX 0xff + +#include "texcompress_rgtc_tmp.h" + +#undef TAG +#undef TYPE +#undef T_MIN +#undef T_MAX + +#define TAG(x) signed_##x +#define TYPE GLbyte +#define T_MIN (GLbyte)-128 +#define T_MAX (GLbyte)127 + +#include "texcompress_rgtc_tmp.h" + +#undef TAG +#undef TYPE +#undef T_MIN +#undef T_MAX + + + +static void +fetch_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[], + GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) { GLubyte red; - GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0; - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset, - i, j, &red, 1); + GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; + unsigned_fetch_texel_rgtc(rowStride, map + sliceOffset, i, j, &red, 1); texel[RCOMP] = UBYTE_TO_FLOAT(red); texel[GCOMP] = 0.0; texel[BCOMP] = 0.0; texel[ACOMP] = 1.0; } -void -_mesa_fetch_texel_signed_red_rgtc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +static void +fetch_l_latc1(const GLubyte *map, const GLuint imageOffsets[], + GLint rowStride, GLint i, GLint j, GLint k, GLfloat *texel) { - GLbyte red; - GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0; - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset, - i, j, &red, 1); - texel[RCOMP] = BYTE_TO_FLOAT_TEX(red); - texel[GCOMP] = 0.0; - texel[BCOMP] = 0.0; - texel[ACOMP] = 1.0; -} - -void -_mesa_fetch_texel_rg_rgtc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) -{ - GLubyte red, green; - GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0; - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset, - i, j, &red, 2); - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset + 8, - i, j, &green, 2); - texel[RCOMP] = UBYTE_TO_FLOAT(red); - texel[GCOMP] = UBYTE_TO_FLOAT(green); - texel[BCOMP] = 0.0; + GLubyte red; + GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; + unsigned_fetch_texel_rgtc(rowStride, map + sliceOffset, i, j, &red, 1); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = UBYTE_TO_FLOAT(red); texel[ACOMP] = 1.0; } -void -_mesa_fetch_texel_signed_rg_rgtc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +static void +fetch_signed_red_rgtc1(const GLubyte *map, const GLuint imageOffsets[], + GLint rowStride, GLint i, GLint j, GLint k, + GLfloat *texel) { - GLbyte red, green; - GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0; - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset, - i, j, &red, 2); - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset + 8, - i, j, &green, 2); + GLbyte red; + GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; + signed_fetch_texel_rgtc(rowStride, (const GLbyte *) map + sliceOffset, + i, j, &red, 1); texel[RCOMP] = BYTE_TO_FLOAT_TEX(red); - texel[GCOMP] = BYTE_TO_FLOAT_TEX(green); + texel[GCOMP] = 0.0; texel[BCOMP] = 0.0; texel[ACOMP] = 1.0; } -void -_mesa_fetch_texel_l_latc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +static void +fetch_signed_l_latc1(const GLubyte *map, const GLuint imageOffsets[], + GLint rowStride, GLint i, GLint j, GLint k, + GLfloat *texel) { GLubyte red; - GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0; - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset, - i, j, &red, 1); + GLuint sliceOffset = k ? imageOffsets[k] / 2 : 0; + unsigned_fetch_texel_rgtc(rowStride, map + sliceOffset, i, j, &red, 1); texel[RCOMP] = texel[GCOMP] = - texel[BCOMP] = UBYTE_TO_FLOAT(red); + texel[BCOMP] = BYTE_TO_FLOAT(red); texel[ACOMP] = 1.0; } -void -_mesa_fetch_texel_signed_l_latc1(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +static void +fetch_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[], + GLint rowStride, GLint i, GLint j, GLint k, + GLfloat *texel) { - GLbyte red; - GLint sliceOffset = k ? texImage->ImageOffsets[k] / 2 : 0; - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset, - i, j, &red, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = BYTE_TO_FLOAT_TEX(red); + GLubyte red, green; + GLuint sliceOffset = k ? imageOffsets[k] : 0; + unsigned_fetch_texel_rgtc(rowStride, + map + sliceOffset, + i, j, &red, 2); + unsigned_fetch_texel_rgtc(rowStride, + map + sliceOffset + 8, + i, j, &green, 2); + texel[RCOMP] = UBYTE_TO_FLOAT(red); + texel[GCOMP] = UBYTE_TO_FLOAT(green); + texel[BCOMP] = 0.0; texel[ACOMP] = 1.0; } -void -_mesa_fetch_texel_la_latc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) +static void +fetch_la_latc2(const GLubyte *map, const GLuint imageOffsets[], + GLint rowStride, GLint i, GLint j, GLint k, + GLfloat *texel) { GLubyte red, green; - GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0; - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset, + GLuint sliceOffset = k ? imageOffsets[k] : 0; + unsigned_fetch_texel_rgtc(rowStride, + map + sliceOffset, i, j, &red, 2); - unsigned_fetch_texel_rgtc(texImage->RowStride, - texImage->Map + sliceOffset + 8, + unsigned_fetch_texel_rgtc(rowStride, + map + sliceOffset + 8, i, j, &green, 2); texel[RCOMP] = texel[GCOMP] = @@ -405,17 +411,39 @@ _mesa_fetch_texel_la_latc2(const struct swrast_texture_image *texImage, texel[ACOMP] = UBYTE_TO_FLOAT(green); } -void -_mesa_fetch_texel_signed_la_latc2(const struct swrast_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel) + +static void +fetch_signed_rg_rgtc2(const GLubyte *map, const GLuint imageOffsets[], + GLint rowStride, GLint i, GLint j, GLint k, + GLfloat *texel) +{ + GLbyte red, green; + GLuint sliceOffset = k ? imageOffsets[k] : 0; + signed_fetch_texel_rgtc(rowStride, + (GLbyte *) map + sliceOffset, + i, j, &red, 2); + signed_fetch_texel_rgtc(rowStride, + (GLbyte *) map + sliceOffset + 8, + i, j, &green, 2); + texel[RCOMP] = BYTE_TO_FLOAT_TEX(red); + texel[GCOMP] = BYTE_TO_FLOAT_TEX(green); + texel[BCOMP] = 0.0; + texel[ACOMP] = 1.0; +} + + +static void +fetch_signed_la_latc2(const GLubyte *map, const GLuint imageOffsets[], + GLint rowStride, GLint i, GLint j, GLint k, + GLfloat *texel) { GLbyte red, green; - GLint sliceOffset = k ? texImage->ImageOffsets[k] : 0; - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset, + GLuint sliceOffset = k ? imageOffsets[k] : 0; + signed_fetch_texel_rgtc(rowStride, + (GLbyte *) map + sliceOffset, i, j, &red, 2); - signed_fetch_texel_rgtc(texImage->RowStride, - (GLbyte *)(texImage->Map) + sliceOffset + 8, + signed_fetch_texel_rgtc(rowStride, + (GLbyte *) map + sliceOffset + 8, i, j, &green, 2); texel[RCOMP] = texel[GCOMP] = @@ -423,27 +451,28 @@ _mesa_fetch_texel_signed_la_latc2(const struct swrast_texture_image *texImage, texel[ACOMP] = BYTE_TO_FLOAT_TEX(green); } -#define TAG(x) unsigned_##x - -#define TYPE GLubyte -#define T_MIN 0 -#define T_MAX 0xff - -#include "texcompress_rgtc_tmp.h" - -#undef TAG -#undef TYPE -#undef T_MIN -#undef T_MAX - -#define TAG(x) signed_##x -#define TYPE GLbyte -#define T_MIN (GLbyte)-128 -#define T_MAX (GLbyte)127 -#include "texcompress_rgtc_tmp.h" - -#undef TAG -#undef TYPE -#undef T_MIN -#undef T_MAX +compressed_fetch_func +_mesa_get_compressed_rgtc_func(gl_format format) +{ + switch (format) { + case MESA_FORMAT_RED_RGTC1: + return fetch_red_rgtc1; + case MESA_FORMAT_L_LATC1: + return fetch_l_latc1; + case MESA_FORMAT_SIGNED_RED_RGTC1: + return fetch_signed_red_rgtc1; + case MESA_FORMAT_SIGNED_L_LATC1: + return fetch_signed_l_latc1; + case MESA_FORMAT_RG_RGTC2: + return fetch_rg_rgtc2; + case MESA_FORMAT_LA_LATC2: + return fetch_la_latc2; + case MESA_FORMAT_SIGNED_RG_RGTC2: + return fetch_signed_rg_rgtc2; + case MESA_FORMAT_SIGNED_LA_LATC2: + return fetch_signed_la_latc2; + default: + return NULL; + } +} |