mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-03 05:00:09 +01:00
util/format: Add RGB lowering for single plane YUV formats
This fixes a regression with Y8_400 format, which needs to return
R8 as plane format.
Fixes: 5e01ec4bd0 ("util/format: Auto-generate a bunch of YUV helpers")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37056>
This commit is contained in:
parent
cb1c059138
commit
ac896c0327
1 changed files with 13 additions and 2 deletions
|
|
@ -431,16 +431,27 @@ def write_get_plane_format(formats):
|
|||
'X4B12X4R12': 'X4R12X4G12',
|
||||
}
|
||||
|
||||
# On some YUV formats, we don't want RGB lowering
|
||||
no_rgb_lowering = ['Y8_UNORM']
|
||||
|
||||
print('static inline enum pipe_format', file=sys.stdout3)
|
||||
print('util_format_get_plane_format(enum pipe_format format, unsigned plane)', file=sys.stdout3)
|
||||
print('{', file=sys.stdout3)
|
||||
print(' switch (format) {', file=sys.stdout3)
|
||||
unhandled_formats = []
|
||||
for f in formats:
|
||||
if f.layout not in ['planar2', 'planar3']:
|
||||
if f.layout not in ['planar2', 'planar3'] and f.colorspace != 'YUV':
|
||||
continue
|
||||
nplanes = 3 if f.layout == 'planar3' else 2
|
||||
|
||||
if f.short_name().upper() in no_rgb_lowering:
|
||||
unhandled_formats += [f.name]
|
||||
continue
|
||||
|
||||
nplanes = int(f.layout[-1]) if f.layout.startswith('planar') else 1
|
||||
planes = f.short_name().upper().split('_')
|
||||
if planes[-1] == 'PACKED':
|
||||
planes.pop(-1)
|
||||
|
||||
assert(planes[-1] == 'UNORM')
|
||||
planes.pop(-1)
|
||||
if planes[-1] in CHROMA_SUBSAMP:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue