ac: fix ac_build_is_helper_invocation when postponed_kill is null
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tue, 24 Mar 2020 15:32:11 +0000 (16:32 +0100)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Wed, 25 Mar 2020 07:19:38 +0000 (08:19 +0100)
If there was no demote() in the shader, ac_build_is_helper_invocation
behaves exactly the same as ac_build_load_helper_invocation, i.e.
the helper lanes are the same as they were at the beginning of the shader.

Fixes: de57ea2a3da ("amd/llvm: implement nir_intrinsic_demote(_if) and nir_intrinsic_is_helper_invocation")
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4301>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4301>

src/amd/llvm/ac_llvm_build.c

index 373eb77b4a0c35b1e9126707de98cc200929b9c2..f13baf792fc27597cfe379370520222171ccb278 100644 (file)
@@ -4712,6 +4712,9 @@ ac_build_load_helper_invocation(struct ac_llvm_context *ctx)
 LLVMValueRef
 ac_build_is_helper_invocation(struct ac_llvm_context *ctx)
 {
+       if (!ctx->postponed_kill)
+               return ac_build_load_helper_invocation(ctx);
+
        /* !(exact && postponed) */
        LLVMValueRef exact = ac_build_intrinsic(ctx, "llvm.amdgcn.ps.live",
                                                ctx->i1, NULL, 0,