[Mesa-dev] [PATCH] swrast: add texfetch code for some XBGR formats
Jose Fonseca
jfonseca at vmware.com
Mon Jun 10 23:02:57 PDT 2013
----- Original Message -----
> 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
> ---
> src/mesa/swrast/s_texfetch.c | 18 +++++++++---------
> src/mesa/swrast/s_texfetch_tmp.h | 37
> +++++++++++++++++++++++++++++++++++++
> 2 files changed, 46 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
> index c2e34cc..0196aed 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 a0245a6..7a68753 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
> *********************************************************/
> --
> 1.7.10.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
More information about the mesa-dev
mailing list