summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2013-06-10 07:36:33 -0700
committerBrian Paul <[email protected]>2013-06-11 08:26:38 -0600
commit42adf5f0dd807c43a13df62dc1aa6774de07cd59 (patch)
tree1d1d4d683c96a6008289a9ab3b9bd35d4a9edc0d /src
parent91405e3502cca72062aeb202922d275bc184f69f (diff)
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/swrast/s_texfetch.c18
-rw-r--r--src/mesa/swrast/s_texfetch_tmp.h37
2 files changed, 46 insertions, 9 deletions
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 *********************************************************/