mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-06 17:30:20 +01:00
gallivm: Use debug_printf in lp_build_printf.
So that its output can be seen on GUI window apps. Tested-by: James Benton <jbenton@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
parent
9ad2cb1885
commit
494619ebac
1 changed files with 9 additions and 6 deletions
|
|
@ -81,17 +81,20 @@ lp_build_printf(struct gallivm_state *gallivm, const char *fmt, ...)
|
|||
int argcount = lp_get_printf_arg_count(fmt);
|
||||
LLVMBuilderRef builder = gallivm->builder;
|
||||
LLVMContextRef context = gallivm->context;
|
||||
LLVMModuleRef module = gallivm->module;
|
||||
LLVMValueRef params[50];
|
||||
LLVMValueRef fmtarg = lp_build_const_string(gallivm, fmt);
|
||||
LLVMValueRef func_printf = LLVMGetNamedFunction(module, "printf");
|
||||
LLVMTypeRef printf_type;
|
||||
LLVMValueRef func_printf;
|
||||
|
||||
assert(Elements(params) >= argcount + 1);
|
||||
|
||||
if (!func_printf) {
|
||||
LLVMTypeRef printf_type = LLVMFunctionType(LLVMIntTypeInContext(context, 32), NULL, 0, 1);
|
||||
func_printf = LLVMAddFunction(module, "printf", printf_type);
|
||||
}
|
||||
printf_type = LLVMFunctionType(LLVMIntTypeInContext(context, 32), NULL, 0, 1);
|
||||
|
||||
func_printf = lp_build_const_int_pointer(gallivm, func_to_pointer((func_pointer)debug_printf));
|
||||
|
||||
func_printf = LLVMBuildBitCast(gallivm->builder, func_printf,
|
||||
LLVMPointerType(printf_type, 0),
|
||||
"debug_printf");
|
||||
|
||||
params[0] = fmtarg;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue