nv50/ir/nir: implement intrinsic_discard(_if)
authorKarol Herbst <kherbst@redhat.com>
Wed, 13 Dec 2017 20:59:29 +0000 (21:59 +0100)
committerKarol Herbst <kherbst@redhat.com>
Sun, 17 Mar 2019 09:33:28 +0000 (10:33 +0100)
v9: use getSSA instead of new_LValue

Signed-off-by: Karol Herbst <kherbst@redhat.com>
src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp

index 70c4aecd69972d738ffd8431d12bbeb943b1b55f..5c372794e02792410dfe29ebc80ec8ab0eaafe7c 100644 (file)
@@ -1732,6 +1732,20 @@ Converter::visit(nir_intrinsic_instr *insn)
       loadImm(newDefs[1], mode);
       break;
    }
+   case nir_intrinsic_discard:
+      mkOp(OP_DISCARD, TYPE_NONE, NULL);
+      break;
+   case nir_intrinsic_discard_if: {
+      Value *pred = getSSA(1, FILE_PREDICATE);
+      if (insn->num_components > 1) {
+         ERROR("nir_intrinsic_discard_if only with 1 component supported!\n");
+         assert(false);
+         return false;
+      }
+      mkCmp(OP_SET, CC_NE, TYPE_U8, pred, TYPE_U32, getSrc(&insn->src[0], 0), zero);
+      mkOp(OP_DISCARD, TYPE_NONE, NULL)->setPredicate(CC_P, pred);
+      break;
+   }
    default:
       ERROR("unknown nir_intrinsic_op %s\n", nir_intrinsic_infos[op].name);
       return false;