On 11/01/2011 05:17 PM, Eric Anholt wrote:
This avoids going through the wrapper that has to rewrite the data for
packed depth/stencil.  This isn't done in _swrast_read_stencil_span
because we don't want to map/unmap for each span.

v2: Move the unpack code to format_unpack.c.
---
  src/mesa/main/format_unpack.c |   58 +++++++++++++++++++++++++++++++++++++++++
  src/mesa/main/format_unpack.h |    4 +++
  src/mesa/swrast/s_readpix.c   |   16 ++++++++---
  3 files changed, 74 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c
index fbda031..6295238 100644
--- a/src/mesa/main/format_unpack.c
+++ b/src/mesa/main/format_unpack.c
@@ -1480,4 +1480,62 @@ _mesa_unpack_uint_z_row(gl_format format, GLuint n,
     }
  }

+static void
+unpack_ubyte_s_S8(const void *src, GLubyte *dst, GLuint n)
+{
+   memcpy(dst, src, n);
+}

+static void
+unpack_ubyte_s_Z24_S8(const void *src, GLubyte *dst, GLuint n)
+{
+   int i;
+   const GLuint *src32 = src;
+
+   for (i = 0; i<  n; i++)
+      dst[i] = src32[i]&  0xff;
+}

I know you hate this kind of thing, but I think MSVC is going to complain about comparisons between signed and unsigned types in the i < n expression because 'i' is int and not GLuint like 'n'.

Same thing in patch 02/17.

-Brian
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to