mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 15:58:05 +02:00
nir/lower_tex: Reinstate LSB to MSB shift
lower_sx10_external and lower_sx12_external are used for
LSB aligned formats such as DRM_FORMAT_S010, which are typically
used by software decoders. Unlike MSB aligned 10/12 bit formats
used by hardware decoders such as P010 they need to manually
get "shifted" in order to correctly map to the 0-1 range.
In the commit mentioned below the corresponding code got removed,
probably because it got confused with similar sounding code in
the common path - and because we don't have tests on the CI for the
affected formats yet.
Note: the formats in question are not yet supported in Vulkan.
Fixes: 5127568b98 ("compiler/nir: use common ycbcr math")
Signed-off-by: Robert Mader <robert.mader@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40561>
This commit is contained in:
parent
8483acdc29
commit
44fa9c8326
1 changed files with 10 additions and 0 deletions
|
|
@ -397,6 +397,16 @@ convert_yuv_to_rgb(nir_builder *b, nir_tex_instr *tex,
|
|||
nir_def *m1 = nir_f2fN(b, nir_build_imm(b, 4, 32, m.v[1]), bit_size);
|
||||
nir_def *m2 = nir_f2fN(b, nir_build_imm(b, 4, 32, m.v[2]), bit_size);
|
||||
|
||||
if (options->lower_sx10_external & (1u << texture_index)) {
|
||||
m0 = nir_fmul_imm(b, m0, 65535.0f / 1023.0f);
|
||||
m1 = nir_fmul_imm(b, m1, 65535.0f / 1023.0f);
|
||||
m2 = nir_fmul_imm(b, m2, 65535.0f / 1023.0f);
|
||||
} else if (options->lower_sx12_external & (1u << texture_index)) {
|
||||
m0 = nir_fmul_imm(b, m0, 65535.0f / 4095.0f);
|
||||
m1 = nir_fmul_imm(b, m1, 65535.0f / 4095.0f);
|
||||
m2 = nir_fmul_imm(b, m2, 65535.0f / 4095.0f);
|
||||
}
|
||||
|
||||
nir_def *result =
|
||||
nir_ffma(b, y, m0, nir_ffma(b, u, m1, nir_ffma(b, v, m2, offset)));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue