diff options
author | Marek Olšák <[email protected]> | 2010-12-21 18:54:50 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2010-12-23 16:54:58 +0100 |
commit | 621e5254ef6714520f106bd3707fe6ddc279aa0c (patch) | |
tree | 8b2dfc92e969c173f27476ee77bdf42bb472b6bd /src/mesa/main/texfetch_tmp.h | |
parent | 0a7b60f7ed3167acce72b3c367181dcae81f92c1 (diff) |
mesa: implement new texture format ARGB2101010
Radeon GPUs do support GL_RGB10_A2.
Diffstat (limited to 'src/mesa/main/texfetch_tmp.h')
-rw-r--r-- | src/mesa/main/texfetch_tmp.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h index 2f583ed5223..c985de92908 100644 --- a/src/mesa/main/texfetch_tmp.h +++ b/src/mesa/main/texfetch_tmp.h @@ -810,6 +810,31 @@ static void store_texel_argb1555_rev(struct gl_texture_image *texImage, #endif +/* MESA_FORMAT_ARGB2101010 ***************************************************/ + +/* Fetch texel from 1D, 2D or 3D argb2101010 texture, return 4 GLchans */ +static void FETCH(f_argb2101010)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + const GLuint s = *src; + texel[RCOMP] = ((s >> 20) & 0x3ff) * (1.0F / 1023.0F); + texel[GCOMP] = ((s >> 10) & 0x3ff) * (1.0F / 1023.0F); + texel[BCOMP] = ((s >> 0) & 0x3ff) * (1.0F / 1023.0F); + texel[ACOMP] = ((s >> 30) & 0x03) * (1.0F / 3.0F); +} + +#if DIM == 3 +static void store_texel_argb2101010(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + *dst = PACK_COLOR_2101010(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); +} +#endif + + /* MESA_FORMAT_RG88 **********************************************************/ /* Fetch texel from 1D, 2D or 3D rg88 texture, return 4 GLchans */ |