diff options
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 16 | ||||
-rw-r--r-- | src/amd/common/ac_llvm_build.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index f0ab9cb1367..a569a7c30f1 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -1105,3 +1105,19 @@ LLVMValueRef ac_emit_cvt_pkrtz_f16(struct ac_llvm_context *ctx, AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_LEGACY); } + +/** + * KILL, AKA discard in GLSL. + * + * \param value kill if value < 0.0 or value == NULL. + */ +void ac_emit_kill(struct ac_llvm_context *ctx, LLVMValueRef value) +{ + if (value) { + ac_emit_llvm_intrinsic(ctx, "llvm.AMDGPU.kill", ctx->voidt, + &value, 1, AC_FUNC_ATTR_LEGACY); + } else { + ac_emit_llvm_intrinsic(ctx, "llvm.AMDGPU.kilp", ctx->voidt, + NULL, 0, AC_FUNC_ATTR_LEGACY); + } +} diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index e6e4e434e2e..af16a2bca73 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -236,6 +236,7 @@ LLVMValueRef ac_emit_image_opcode(struct ac_llvm_context *ctx, struct ac_image_args *a); LLVMValueRef ac_emit_cvt_pkrtz_f16(struct ac_llvm_context *ctx, LLVMValueRef args[2]); +void ac_emit_kill(struct ac_llvm_context *ctx, LLVMValueRef value); #ifdef __cplusplus } |