[Mesa-dev] [PATCH 1/3] ac/nir: add support for discard_if intrinsic
Dave Airlie
airlied at gmail.com
Wed Nov 2 01:26:09 UTC 2016
From: Dave Airlie <airlied at redhat.com>
We are going to start lowering to this in NIR code,
so prepare radv for it.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/amd/common/ac_nir_to_llvm.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index a655806..aa821e0 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -2614,6 +2614,16 @@ static void emit_barrier(struct nir_to_llvm_context *ctx)
ctx->voidt, NULL, 0, 0);
}
+static void emit_discard_if(struct nir_to_llvm_context *ctx,
+ nir_intrinsic_instr *instr)
+{
+ LLVMValueRef cond = get_src(ctx, instr->src[0]);
+ ctx->shader_info->fs.can_discard = true;
+ emit_llvm_intrinsic(ctx, "llvm.AMDGPU.kill",
+ LLVMVoidTypeInContext(ctx->context),
+ &cond, 1, 0);
+}
+
static LLVMValueRef
visit_load_local_invocation_index(struct nir_to_llvm_context *ctx)
{
@@ -2926,6 +2936,9 @@ static void visit_intrinsic(struct nir_to_llvm_context *ctx,
LLVMVoidTypeInContext(ctx->context),
NULL, 0, 0);
break;
+ case nir_intrinsic_discard_if:
+ emit_discard_if(ctx, instr);
+ break;
case nir_intrinsic_memory_barrier:
emit_waitcnt(ctx);
break;
--
2.7.4
More information about the mesa-dev
mailing list