From: Nicolai Hähnle <nicolai.haeh...@amd.com>

---
 src/amd/common/ac_nir_to_llvm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 9c17fd9..751a4f6 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -58,20 +58,21 @@ struct nir_to_llvm_context;
 
 struct ac_nir_context {
        struct ac_llvm_context ac;
        struct ac_shader_abi *abi;
 
        gl_shader_stage stage;
 
        struct hash_table *defs;
        struct hash_table *phis;
 
+       LLVMValueRef main_function;
        LLVMBasicBlockRef continue_block;
        LLVMBasicBlockRef break_block;
 
        LLVMValueRef outputs[RADEON_LLVM_MAX_OUTPUTS * 4];
 
        int num_locals;
        LLVMValueRef *locals;
 
        struct nir_to_llvm_context *nctx; /* TODO get rid of this */
 };
@@ -5912,20 +5913,22 @@ void ac_nir_translate(struct ac_llvm_context *ac, 
struct ac_shader_abi *abi,
 
        ctx.ac = *ac;
        ctx.abi = abi;
 
        ctx.nctx = nctx;
        if (nctx)
                nctx->nir = &ctx;
 
        ctx.stage = nir->stage;
 
+       ctx.main_function = 
LLVMGetBasicBlockParent(LLVMGetInsertBlock(ctx.ac.builder));
+
        nir_foreach_variable(variable, &nir->outputs)
                handle_shader_output_decl(&ctx, nir, variable);
 
        ctx.defs = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
                                           _mesa_key_pointer_equal);
        ctx.phis = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
                                           _mesa_key_pointer_equal);
 
        func = (struct nir_function *)exec_list_get_head(&nir->functions);
 
-- 
2.9.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to