summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/tests/unit/translate_test.c8
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