Mesa (master): mesa: implement texfetch functions for depth_buffer_float

Marek Olšák mareko at kemper.freedesktop.org
Sun Jul 10 12:44:50 PDT 2011


Module: Mesa
Branch: master
Commit: 4843c7b24af7408329d33ab16bb946b17244a5f8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4843c7b24af7408329d33ab16bb946b17244a5f8

Author: Marek Olšák <maraeo at gmail.com>
Date:   Mon Jun 20 03:07:16 2011 +0200

mesa: implement texfetch functions for depth_buffer_float

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/main/texfetch.c     |   16 ++++++++--------
 src/mesa/main/texfetch_tmp.h |   23 +++++++++++++++++++++++
 2 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c
index 4b85bc3..72283eb 100644
--- a/src/mesa/main/texfetch.c
+++ b/src/mesa/main/texfetch.c
@@ -916,17 +916,17 @@ texfetch_funcs[MESA_FORMAT_COUNT] =
    },
    {
       MESA_FORMAT_Z32_FLOAT,
-      NULL, /* XXX */
-      NULL,
-      NULL,
-      NULL
+      fetch_texel_1d_f_r_f32, /* Reuse the R32F functions. */
+      fetch_texel_2d_f_r_f32,
+      fetch_texel_3d_f_r_f32,
+      store_texel_r_f32
    },
    {
       MESA_FORMAT_Z32_FLOAT_X24S8,
-      NULL, /* XXX */
-      NULL,
-      NULL,
-      NULL
+      fetch_texel_1d_z32f_x24s8,
+      fetch_texel_2d_z32f_x24s8,
+      fetch_texel_3d_z32f_x24s8,
+      store_texel_z32f_x24s8
    }
 };
 
diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h
index e6fd81d..3b1eedf 100644
--- a/src/mesa/main/texfetch_tmp.h
+++ b/src/mesa/main/texfetch_tmp.h
@@ -2374,6 +2374,29 @@ static void store_texel_r11_g11_b10f(struct gl_texture_image *texImage,
 #endif
 
 
+/* MESA_FORMAT_Z32_FLOAT_X24S8 ***********************************************/
+
+static void FETCH(z32f_x24s8)(const struct gl_texture_image *texImage,
+			      GLint i, GLint j, GLint k, GLfloat *texel)
+{
+   const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
+   texel[RCOMP] = src[0];
+   texel[GCOMP] = 0.0F;
+   texel[BCOMP] = 0.0F;
+   texel[ACOMP] = 1.0F;
+}
+
+#if DIM == 3
+static void store_texel_z32f_x24s8(struct gl_texture_image *texImage,
+                                   GLint i, GLint j, GLint k, const void *texel)
+{
+   const GLfloat *src = (const GLfloat *) texel;
+   GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2);
+   dst[0] = src[0];
+}
+#endif
+
+
 #undef TEXEL_ADDR
 #undef DIM
 #undef FETCH



More information about the mesa-commit mailing list