- if format.layout == PLAIN:
- generate_format_type(format)
-
- channel = Channel(FLOAT, False, 32)
- native_type = 'float'
- suffix = '4f'
-
- generate_unpack(formats, channel, native_type, suffix)
- generate_pack(formats, channel, native_type, suffix)
-
- channel = Channel(UNSIGNED, True, 8)
- native_type = 'uint8_t'
- suffix = '4ub'
+ if not is_format_hand_written(format):
+
+ if is_format_supported(format):
+ generate_format_type(format)
+
+ if format.is_pure_unsigned():
+ native_type = 'unsigned'
+ suffix = 'unsigned'
+ channel = Channel(UNSIGNED, False, True, 32)
+
+ generate_format_unpack(format, channel, native_type, suffix)
+ generate_format_pack(format, channel, native_type, suffix)
+ generate_format_fetch(format, channel, native_type, suffix)
+
+ channel = Channel(SIGNED, False, True, 32)
+ native_type = 'int'
+ suffix = 'signed'
+ generate_format_unpack(format, channel, native_type, suffix)
+ generate_format_pack(format, channel, native_type, suffix)
+ elif format.is_pure_signed():
+ native_type = 'int'
+ suffix = 'signed'
+ channel = Channel(SIGNED, False, True, 32)
+
+ generate_format_unpack(format, channel, native_type, suffix)
+ generate_format_pack(format, channel, native_type, suffix)
+ generate_format_fetch(format, channel, native_type, suffix)
+
+ native_type = 'unsigned'
+ suffix = 'unsigned'
+ channel = Channel(UNSIGNED, False, True, 32)
+ generate_format_unpack(format, channel, native_type, suffix)
+ generate_format_pack(format, channel, native_type, suffix)
+ else:
+ channel = Channel(FLOAT, False, False, 32)
+ native_type = 'float'
+ suffix = 'rgba_float'