LLVMValueRef ac_build_load_helper_invocation(struct ac_llvm_context *ctx)
{
- LLVMValueRef result =
- ac_build_intrinsic(ctx, "llvm.amdgcn.ps.live", ctx->i1, NULL, 0, AC_FUNC_ATTR_READNONE);
+ LLVMValueRef result;
+
+ if (LLVM_VERSION_MAJOR >= 13) {
+ result = ac_build_intrinsic(ctx, "llvm.amdgcn.live.mask", ctx->i1, NULL, 0,
+ AC_FUNC_ATTR_READONLY | AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY);
+ } else {
+ result = ac_build_intrinsic(ctx, "llvm.amdgcn.ps.live", ctx->i1, NULL, 0,
+ AC_FUNC_ATTR_READNONE);
+ }
return LLVMBuildNot(ctx->builder, result, "");
}
if (!ctx->postponed_kill)
return ac_build_load_helper_invocation(ctx);
+ /* postponed_kill should be NULL on LLVM 13+ */
+ assert(LLVM_VERSION_MAJOR < 13);
+
/* !(exact && postponed) */
LLVMValueRef exact =
ac_build_intrinsic(ctx, "llvm.amdgcn.ps.live", ctx->i1, NULL, 0, AC_FUNC_ATTR_READNONE);
cond = ctx->ac.i1false;
}
+ if (LLVM_VERSION_MAJOR >= 13) {
+ /* This demotes the pixel if the condition is false. */
+ ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.wqm.demote", ctx->ac.voidt, &cond, 1, 0);
+ return;
+ }
+
LLVMValueRef mask = LLVMBuildLoad(ctx->ac.builder, ctx->ac.postponed_kill, "");
mask = LLVMBuildAnd(ctx->ac.builder, mask, cond, "");
LLVMBuildStore(ctx->ac.builder, mask, ctx->ac.postponed_kill);
if (gl_shader_stage_is_compute(nir->info.stage))
setup_shared(&ctx, nir);
- if (nir->info.stage == MESA_SHADER_FRAGMENT && nir->info.fs.uses_demote) {
+ if (nir->info.stage == MESA_SHADER_FRAGMENT && nir->info.fs.uses_demote &&
+ LLVM_VERSION_MAJOR < 13) {
/* true = don't kill. */
ctx.ac.postponed_kill = ac_build_alloca_init(&ctx.ac, ctx.ac.i1true, "");
}