gallivm: added lp_build_print_ivec4() function
authorBrian Paul <brianp@vmware.com>
Sun, 23 Oct 2011 16:02:53 +0000 (10:02 -0600)
committerBrian Paul <brianp@vmware.com>
Sun, 23 Oct 2011 16:09:33 +0000 (10:09 -0600)
src/gallium/auxiliary/gallivm/lp_bld_printf.c
src/gallium/auxiliary/gallivm/lp_bld_printf.h

index 60cc6094f5a362f72defe1b18e96c6bd92a5d39f..56ff42695880381fbe728107a03ca585acf28b08 100644 (file)
@@ -149,3 +149,24 @@ lp_build_print_vec4(struct gallivm_state *gallivm,
    util_snprintf(format, sizeof(format), "%s %%f %%f %%f %%f\n", msg);
    return lp_build_printf(gallivm, format, x, y, z, w);
 }
+
+
+/**
+ * Print a intt[4] vector.
+ */
+LLVMValueRef
+lp_build_print_ivec4(struct gallivm_state *gallivm,
+                    const char *msg, LLVMValueRef vec)
+{
+   LLVMBuilderRef builder = gallivm->builder;
+   char format[1000];
+   LLVMValueRef x, y, z, w;
+
+   x = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(gallivm, 0), "");
+   y = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(gallivm, 1), "");
+   z = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(gallivm, 2), "");
+   w = LLVMBuildExtractElement(builder, vec, lp_build_const_int32(gallivm, 3), "");
+
+   util_snprintf(format, sizeof(format), "%s %%i %%i %%i %%i\n", msg);
+   return lp_build_printf(gallivm, format, x, y, z, w);
+}
index f6bb8348699e9c4231d61df3fc66fe27643c86ed..79db74d88861b16e406b1b88dc08451c20cf335b 100644 (file)
@@ -45,6 +45,9 @@ LLVMValueRef
 lp_build_print_vec4(struct gallivm_state *gallivm,
                     const char *msg, LLVMValueRef vec);
 
+LLVMValueRef
+lp_build_print_ivec4(struct gallivm_state *gallivm,
+                     const char *msg, LLVMValueRef vec);
 
 #endif