Mesa (master): nir/lower_tex: do not stumble on 16-bit inputs

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 19 14:49:52 UTC 2021


Module: Mesa
Branch: master
Commit: 788698383528c3fa3265da476b9dc255353f8bc2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=788698383528c3fa3265da476b9dc255353f8bc2

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Wed Apr  7 19:29:40 2021 +0200

nir/lower_tex: do not stumble on 16-bit inputs

If a has been lowered to float16 here, then we end up trying to
construct a vector of mixed precision, which the validator asserts
about.

So let's make sure we use the same type for all arguments.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10201>

---

 src/compiler/nir/nir_lower_tex.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 1ac838a349d..7af7d9d0f18 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -324,9 +324,9 @@ convert_yuv_to_rgb(nir_builder *b, nir_tex_instr *tex,
 
    nir_ssa_def *offset =
       nir_vec4(b,
-               nir_imm_float(b, offset_vals[0]),
-               nir_imm_float(b, offset_vals[1]),
-               nir_imm_float(b, offset_vals[2]),
+               nir_imm_floatN_t(b, offset_vals[0], a->bit_size),
+               nir_imm_floatN_t(b, offset_vals[1], a->bit_size),
+               nir_imm_floatN_t(b, offset_vals[2], a->bit_size),
                a);
 
    offset = nir_f2fN(b, offset, bit_size);



More information about the mesa-commit mailing list