freedreno/ir3: Implement tess coord intrinsic
authorKristian H. Kristensen <hoegsberg@google.com>
Wed, 23 Oct 2019 02:29:07 +0000 (19:29 -0700)
committerKristian H. Kristensen <hoegsberg@google.com>
Fri, 8 Nov 2019 00:37:08 +0000 (16:37 -0800)
Our lowering pass made the z component unused by replacing its uses
by 1 - x - y.  The intrinsic implementation then just need to return
the x and y components.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
src/freedreno/ir3/ir3_compiler_nir.c

index 8ed5b2f91fa28b59c5a1ca194268b6af08ede11b..b2068a354667f2ab4ba2702415b5543faafb3b82 100644 (file)
@@ -1394,6 +1394,18 @@ emit_intrinsic(struct ir3_context *ctx, nir_intrinsic_instr *intr)
                dst[0] = ctx->primitive_id;
                break;
 
+       case nir_intrinsic_load_tess_coord:
+               if (!ctx->tess_coord) {
+                       ctx->tess_coord = create_input_compmask(ctx, 0, 0x3);
+                       add_sysval_input_compmask(ctx, SYSTEM_VALUE_TESS_COORD,
+                                                                         0x3, ctx->tess_coord);
+               }
+               ir3_split_dest(b, dst, ctx->tess_coord, 0, 2);
+
+               /* Unused, but ir3_put_dst() below wants to free something */
+               dst[2] = create_immed(b, 0);
+               break;
+
        case nir_intrinsic_store_global_ir3: {
                struct ir3_instruction *value, *addr, *offset;