mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-21 22:20:14 +01:00
nir/lower_tex: Add support for lowering Y41x formats
These are similar to AYUV, but the channel ordering is different... in
such a way that there's no RGBA format that will make the channels line
up right.
v2: Rebase on bc438c91d9 ("nir/lower_tex: ignore texture_index if
tex_instr has deref src")
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9610>
This commit is contained in:
parent
671f94c5b9
commit
1358d93650
2 changed files with 24 additions and 0 deletions
|
|
@ -4721,6 +4721,7 @@ typedef struct nir_lower_tex_options {
|
||||||
unsigned lower_ayuv_external;
|
unsigned lower_ayuv_external;
|
||||||
unsigned lower_xyuv_external;
|
unsigned lower_xyuv_external;
|
||||||
unsigned lower_yuv_external;
|
unsigned lower_yuv_external;
|
||||||
|
unsigned lower_y41x_external;
|
||||||
unsigned bt709_external;
|
unsigned bt709_external;
|
||||||
unsigned bt2020_external;
|
unsigned bt2020_external;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -436,6 +436,24 @@ lower_ayuv_external(nir_builder *b, nir_tex_instr *tex,
|
||||||
texture_index);
|
texture_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
lower_y41x_external(nir_builder *b, nir_tex_instr *tex,
|
||||||
|
const nir_lower_tex_options *options,
|
||||||
|
unsigned texture_index)
|
||||||
|
{
|
||||||
|
b->cursor = nir_after_instr(&tex->instr);
|
||||||
|
|
||||||
|
nir_ssa_def *y41x = sample_plane(b, tex, 0, options);
|
||||||
|
|
||||||
|
convert_yuv_to_rgb(b, tex,
|
||||||
|
nir_channel(b, y41x, 1),
|
||||||
|
nir_channel(b, y41x, 0),
|
||||||
|
nir_channel(b, y41x, 2),
|
||||||
|
nir_channel(b, y41x, 3),
|
||||||
|
options,
|
||||||
|
texture_index);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lower_xyuv_external(nir_builder *b, nir_tex_instr *tex,
|
lower_xyuv_external(nir_builder *b, nir_tex_instr *tex,
|
||||||
const nir_lower_tex_options *options,
|
const nir_lower_tex_options *options,
|
||||||
|
|
@ -1209,6 +1227,11 @@ nir_lower_tex_block(nir_block *block, nir_builder *b,
|
||||||
progress = true;
|
progress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((1 << tex->texture_index) & options->lower_y41x_external) {
|
||||||
|
lower_y41x_external(b, tex, options, texture_index);
|
||||||
|
progress = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (sat_mask) {
|
if (sat_mask) {
|
||||||
tex = saturate_src(b, tex, sat_mask);
|
tex = saturate_src(b, tex, sat_mask);
|
||||||
progress = true;
|
progress = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue