util: Add a fetch_rgba_8unorm.
authorJosé Fonseca <jfonseca@vmware.com>
Fri, 2 Jul 2010 17:38:11 +0000 (18:38 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Fri, 2 Jul 2010 17:45:49 +0000 (18:45 +0100)
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
src/gallium/auxiliary/util/u_format_table.py

index a4f282979b0a5bb50dc110b59dc28a2a26199cb8..38254b1096dfe7063ee19819f8567c8fa3c22e4d 100644 (file)
@@ -212,6 +212,16 @@ struct util_format_description
                        const uint8_t *src, unsigned src_stride,
                        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.
index ae9a59819736c42b0a4ce5862f177bac058eb96d..f0b407b8b8e3840664215e249fc66f5fe0040bd6 100755 (executable)
@@ -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 */"