From 6ef720561326b3ef9a2eb9e20f1a4ef0395d111b Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sat, 29 Mar 2014 17:29:37 +1300 Subject: swrast: Add support for fetching from MESA_FORMAT_R10G10B10A2_UNORM V4: Fix rebase conflicts with Brian's renaming of the texfetch functions. Signed-off-by: Chris Forbes Reviewed-by: Kenneth Graunke Reviewed-by: Brian Paul Acked-by: Eric Anholt --- src/mesa/swrast/s_texfetch.c | 6 +++--- src/mesa/swrast/s_texfetch_tmp.h | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c index 3ad4a5b86c6..098a32fd4be 100644 --- a/src/mesa/swrast/s_texfetch.c +++ b/src/mesa/swrast/s_texfetch.c @@ -325,9 +325,9 @@ texfetch_funcs[] = }, { MESA_FORMAT_R10G10B10A2_UNORM, - NULL, - NULL, - NULL + fetch_texel_1d_R10G10B10A2_UNORM, + fetch_texel_2d_R10G10B10A2_UNORM, + fetch_texel_3d_R10G10B10A2_UNORM }, { MESA_FORMAT_S8_UINT_Z24_UNORM, diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h index b1981e4d332..c783ae34f1c 100644 --- a/src/mesa/swrast/s_texfetch_tmp.h +++ b/src/mesa/swrast/s_texfetch_tmp.h @@ -502,6 +502,19 @@ FETCH(B10G10R10A2_UNORM)(const struct swrast_texture_image *texImage, } +static void +FETCH(R10G10B10A2_UNORM)(const struct swrast_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 >> 0) & 0x3ff) * (1.0F / 1023.0F); + texel[GCOMP] = ((s >> 10) & 0x3ff) * (1.0F / 1023.0F); + texel[BCOMP] = ((s >> 20) & 0x3ff) * (1.0F / 1023.0F); + texel[ACOMP] = ((s >> 30) & 0x03) * (1.0F / 3.0F); +} + + static void FETCH(R8G8_UNORM)(const struct swrast_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel) -- cgit v1.2.3