print(" },")
for format in formats:
+ sn = format.short_name()
+
print('const struct util_format_description')
- print('util_format_%s_description = {' % (format.short_name(),))
+ print('util_format_%s_description = {' % (sn,))
print(" %s," % (format.name,))
print(" \"%s\"," % (format.name,))
- print(" \"%s\"," % (format.short_name(),))
+ print(" \"%s\"," % (sn,))
print(" {%u, %u, %u, %u},\t/* block */" % (format.block_width, format.block_height, format.block_depth, format.block_size()))
print(" %s," % (layout_map(format.layout),))
print(" %u,\t/* nr_channels */" % (format.nr_channels(),))
access = True
if format.layout in ('astc', 'atc', 'fxt1'):
access = False
- if format.layout == 'etc' and format.short_name() != 'etc1_rgb8':
+ if format.layout == 'etc' and sn != 'etc1_rgb8':
access = False
if format.colorspace != ZS and not format.is_pure_color() and access:
- print(" &util_format_%s_unpack_rgba_8unorm," % format.short_name())
- print(" &util_format_%s_pack_rgba_8unorm," % format.short_name())
+ print(" .unpack_rgba_8unorm = &util_format_%s_unpack_rgba_8unorm," % sn)
+ print(" .pack_rgba_8unorm = &util_format_%s_pack_rgba_8unorm," % sn)
if format.layout == 's3tc' or format.layout == 'rgtc':
- 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 */")
+ print(" .fetch_rgba_8unorm = &util_format_%s_fetch_rgba_8unorm," % sn)
+ print(" .unpack_rgba_float = &util_format_%s_unpack_rgba_float," % sn)
+ print(" .pack_rgba_float = &util_format_%s_pack_rgba_float," % sn)
+ print(" .fetch_rgba_float = &util_format_%s_fetch_rgba_float," % sn)
+
if format.has_depth():
- print(" &util_format_%s_unpack_z_32unorm," % format.short_name())
- print(" &util_format_%s_pack_z_32unorm," % format.short_name())
- print(" &util_format_%s_unpack_z_float," % format.short_name())
- print(" &util_format_%s_pack_z_float," % format.short_name())
- else:
- print(" NULL, /* unpack_z_32unorm */")
- print(" NULL, /* pack_z_32unorm */")
- print(" NULL, /* unpack_z_float */")
- print(" NULL, /* pack_z_float */")
+ print(" .unpack_z_32unorm = &util_format_%s_unpack_z_32unorm," % sn)
+ print(" .pack_z_32unorm = &util_format_%s_pack_z_32unorm," % sn)
+ print(" .unpack_z_float = &util_format_%s_unpack_z_float," % sn)
+ print(" .pack_z_float = &util_format_%s_pack_z_float," % sn)
+
if format.has_stencil():
- print(" &util_format_%s_unpack_s_8uint," % format.short_name())
- print(" &util_format_%s_pack_s_8uint," % format.short_name())
- else:
- print(" NULL, /* unpack_s_8uint */")
- print(" NULL, /* pack_s_8uint */")
+ print(" .unpack_s_8uint = &util_format_%s_unpack_s_8uint," % sn)
+ print(" .pack_s_8uint = &util_format_%s_pack_s_8uint," % sn)
+
if format.is_pure_unsigned():
- print(" &util_format_%s_unpack_unsigned, /* unpack_rgba_uint */" % format.short_name())
- print(" &util_format_%s_pack_unsigned, /* pack_rgba_uint */" % format.short_name())
- print(" NULL, /* unpack_rgba_sint */")
- print(" &util_format_%s_pack_signed, /* pack_rgba_sint */" % format.short_name())
- print(" &util_format_%s_fetch_unsigned, /* fetch_rgba_uint */" % format.short_name())
- print(" NULL /* fetch_rgba_sint */")
+ print(" .unpack_rgba_uint = &util_format_%s_unpack_unsigned," % sn)
+ print(" .pack_rgba_uint = &util_format_%s_pack_unsigned," % sn)
+ print(" .pack_rgba_sint = &util_format_%s_pack_signed," % sn)
+ print(" .fetch_rgba_uint = &util_format_%s_fetch_unsigned," % sn)
elif format.is_pure_signed():
- print(" NULL, /* unpack_rgba_uint */")
- print(" &util_format_%s_pack_unsigned, /* pack_rgba_uint */" % format.short_name())
- print(" &util_format_%s_unpack_signed, /* unpack_rgba_sint */" % format.short_name())
- print(" &util_format_%s_pack_signed, /* pack_rgba_sint */" % format.short_name())
- print(" NULL, /* fetch_rgba_uint */")
- print(" &util_format_%s_fetch_signed /* fetch_rgba_sint */" % format.short_name())
- else:
- print(" NULL, /* unpack_rgba_uint */")
- print(" NULL, /* pack_rgba_uint */")
- print(" NULL, /* unpack_rgba_sint */")
- print(" NULL, /* pack_rgba_sint */")
- print(" NULL, /* fetch_rgba_uint */")
- print(" NULL /* fetch_rgba_sint */")
+ print(" .pack_rgba_uint = &util_format_%s_pack_unsigned," % sn)
+ print(" .unpack_rgba_sint = &util_format_%s_unpack_signed," % sn)
+ print(" .pack_rgba_sint = &util_format_%s_pack_signed," % sn)
+ print(" .fetch_rgba_sint = &util_format_%s_fetch_signed," % sn)
print("};")
print()