OSDN Git Service

swrast: add texfetch code for some XBGR formats
authorBrian Paul <brianp@vmware.com>
Mon, 10 Jun 2013 14:36:33 +0000 (07:36 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 11 Jun 2013 14:26:38 +0000 (08:26 -0600)
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 <jfonseca@vmware.com>
src/mesa/swrast/s_texfetch.c
src/mesa/swrast/s_texfetch_tmp.h

index c2e34cc..0196aed 100644 (file)
@@ -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,
index a0245a6..7a68753 100644 (file)
@@ -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 *********************************************************/