summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/format_info.py
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2014-07-10 23:59:42 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2014-08-05 10:56:16 -0700
commit850fb0d1dca616179d3239a7b7bd94fe1979604c (patch)
tree55ba0e1b3f4f4d67a99c0a7905364e5fbcfc8317 /src/mesa/main/format_info.py
parent55a929955fa683a4e59ffb730ae37b645d10ba49 (diff)
downloadexternal_mesa3d-850fb0d1dca616179d3239a7b7bd94fe1979604c.zip
external_mesa3d-850fb0d1dca616179d3239a7b7bd94fe1979604c.tar.gz
external_mesa3d-850fb0d1dca616179d3239a7b7bd94fe1979604c.tar.bz2
mesa/formats: Add layout and swizzle information
v2: Move the MESA_FORMAT_SWIZZLE enum to the top of the file Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/main/format_info.py')
-rw-r--r--src/mesa/main/format_info.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py
index b8956a5..448bd00 100644
--- a/src/mesa/main/format_info.py
+++ b/src/mesa/main/format_info.py
@@ -96,6 +96,14 @@ def get_gl_data_type(fmat):
else:
assert False
+def get_mesa_layout(fmat):
+ if fmat.layout == 'array':
+ return 'MESA_FORMAT_LAYOUT_ARRAY'
+ elif fmat.layout == 'packed':
+ return 'MESA_FORMAT_LAYOUT_PACKED'
+ else:
+ return 'MESA_FORMAT_LAYOUT_OTHER'
+
def get_channel_bits(fmat, chan_name):
if fmat.is_compressed():
# These values are pretty-much bogus, but OpenGL requires that we
@@ -166,6 +174,7 @@ for fmat in formats:
print ' {'
print ' {0},'.format(fmat.name)
print ' "{0}",'.format(fmat.name)
+ print ' {0},'.format(get_mesa_layout(fmat))
print ' {0},'.format(get_gl_base_format(fmat))
print ' {0},'.format(get_gl_data_type(fmat))
@@ -176,6 +185,8 @@ for fmat in formats:
print ' {0}, {1}, {2},'.format(fmat.block_width, fmat.block_height,
int(fmat.block_size() / 8))
+
+ print ' {{ {0} }},'.format(', '.join(map(str, fmat.swizzle)))
print ' },'
print '};'