X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Ftexfetch_tmp.h;h=36dede57f002eb8a005f4a78258791583a83c915;hb=04dca296e0a5e5ffbb8acb699e013a23ebd7b645;hp=3a75cdcefe95169e881466e94b610ee77c409d12;hpb=eb31837a0d4fa4fe115bb288ddb37cbedea954ae;p=mesa.git diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h index 3a75cdcefe9..36dede57f00 100644 --- a/src/mesa/main/texfetch_tmp.h +++ b/src/mesa/main/texfetch_tmp.h @@ -135,7 +135,7 @@ static void store_texel_rgba_f32(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLfloat *depth = (const GLfloat *) texel; - GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); + GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4); dst[0] = depth[RCOMP]; dst[1] = depth[GCOMP]; dst[2] = depth[BCOMP]; @@ -163,9 +163,12 @@ static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage, static void store_texel_rgba_f16(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { - const GLfloat *depth = (const GLfloat *) texel; - GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); - dst[0] = _mesa_float_to_half(*depth); + const GLfloat *src = (const GLfloat *) texel; + GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4); + dst[0] = _mesa_float_to_half(src[RCOMP]); + dst[1] = _mesa_float_to_half(src[GCOMP]); + dst[2] = _mesa_float_to_half(src[BCOMP]); + dst[3] = _mesa_float_to_half(src[ACOMP]); } #endif @@ -188,9 +191,11 @@ static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage, static void store_texel_rgb_f32(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { - const GLfloat *depth = (const GLfloat *) texel; - GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); - dst[0] = *depth; + const GLfloat *src = (const GLfloat *) texel; + GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3); + dst[0] = src[RCOMP]; + dst[1] = src[GCOMP]; + dst[2] = src[BCOMP]; } #endif @@ -214,9 +219,11 @@ static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage, static void store_texel_rgb_f16(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { - const GLfloat *depth = (const GLfloat *) texel; - GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); - dst[0] = _mesa_float_to_half(*depth); + const GLfloat *src = (const GLfloat *) texel; + GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3); + dst[0] = _mesa_float_to_half(src[RCOMP]); + dst[1] = _mesa_float_to_half(src[GCOMP]); + dst[2] = _mesa_float_to_half(src[BCOMP]); } #endif @@ -830,7 +837,7 @@ static void store_texel_argb2101010(struct gl_texture_image *texImage, { 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]); + *dst = PACK_COLOR_2101010_UB(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); } #endif @@ -892,8 +899,8 @@ static void FETCH(f_al44)( const struct gl_texture_image *texImage, const GLubyte s = *TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); texel[RCOMP] = texel[GCOMP] = - texel[BCOMP] = UBYTE_TO_FLOAT( (s & 0x0f) << 4 ); - texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xf0 ); + texel[BCOMP] = (s & 0xf) * (1.0F / 15.0F); + texel[ACOMP] = ((s >> 4) & 0xf) * (1.0F / 15.0F); } #if DIM == 3 @@ -1196,6 +1203,30 @@ static void store_texel_l8(struct gl_texture_image *texImage, #endif +/* MESA_FORMAT_L16 ***********************************************************/ + +/* Fetch texel from 1D, 2D or 3D l16 texture, return 4 GLchans */ +static void FETCH(f_l16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = USHORT_TO_FLOAT( src[0] ); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_l16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLushort *rgba = (const GLushort *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = rgba[RCOMP]; +} +#endif + + /* MESA_FORMAT_I8 ************************************************************/ /* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */ @@ -1220,6 +1251,30 @@ static void store_texel_i8(struct gl_texture_image *texImage, #endif +/* MESA_FORMAT_I16 ***********************************************************/ + +/* Fetch texel from 1D, 2D or 3D i16 texture, return 4 GLchans */ +static void FETCH(f_i16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLushort *src = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = + texel[ACOMP] = USHORT_TO_FLOAT( src[0] ); +} + +#if DIM == 3 +static void store_texel_i16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLushort *rgba = (const GLushort *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = rgba[RCOMP]; +} +#endif + + /* MESA_FORMAT_CI8 ***********************************************************/ /* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a