summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Benton <jbenton@vmware.com>2012-04-19 18:13:14 +0100
committerJosé Fonseca <jfonseca@vmware.com>2012-05-02 10:24:33 +0100
commitf64fe7d333ef5f00f1d13d19c9b986abe21a524c (patch)
tree1f5b856fcb8a83141b2669e2a9fa7b0da78369d3 /src
parent16b081f1b0acf3158423c9fbed69c85807ce5276 (diff)
gallivm: added a debug function which allows llvm to print vectors of 16 unsigned ints
This is useful for debugging the linear llvm path as it handles pixels in this format Signed-off-by: José Fonseca <jfonseca@vmware.com>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_printf.c25
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_printf.h4
2 files changed, 29 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.c b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
index 56ff4269588..0d8d8065cb9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_printf.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.c
@@ -170,3 +170,28 @@ lp_build_print_ivec4(struct gallivm_state *gallivm,
util_snprintf(format, sizeof(format), "%s %%i %%i %%i %%i\n", msg);
return lp_build_printf(gallivm, format, x, y, z, w);
}
+
+
+/**
+ * Print a uint8[16] vector.
+ */
+LLVMValueRef
+lp_build_print_uvec16(struct gallivm_state *gallivm,
+ const char *msg, LLVMValueRef vec)
+{
+ LLVMBuilderRef builder = gallivm->builder;
+ char format[1000];
+ LLVMValueRef args[16];
+
+ for(int i = 0; i < 16; ++i)
+ args[i] = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(gallivm, i), "");
+
+ util_snprintf(format, sizeof(format), "%s %%u %%u %%u %%u %%u %%u %%u %%u %%u %%u %%u %%u %%u %%u %%u %%u\n", msg);
+
+ return lp_build_printf(
+ gallivm, format,
+ args[ 0], args[ 1], args[ 2], args[ 3],
+ args[ 4], args[ 5], args[ 6], args[ 7],
+ args[ 8], args[ 9], args[10], args[11],
+ args[12], args[13], args[14], args[15]);
+}
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_printf.h b/src/gallium/auxiliary/gallivm/lp_bld_printf.h
index 79db74d8886..ec087fd4015 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_printf.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_printf.h
@@ -49,5 +49,9 @@ LLVMValueRef
lp_build_print_ivec4(struct gallivm_state *gallivm,
const char *msg, LLVMValueRef vec);
+LLVMValueRef
+lp_build_print_uvec16(struct gallivm_state *gallivm,
+ const char *msg, LLVMValueRef vec);
+
#endif