diff options
author | José Fonseca <[email protected]> | 2009-08-07 09:51:04 +0100 |
---|---|---|
committer | José Fonseca <[email protected]> | 2009-08-29 09:21:24 +0100 |
commit | b19cb0080cbc9877993e76f6cbd6bc170d3d2851 (patch) | |
tree | 057c2e1a9f10bc264f3058c3af8609ca542973d9 | |
parent | d52dce0ffbb165146d7b6812ff5152cbeff29a3a (diff) |
llvmpipe: Use same type for reference vectors.
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_test.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_test_blend.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_test_main.c | 8 |
3 files changed, 12 insertions, 9 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_test.h b/src/gallium/drivers/llvmpipe/lp_test.h index dd173fe4c52..c51399f8079 100644 --- a/src/gallium/drivers/llvmpipe/lp_test.h +++ b/src/gallium/drivers/llvmpipe/lp_test.h @@ -114,7 +114,7 @@ random_vec(union lp_type type, void *dst); boolean -compare_vec(union lp_type type, const void *res, const double *ref); +compare_vec(union lp_type type, const void *res, const void *ref); void diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c index f42a9a9e420..a1e4ddf8542 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c @@ -466,18 +466,18 @@ test_one(unsigned verbose, (void)pass; #endif - blend_test_ptr = (blend_test_ptr_t)LLVMGetPointerToGlobal(engine, func); - if(verbose >= 2) LLVMDumpModule(module); + blend_test_ptr = (blend_test_ptr_t)LLVMGetPointerToGlobal(engine, func); + success = TRUE; for(i = 0; i < n && success; ++i) { uint8_t src[LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; uint8_t dst[LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; uint8_t con[LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; uint8_t res[LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; - double ref[LP_MAX_VECTOR_LENGTH]; + uint8_t ref[LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; int64_t start_counter = 0; int64_t end_counter = 0; @@ -489,13 +489,16 @@ test_one(unsigned verbose, double fsrc[LP_MAX_VECTOR_LENGTH]; double fdst[LP_MAX_VECTOR_LENGTH]; double fcon[LP_MAX_VECTOR_LENGTH]; + double fref[LP_MAX_VECTOR_LENGTH]; read_vec(type, src, fsrc); read_vec(type, dst, fdst); read_vec(type, con, fcon); for(j = 0; j < type.length; j += 4) - compute_blend_ref(blend, fsrc + j, fdst + j, fcon + j, ref + j); + compute_blend_ref(blend, fsrc + j, fdst + j, fcon + j, fref + j); + + write_vec(type, ref, fref); } start_counter = rdtsc(); diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c index 2ce3fa1c0b5..34e6bf31fcf 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_main.c +++ b/src/gallium/drivers/llvmpipe/lp_test_main.c @@ -178,11 +178,11 @@ random_elem(union lp_type type, void *dst, unsigned index) assert(index < type.length); if (type.floating) { double value = (double)random()/(double)RAND_MAX; - if(!type.norm) + if(!type.norm) { value += (double)random(); - if(type.sign) if(random() & 1) value = -value; + } switch(type.width) { case 32: *((float *)dst + index) = (float)value; @@ -250,7 +250,7 @@ random_vec(union lp_type type, void *dst) boolean -compare_vec(union lp_type type, const void *res, const double *ref) +compare_vec(union lp_type type, const void *res, const void *ref) { double eps; unsigned i; @@ -276,7 +276,7 @@ compare_vec(union lp_type type, const void *res, const double *ref) for (i = 0; i < type.length; ++i) { double res_elem = read_elem(type, res, i); - double ref_elem = ref[i]; + double ref_elem = read_elem(type, ref, i); double delta = fabs(res_elem - ref_elem); if(delta >= 2.0*eps) return FALSE; |