freedreno: wire up core pipe_debug_callback
[mesa.git] / src / gallium / drivers / radeon / radeon_setup_tgsi_llvm.c
index 076d70ebc0bbb395ada46cf0507de0b1815a680e..08281973b2962bce4fa9306e492138d827c4090f 100644 (file)
@@ -363,12 +363,13 @@ static void emit_declaration(
                                        ctx->soa.bld_base.base.elem_type, "");
                        }
                }
-
-               ctx->output_reg_count = MAX2(ctx->output_reg_count,
-                                                        decl->Range.Last + 1);
                break;
        }
 
+       case TGSI_FILE_MEMORY:
+               ctx->declare_memory_region(ctx, decl);
+               break;
+
        default:
                break;
        }
@@ -1701,14 +1702,22 @@ void radeon_llvm_context_init(struct radeon_llvm_context * ctx, const char *trip
 }
 
 void radeon_llvm_create_func(struct radeon_llvm_context * ctx,
+                            LLVMTypeRef *return_types, unsigned num_return_elems,
                             LLVMTypeRef *ParamTypes, unsigned ParamCount)
 {
-       LLVMTypeRef main_fn_type;
+       LLVMTypeRef main_fn_type, ret_type;
        LLVMBasicBlockRef main_fn_body;
 
+       if (num_return_elems)
+               ret_type = LLVMStructTypeInContext(ctx->gallivm.context,
+                                                  return_types,
+                                                  num_return_elems, true);
+       else
+               ret_type = LLVMVoidTypeInContext(ctx->gallivm.context);
+
        /* Setup the function */
-       main_fn_type = LLVMFunctionType(LLVMVoidTypeInContext(ctx->gallivm.context),
-                                       ParamTypes, ParamCount, 0);
+       ctx->return_type = ret_type;
+       main_fn_type = LLVMFunctionType(ret_type, ParamTypes, ParamCount, 0);
        ctx->main_fn = LLVMAddFunction(ctx->gallivm.module, "main", main_fn_type);
        main_fn_body = LLVMAppendBasicBlockInContext(ctx->gallivm.context,
                        ctx->main_fn, "main_body");