pan/mdg: Fix derivative swizzle
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Mon, 11 May 2020 13:20:39 +0000 (09:20 -0400)
committerMarge Bot <eric+marge@anholt.net>
Tue, 12 May 2020 22:30:42 +0000 (22:30 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5014>

src/panfrost/midgard/midgard_derivatives.c

index c9c6c028658402d22f02555e47376030bc442787..5c01ebaf64a0cd0746923350742c69e739e165f2 100644 (file)
@@ -103,7 +103,8 @@ midgard_emit_derivatives(compiler_context *ctx, nir_alu_instr *instr)
                 .mask = mask_of(nr_components),
                 .dest = nir_dest_index(&instr->dest.dest),
                 .dest_type = nir_type_float32,
-                .src = { nir_src_index(ctx, &instr->src[0].src), ~0, ~0, ~0 },
+                .src = { ~0, nir_src_index(ctx, &instr->src[0].src), ~0, ~0 },
+                .swizzle = SWIZZLE_IDENTITY_4,
                 .src_types = { nir_type_float32, nir_type_float32 },
                 .texture = {
                         .op = mir_derivative_op(instr->op),
@@ -114,9 +115,6 @@ midgard_emit_derivatives(compiler_context *ctx, nir_alu_instr *instr)
                 }
         };
 
-        ins.swizzle[0][2] = ins.swizzle[0][3] = COMPONENT_X;
-        ins.swizzle[1][2] = ins.swizzle[1][3] = COMPONENT_X;
-
         if (!instr->dest.dest.is_ssa)
                 ins.mask &= instr->dest.write_mask;