diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_test_conv.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_test_main.c | 13 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c index 6e58a031515..a4f313a0bb3 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c @@ -211,6 +211,14 @@ test_one(unsigned verbose, assert(src_type.length * num_srcs == dst_type.length * num_dsts); eps = MAX2(lp_const_eps(src_type), lp_const_eps(dst_type)); + if (dst_type.norm && dst_type.sign && src_type.sign && !src_type.floating) { + /* + * This is quite inaccurate due to shift being used. + * I don't think it's possible to hit such conversions with + * llvmpipe though. + */ + eps *= 2; + } context = LLVMContextCreate(); gallivm = gallivm_create("test_module", context); diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c index 518ca274e7a..5ec0dd347bd 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_main.c +++ b/src/gallium/drivers/llvmpipe/lp_test_main.c @@ -147,6 +147,7 @@ write_elem(struct lp_type type, void *dst, unsigned index, double value) if(type.sign) { long long lvalue = (long long)value; lvalue = MIN2(lvalue, ((long long)1 << (type.width - 1)) - 1); + lvalue = MAX2(lvalue, -((long long)1 << (type.width - 1))); switch(type.width) { case 8: *((int8_t *)dst + index) = (int8_t)lvalue; @@ -200,16 +201,24 @@ random_elem(struct lp_type type, void *dst, unsigned index) } else { unsigned long long mask; - if (type.fixed) + if (type.fixed) mask = ((unsigned long long)1 << (type.width / 2)) - 1; else if (type.sign) mask = ((unsigned long long)1 << (type.width - 1)) - 1; else mask = ((unsigned long long)1 << type.width) - 1; value += (double)(mask & rand()); + if (!type.fixed && !type.sign && type.width == 32) { + /* + * rand only returns half the possible range + * XXX 64bit values... + */ + if(rand() & 1) + value += (double)0x80000000; + } } } - if(!type.sign) + if(type.sign) if(rand() & 1) value = -value; write_elem(type, dst, index, value); |