From: Brian Paul Date: Mon, 10 Jun 2013 14:36:33 +0000 (-0700) Subject: swrast: add texfetch code for some XBGR formats X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=42adf5f0dd807c43a13df62dc1aa6774de07cd59;p=mesa.git swrast: add texfetch code for some XBGR formats Fixes piglit texture-packed-formats regression. We need to implement more XBGR formats here eventually, but many are UINT/SINT formats which swrast doesn't handle yet anyway (integer textures). Bugzilla https://bugs.freedesktop.org/show_bug.cgi?id=64935 Reviewed-by: Jose Fonseca --- diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c index c2e34cc1a29..0196aede15c 100644 --- a/src/mesa/swrast/s_texfetch.c +++ b/src/mesa/swrast/s_texfetch.c @@ -1240,9 +1240,9 @@ texfetch_funcs[] = }, { MESA_FORMAT_XBGR16161616_UNORM, - NULL, - NULL, - NULL + fetch_texel_1d_xbgr16161616_unorm, + fetch_texel_2d_xbgr16161616_unorm, + fetch_texel_3d_xbgr16161616_unorm }, { MESA_FORMAT_XBGR16161616_SNORM, @@ -1252,9 +1252,9 @@ texfetch_funcs[] = }, { MESA_FORMAT_XBGR16161616_FLOAT, - NULL, - NULL, - NULL + fetch_texel_1d_xbgr16161616_float, + fetch_texel_2d_xbgr16161616_float, + fetch_texel_3d_xbgr16161616_float }, { MESA_FORMAT_XBGR16161616_UINT, @@ -1270,9 +1270,9 @@ texfetch_funcs[] = }, { MESA_FORMAT_XBGR32323232_FLOAT, - NULL, - NULL, - NULL + fetch_texel_1d_xbgr32323232_float, + fetch_texel_2d_xbgr32323232_float, + fetch_texel_3d_xbgr32323232_float }, { MESA_FORMAT_XBGR32323232_UINT, diff --git a/src/mesa/swrast/s_texfetch_tmp.h b/src/mesa/swrast/s_texfetch_tmp.h index a0245a6256e..7a687532da2 100644 --- a/src/mesa/swrast/s_texfetch_tmp.h +++ b/src/mesa/swrast/s_texfetch_tmp.h @@ -1430,6 +1430,43 @@ FETCH(rgba_16)(const struct swrast_texture_image *texImage, +/* MESA_FORMAT_XBGR.... **********************************************/ + +static void +FETCH(xbgr16161616_unorm)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) +{ + const GLushort *s = TEXEL_ADDR(GLushort, texImage, i, j, k, 4); + texel[RCOMP] = USHORT_TO_FLOAT(s[0]); + texel[GCOMP] = USHORT_TO_FLOAT(s[1]); + texel[BCOMP] = USHORT_TO_FLOAT(s[2]); + texel[ACOMP] = 1.0f; +} + +static void +FETCH(xbgr16161616_float)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) +{ + const GLhalfARB *s = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4); + texel[RCOMP] = _mesa_half_to_float(s[0]); + texel[GCOMP] = _mesa_half_to_float(s[1]); + texel[BCOMP] = _mesa_half_to_float(s[2]); + texel[ACOMP] = 1.0f; +} + +static void +FETCH(xbgr32323232_float)(const struct swrast_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) +{ + const GLfloat *s = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4); + texel[RCOMP] = s[0]; + texel[GCOMP] = s[1]; + texel[BCOMP] = s[2]; + texel[ACOMP] = 1.0f; +} + +/* XXX other XBGR formats need to be implemented here */ + /* MESA_FORMAT_YCBCR *********************************************************/