From: José Fonseca Date: Fri, 7 Aug 2009 08:51:04 +0000 (+0100) Subject: llvmpipe: Use same type for reference vectors. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b19cb0080cbc9877993e76f6cbd6bc170d3d2851;p=mesa.git llvmpipe: Use same type for reference vectors. --- 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;