diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index d5962826dee..3d4623b9d0e 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -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)));