util: Switch the non-block formats to unpacking rgba rows instead of rects.

We have only a few callers of unpack that do rects, so add a helper that
iterates over y adding the strides.  This saves us 36kb of generated code
and means that adding cpu-specific variants for RGBA format unpack will be
much simpler.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10014>
This commit is contained in:
Eric Anholt
2021-04-02 14:35:01 -07:00
committed by Marge Bot
parent 921b05f582
commit 2b5178ee48
11 changed files with 268 additions and 200 deletions
+9 -2
View File
@@ -255,10 +255,17 @@ def write_format_table(formats):
print(" [%s] = {" % (format.name,))
if format.colorspace != ZS and not format.is_pure_color():
print(" .unpack_rgba_8unorm = &util_format_%s_unpack_rgba_8unorm," % sn)
if format.layout == 's3tc' or format.layout == 'rgtc':
print(" .fetch_rgba_8unorm = &util_format_%s_fetch_rgba_8unorm," % sn)
print(" .unpack_rgba = &util_format_%s_unpack_rgba_float," % sn)
if format.block_width > 1:
print(
" .unpack_rgba_8unorm_rect = &util_format_%s_unpack_rgba_8unorm," % sn)
print(
" .unpack_rgba_rect = &util_format_%s_unpack_rgba_float," % sn)
else:
print(
" .unpack_rgba_8unorm = &util_format_%s_unpack_rgba_8unorm," % sn)
print(" .unpack_rgba = &util_format_%s_unpack_rgba_float," % sn)
if format.has_depth():
print(" .unpack_z_32unorm = &util_format_%s_unpack_z_32unorm," % sn)