diff options
author | Brian Paul <[email protected]> | 2012-06-05 09:03:45 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-06-06 07:55:59 -0600 |
commit | 3a62e8bcac75ca296619adb7fe4ea806a98beef9 (patch) | |
tree | 7dc7b3988cb7b4c0ad2e51d06c03af8f61399617 /src/gallium/tests/unit/translate_test.c | |
parent | adc58e96d088615abc8325ac8c78ec770931448d (diff) |
translate_test: add support for half floats
Fixes assertion reported in
https://bugs.freedesktop.org/show_bug.cgi?id=44519
but there's still failing cases.
Diffstat (limited to 'src/gallium/tests/unit/translate_test.c')
-rw-r--r-- | src/gallium/tests/unit/translate_test.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/tests/unit/translate_test.c b/src/gallium/tests/unit/translate_test.c index b9e7e25b29a..60a0501559b 100644 --- a/src/gallium/tests/unit/translate_test.c +++ b/src/gallium/tests/unit/translate_test.c @@ -27,6 +27,7 @@ #include "translate/translate.h" #include "util/u_memory.h" #include "util/u_format.h" +#include "util/u_half.h" #include "util/u_cpu_detect.h" #include "rtasm/rtasm_cpu.h" @@ -57,6 +58,7 @@ int main(int argc, char** argv) unsigned char* byte_buffer; float* float_buffer; double* double_buffer; + uint16_t *half_buffer; unsigned * elts; unsigned count = 4; unsigned i, j, k; @@ -137,6 +139,7 @@ int main(int argc, char** argv) byte_buffer = align_malloc(buffer_size, 4096); float_buffer = align_malloc(buffer_size, 4096); double_buffer = align_malloc(buffer_size, 4096); + half_buffer = align_malloc(buffer_size, 4096); elts = align_malloc(count * sizeof *elts, 4096); @@ -159,6 +162,9 @@ int main(int argc, char** argv) for (i = 0; i < buffer_size / sizeof(double); ++i) double_buffer[i] = rand_double(); + for (i = 0; i < buffer_size / sizeof(double); ++i) + half_buffer[i] = util_float_to_half((float) rand_double()); + for (i = 0; i < count; ++i) elts[i] = i; @@ -246,6 +252,8 @@ int main(int argc, char** argv) buffer[0] = (unsigned char*)float_buffer; else if(input_is_float && input_format_desc->channel[0].size == 64) buffer[0] = (unsigned char*)double_buffer; + else if(input_is_float && input_format_desc->channel[0].size == 16) + buffer[0] = (unsigned char*)half_buffer; else if(input_is_float) abort(); else |