nir: fix lower_wpos for 16-bit fddy
authorMarek Olšák <marek.olsak@amd.com>
Mon, 11 May 2020 06:56:47 +0000 (02:56 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 2 Jun 2020 20:01:18 +0000 (20:01 +0000)
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5002>

src/compiler/nir/nir_lower_wpos_ytransform.c

index d0a694f889b955027c56ff41e163099a2e442a98..2771f2afedef2bd0865930bc4aad16942657add9 100644 (file)
@@ -267,8 +267,11 @@ lower_fddy(lower_wpos_ytransform_state *state, nir_alu_instr *fddy)
    b->cursor = nir_before_instr(&fddy->instr);
 
    p = nir_ssa_for_alu_src(b, fddy, 0);
-   trans = get_transform(state);
-   pt = nir_fmul(b, p, nir_channel(b, trans, 0));
+   trans = nir_channel(b, get_transform(state), 0);
+   if (p->bit_size == 16)
+      trans = nir_f2f16(b, trans);
+
+   pt = nir_fmul(b, p, trans);
 
    nir_instr_rewrite_src(&fddy->instr,
                          &fddy->src[0].src,