summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_format_table.py
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-03-31 15:30:14 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-03-31 15:32:16 +0100
commit96bf4aff5bd674bba5d83ab32c46024a686c1a1d (patch)
tree8b390af1baf73758e89204120c48d09857d9daac /src/gallium/auxiliary/util/u_format_table.py
parente245ca74e11869750cafb1ab3fbb6957100c554b (diff)
util: Put the format pack/unpack functions in the description table.
Diffstat (limited to 'src/gallium/auxiliary/util/u_format_table.py')
-rwxr-xr-xsrc/gallium/auxiliary/util/u_format_table.py36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py
index fb68852a53..fe910d9a77 100755
--- a/src/gallium/auxiliary/util/u_format_table.py
+++ b/src/gallium/auxiliary/util/u_format_table.py
@@ -33,6 +33,7 @@
import sys
from u_format_parse import *
+import u_format_pack
def layout_map(layout):
@@ -86,6 +87,27 @@ def write_format_table(formats):
print
print '#include "u_format.h"'
print
+ print '''
+static void
+util_format_none_unpack_8unorm(uint8_t *dst, const uint8_t *src, unsigned length)
+{
+}
+
+static void
+util_format_none_pack_8unorm(uint8_t *dst, const uint8_t *src, unsigned length)
+{
+}
+
+static void
+util_format_none_unpack_float(float *dst, const uint8_t *src, unsigned length)
+{
+}
+
+static void
+util_format_none_pack_float(uint8_t *dst, const float *src, unsigned length)
+{
+}
+ '''
print 'const struct util_format_description'
print 'util_format_none_description = {'
print " PIPE_FORMAT_NONE,"
@@ -99,9 +121,16 @@ def write_format_table(formats):
print " 0,"
print " {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},"
print " {0, 0, 0, 0},"
- print " 0"
+ print " 0,"
+ print " &util_format_none_unpack_8unorm,"
+ print " &util_format_none_pack_8unorm,"
+ print " &util_format_none_unpack_float,"
+ print " &util_format_none_pack_float"
print "};"
print
+
+ u_format_pack.generate(formats)
+
for format in formats:
print 'const struct util_format_description'
print 'util_format_%s_description = {' % (format.short_name(),)
@@ -140,8 +169,13 @@ def write_format_table(formats):
print " %s%s\t/* %s */" % (swizzle_map[swizzle], sep, comment)
print " },"
print " %s," % (colorspace_map(format.colorspace),)
+ print " &util_format_%s_unpack_8unorm," % format.short_name()
+ print " &util_format_%s_pack_8unorm," % format.short_name()
+ print " &util_format_%s_unpack_float," % format.short_name()
+ print " &util_format_%s_pack_float" % format.short_name()
print "};"
print
+
print "const struct util_format_description *"
print "util_format_description(enum pipe_format format)"
print "{"