Mesa (master): util: Add a fetch_rgba_8unorm.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri Jul 2 17:46:10 UTC 2010


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Fri Jul  2 18:38:11 2010 +0100

util: Add a fetch_rgba_8unorm.

Not always implemented, but useful in situations where we want 8unorms
and the samples comes as 8unorms as we needlessly convert to/from
floats.

---

 src/gallium/auxiliary/util/u_format.h        |   10 ++++++++++
 src/gallium/auxiliary/util/u_format_table.py |    5 +++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h
index a4f2829..38254b1 100644
--- a/src/gallium/auxiliary/util/u_format.h
+++ b/src/gallium/auxiliary/util/u_format.h
@@ -213,6 +213,16 @@ struct util_format_description
                        unsigned width, unsigned height);
 
    /**
+    * Fetch a single pixel (i, j) from a block.
+    *
+    * XXX: Only defined for a very few select formats.
+    */
+   void
+   (*fetch_rgba_8unorm)(uint8_t *dst,
+                        const uint8_t *src,
+                        unsigned i, unsigned j);
+
+   /**
     * Unpack pixel blocks to R32G32B32A32_FLOAT.
     * Note: strides are in bytes.
     *
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
index ae9a598..f0b407b 100755
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -132,12 +132,17 @@ def write_format_table(formats):
         if format.colorspace != ZS:
             print "   &util_format_%s_unpack_rgba_8unorm," % format.short_name() 
             print "   &util_format_%s_pack_rgba_8unorm," % format.short_name() 
+            if format.layout == 's3tc':
+                print "   &util_format_%s_fetch_rgba_8unorm," % format.short_name()
+            else:
+                print "   NULL, /* fetch_rgba_8unorm */" 
             print "   &util_format_%s_unpack_rgba_float," % format.short_name() 
             print "   &util_format_%s_pack_rgba_float," % format.short_name() 
             print "   &util_format_%s_fetch_rgba_float," % format.short_name()
         else:
             print "   NULL, /* unpack_rgba_8unorm */" 
             print "   NULL, /* pack_rgba_8unorm */" 
+            print "   NULL, /* fetch_rgba_8unorm */" 
             print "   NULL, /* unpack_rgba_float */" 
             print "   NULL, /* pack_rgba_float */" 
             print "   NULL, /* fetch_rgba_float */" 




More information about the mesa-commit mailing list