summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/format_info.py
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2014-08-23 10:45:00 -0700
committerIago Toral Quiroga <[email protected]>2015-01-12 11:20:28 +0100
commit3da735cc4c478b0ab2ecc2164899cf9d77dc671a (patch)
tree4158684e428ad25b4708a51556d409b2f0b94a02 /src/mesa/main/format_info.py
parent382d097e546cb7568bef4fa552dcd84535271845 (diff)
main: Add a concept of an array format
An array format is a 32-bit integer format identifier that can represent any format that can be represented as an array of standard GL datatypes. Whie the MESA_FORMAT enums provide several of these, they don't account for all of them. v2 by Iago Toral Quiroga <[email protected]>: - Implement mesa_array_format as a plain bitfiled uint32_t type instead of using a struct inside a union to access the various components packed in it. This is necessary to support bigendian properly, as pointed out by Ian. - Squashed: Make float types normalized v3 by Iago Toral Quiroga <[email protected]>: - Include compiler.h in formats.h, which is necessary to build in MSVC as indicated by Brian Paul. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa/main/format_info.py')
-rw-r--r--src/mesa/main/format_info.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mesa/main/format_info.py b/src/mesa/main/format_info.py
index 7424fe0cd5a..fe2063d7ad1 100644
--- a/src/mesa/main/format_info.py
+++ b/src/mesa/main/format_info.py
@@ -192,6 +192,22 @@ for fmat in formats:
int(fmat.block_size() / 8))
print ' {{ {0} }},'.format(', '.join(map(str, fmat.swizzle)))
+ if fmat.is_array():
+ chan = fmat.array_element()
+ norm = chan.norm or chan.type == parser.FLOAT
+ print ' MESA_ARRAY_FORMAT({0}),'.format(', '.join([
+ str(chan.size / 8),
+ str(int(chan.sign)),
+ str(int(chan.type == parser.FLOAT)),
+ str(int(norm)),
+ str(len(fmat.channels)),
+ str(fmat.swizzle[0]),
+ str(fmat.swizzle[1]),
+ str(fmat.swizzle[2]),
+ str(fmat.swizzle[3]),
+ ]))
+ else:
+ print ' 0,'
print ' },'
print '};'