aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/nir/nir_lower_tex.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c
index 8f373ddf67a..46bcc8b6d1f 100644
--- a/src/compiler/nir/nir_lower_tex.c
+++ b/src/compiler/nir/nir_lower_tex.c
@@ -240,7 +240,8 @@ sample_plane(nir_builder *b, nir_tex_instr *tex, int plane,
plane_tex->texture_index = tex->texture_index;
plane_tex->sampler_index = tex->sampler_index;
- nir_ssa_dest_init(&plane_tex->instr, &plane_tex->dest, 4, 32, NULL);
+ nir_ssa_dest_init(&plane_tex->instr, &plane_tex->dest, 4,
+ nir_dest_bit_size(tex->dest), NULL);
nir_builder_instr_insert(b, &plane_tex->instr);
@@ -262,6 +263,7 @@ convert_yuv_to_rgb(nir_builder *b, nir_tex_instr *tex,
{ { .f32 = 0.0f }, { .f32 = -0.39176229f }, { .f32 = 2.01723214f }, { .f32 = 0.0f } },
{ { .f32 = 1.59602678f }, { .f32 = -0.81296764f }, { .f32 = 0.0f }, { .f32 = 0.0f } },
};
+ unsigned bit_size = nir_dest_bit_size(tex->dest);
nir_ssa_def *offset =
nir_vec4(b,
@@ -270,11 +272,14 @@ convert_yuv_to_rgb(nir_builder *b, nir_tex_instr *tex,
nir_imm_float(b, -1.085630787f),
a);
+ offset = nir_f2fN(b, offset, bit_size);
+
+ nir_ssa_def *m0 = nir_f2fN(b, nir_build_imm(b, 4, 32, m[0]), bit_size);
+ nir_ssa_def *m1 = nir_f2fN(b, nir_build_imm(b, 4, 32, m[1]), bit_size);
+ nir_ssa_def *m2 = nir_f2fN(b, nir_build_imm(b, 4, 32, m[2]), bit_size);
+
nir_ssa_def *result =
- nir_ffma(b, y, nir_build_imm(b, 4, 32, m[0]),
- nir_ffma(b, u, nir_build_imm(b, 4, 32, m[1]),
- nir_ffma(b, v, nir_build_imm(b, 4, 32, m[2]),
- offset)));
+ nir_ffma(b, y, m0, nir_ffma(b, u, m1, nir_ffma(b, v, m2, offset)));
nir_ssa_def_rewrite_uses(&tex->dest.ssa, nir_src_for_ssa(result));
}