[Mesa-dev] [PATCH V3 03/30] swrast: Add support for fetching from MESA_FORMAT_R10G10B10A2_UNORM

Chris Forbes chrisf at ijw.co.nz
Wed Apr 2 01:04:59 PDT 2014


Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
---
 src/mesa/swrast/s_texfetch.c     |  6 +++---
 src/mesa/swrast/s_texfetch_tmp.h | 16 ++++++++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/mesa/swrast/s_texfetch.c b/src/mesa/swrast/s_texfetch.c
index cd09827..4084bbd 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_f_rgba1010102,
+      fetch_texel_2d_f_rgba1010102,
+      fetch_texel_3d_f_rgba1010102
    },
    {
       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 f749b49..39e55c5 100644
--- a/src/mesa/swrast/s_texfetch_tmp.h
+++ b/src/mesa/swrast/s_texfetch_tmp.h
@@ -685,6 +685,22 @@ static void FETCH(f_argb2101010)( const struct swrast_texture_image *texImage,
 
 
 
+/* MESA_FORMAT_R10G10B10A2_UNORM ***************************************************/
+
+/* Fetch texel from 1D, 2D or 3D argb2101010 texture, return 4 GLchans */
+static void FETCH(f_rgba1010102)( 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 >> 00) & 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);
+}
+
+
+
 
 /* MESA_FORMAT_R8G8_UNORM **********************************************************/
 
-- 
1.9.1



More information about the mesa-dev mailing list