mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 17:48:10 +02:00
gallivm: added lp_build_print_vec4()
This commit is contained in:
parent
81d0a1fb3f
commit
991f0c2763
2 changed files with 24 additions and 0 deletions
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "lp_bld_const.h"
|
||||
#include "lp_bld_printf.h"
|
||||
|
||||
|
||||
|
|
@ -119,3 +120,22 @@ lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...)
|
|||
return LLVMBuildCall(builder, func_printf, params, argcount + 1, "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Print a float[4] vector.
|
||||
*/
|
||||
LLVMValueRef
|
||||
lp_build_print_vec4(LLVMBuilderRef builder, const char *msg, LLVMValueRef vec)
|
||||
{
|
||||
char format[1000];
|
||||
LLVMValueRef x, y, z, w;
|
||||
|
||||
x = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(0), "");
|
||||
y = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(1), "");
|
||||
z = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(2), "");
|
||||
w = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(3), "");
|
||||
|
||||
snprintf(format, sizeof(format), "%s %%f %%f %%f %%f\n", msg);
|
||||
return lp_build_printf(builder, format, x, y, z, w);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,5 +35,9 @@
|
|||
LLVMValueRef lp_build_const_string_variable(LLVMModuleRef module, const char *str, int len);
|
||||
LLVMValueRef lp_build_printf(LLVMBuilderRef builder, const char *fmt, ...);
|
||||
|
||||
LLVMValueRef
|
||||
lp_build_print_vec4(LLVMBuilderRef builder, const char *msg, LLVMValueRef vec);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue