diff options
author | Dave Airlie <airlied@redhat.com> | 2016-11-02 01:21:15 +0000 |
---|---|---|
committer | Emil Velikov <emil.l.velikov@gmail.com> | 2016-11-09 23:39:46 +0000 |
commit | a65b6e12f357c9a3022f9d3954002254c7f3ab6e (patch) | |
tree | c6cb95e28108076a36eeb6bd0c42e57a70a8206b | |
parent | ce555a7d1ff436267d4606cd48d2d17d36335311 (diff) | |
download | external_mesa3d-a65b6e12f357c9a3022f9d3954002254c7f3ab6e.zip external_mesa3d-a65b6e12f357c9a3022f9d3954002254c7f3ab6e.tar.gz external_mesa3d-a65b6e12f357c9a3022f9d3954002254c7f3ab6e.tar.bz2 |
ac/nir: add support for discard_if intrinsic (v2)
We are going to start lowering to this in NIR code,
so prepare radv for it.
v2: handle conversion to kilp properly (nha)
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
(cherry picked from commit dd77faeca2819fc78a72f71ca9b996c209378cde)
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 45ce27a..f235cc2 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -2609,6 +2609,24 @@ 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; + ctx->shader_info->fs.can_discard = true; + + cond = LLVMBuildICmp(ctx->builder, LLVMIntNE, + get_src(ctx, instr->src[0]), + ctx->i32zero, ""); + + cond = LLVMBuildSelect(ctx->builder, cond, + LLVMConstReal(ctx->f32, -1.0f), + ctx->f32zero, ""); + 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) { @@ -2921,6 +2939,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; |