llvmpipe: Use same type for reference vectors.

This commit is contained in:
José Fonseca 2009-08-07 09:51:04 +01:00
parent d52dce0ffb
commit b19cb0080c
3 changed files with 12 additions and 9 deletions

View File

@ -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

View File

@ -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();

View File

@ -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;