llvmpipe: raise dirty flag on transfers to bound constbuf
[mesa.git] / src / gallium / drivers / llvmpipe / lp_test_printf.c
index 13485c377482d33b492a484adb266fdec1e21024..4653f30e39dd3d2b1c672f92eddbabaed417dea5 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 
+#include "util/u_pointer.h"
 #include "gallivm/lp_bld.h"
+#include "gallivm/lp_bld_init.h"
+#include "gallivm/lp_bld_assert.h"
 #include "gallivm/lp_bld_printf.h"
 
 #include <llvm-c/Analysis.h>
@@ -58,18 +61,6 @@ write_tsv_header(FILE *fp)
 
 typedef void (*test_printf_t)(int i);
 
-/** cast wrapper */
-static test_printf_t
-voidptr_to_test_printf_t(void *p)
-{
-   union {
-      void *v;
-      test_printf_t f;
-   } u;
-   u.v = p;
-   return u.f;
-}
-
 
 static LLVMValueRef
 add_printf_test(LLVMModuleRef module)
@@ -85,6 +76,10 @@ add_printf_test(LLVMModuleRef module)
    lp_build_printf(builder, "hello, world\n");
    lp_build_printf(builder, "print 5 6: %d %d\n", LLVMConstInt(LLVMInt32Type(), 5, 0),
                                LLVMConstInt(LLVMInt32Type(), 6, 0));
+
+   /* Also test lp_build_assert().  This should not fail. */
+   lp_build_assert(builder, LLVMConstInt(LLVMInt32Type(), 1, 0), "assert(1)");
+
    LLVMBuildRetVoid(builder);
    LLVMDisposeBuilder(builder);
    return func;
@@ -118,11 +113,16 @@ test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase)
    LLVMDisposeMessage(error);
 
    provider = LLVMCreateModuleProviderForExistingModule(module);
+#if 0
    if (LLVMCreateJITCompiler(&engine, provider, 1, &error)) {
       fprintf(stderr, "%s\n", error);
       LLVMDisposeMessage(error);
       abort();
    }
+#else
+   (void) provider;
+   engine = lp_build_engine;
+#endif
 
 #if 0
    pass = LLVMCreatePassManager();
@@ -140,7 +140,7 @@ test_printf(unsigned verbose, FILE *fp, const struct printf_test_case *testcase)
 #endif
 
    code = LLVMGetPointerToGlobal(engine, test);
-   test_printf = voidptr_to_test_printf_t(code);
+   test_printf = (test_printf_t)pointer_to_func(code);
 
    memset(unpacked, 0, sizeof unpacked);
    packed = 0;
@@ -176,3 +176,11 @@ test_some(unsigned verbose, FILE *fp, unsigned long n)
 {
    return test_all(verbose, fp);
 }
+
+
+boolean
+test_single(unsigned verbose, FILE *fp)
+{
+   printf("no test_single()");
+   return TRUE;
+}