llvmpipe: Avoid LLVMGetGlobalContext in tests.
[mesa.git] / src / gallium / drivers / llvmpipe / lp_test_format.c
index 3f2ed8458a37319254057c5a5cd4f58f8819fc81..ae4c3f8e2e2cce2926811e8f969e7bb3ec34ae11 100644 (file)
@@ -139,6 +139,7 @@ static boolean
 test_format_float(unsigned verbose, FILE *fp,
                   const struct util_format_description *desc)
 {
+   LLVMContextRef context;
    struct gallivm_state *gallivm;
    LLVMValueRef fetch = NULL;
    fetch_ptr_t fetch_ptr;
@@ -148,7 +149,8 @@ test_format_float(unsigned verbose, FILE *fp,
    boolean success = TRUE;
    unsigned i, j, k, l;
 
-   gallivm = gallivm_create("test_module_float", LLVMGetGlobalContext());
+   context = LLVMContextCreate();
+   gallivm = gallivm_create("test_module_float", context);
 
    fetch = add_fetch_rgba_test(gallivm, verbose, desc, lp_float32_vec4_type());
 
@@ -222,6 +224,7 @@ test_format_float(unsigned verbose, FILE *fp,
    }
 
    gallivm_destroy(gallivm);
+   LLVMContextDispose(context);
 
    if(fp)
       write_tsv_row(fp, desc, success);
@@ -235,6 +238,7 @@ static boolean
 test_format_unorm8(unsigned verbose, FILE *fp,
                    const struct util_format_description *desc)
 {
+   LLVMContextRef context;
    struct gallivm_state *gallivm;
    LLVMValueRef fetch = NULL;
    fetch_ptr_t fetch_ptr;
@@ -244,7 +248,8 @@ test_format_unorm8(unsigned verbose, FILE *fp,
    boolean success = TRUE;
    unsigned i, j, k, l;
 
-   gallivm = gallivm_create("test_module_unorm8", LLVMGetGlobalContext());
+   context = LLVMContextCreate();
+   gallivm = gallivm_create("test_module_unorm8", context);
 
    fetch = add_fetch_rgba_test(gallivm, verbose, desc, lp_unorm8_vec4_type());
 
@@ -317,6 +322,7 @@ test_format_unorm8(unsigned verbose, FILE *fp,
    }
 
    gallivm_destroy(gallivm);
+   LLVMContextDispose(context);
 
    if(fp)
       write_tsv_row(fp, desc, success);