Mesa (master): tests: Use elts in translate_test.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Fri Apr 1 12:18:46 PDT 2011


Module: Mesa
Branch: master
Commit: 6586a3b287ad2799addd392d92c56c7f83e22e8f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6586a3b287ad2799addd392d92c56c7f83e22e8f

Author: José Fonseca <jfonseca at vmware.com>
Date:   Fri Apr  1 20:13:40 2011 +0100

tests: Use elts in translate_test.

---

 src/gallium/tests/unit/translate_test.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/gallium/tests/unit/translate_test.c b/src/gallium/tests/unit/translate_test.c
index d0946a9..2976fb7 100644
--- a/src/gallium/tests/unit/translate_test.c
+++ b/src/gallium/tests/unit/translate_test.c
@@ -57,6 +57,7 @@ int main(int argc, char** argv)
    unsigned char* byte_buffer;
    float* float_buffer;
    double* double_buffer;
+   unsigned * elts;
    unsigned count = 4;
    unsigned i, j, k;
    unsigned passed = 0;
@@ -137,6 +138,8 @@ int main(int argc, char** argv)
    float_buffer = align_malloc(buffer_size, 4096);
    double_buffer = align_malloc(buffer_size, 4096);
 
+   elts = align_malloc(count * sizeof *elts, 4096);
+
    key.nr_elements = 1;
    key.element[0].input_buffer = 0;
    key.element[0].input_offset = 0;
@@ -156,6 +159,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 < count; ++i)
+      elts[i] = i;
+
    for (output_format = 1; output_format < PIPE_FORMAT_COUNT; ++output_format)
    {
       const struct util_format_description* output_format_desc = util_format_description(output_format);
@@ -245,14 +251,14 @@ int main(int argc, char** argv)
          else
             buffer[0] = byte_buffer;
 
-         translate[0]->set_buffer(translate[0], 0, buffer[0], input_format_size, ~0);
-         translate[0]->run(translate[0], 0, count, 0, buffer[1]);
-         translate[1]->set_buffer(translate[1], 0, buffer[1], output_format_size, ~0);
-         translate[1]->run(translate[1], 0, count, 0, buffer[2]);
-         translate[0]->set_buffer(translate[0], 0, buffer[2], input_format_size, ~0);
-         translate[0]->run(translate[0], 0, count, 0, buffer[3]);
-         translate[1]->set_buffer(translate[1], 0, buffer[3], output_format_size, ~0);
-         translate[1]->run(translate[1], 0, count, 0, buffer[4]);
+         translate[0]->set_buffer(translate[0], 0, buffer[0], input_format_size, count - 1);
+         translate[0]->run_elts(translate[0], elts, count, 0, buffer[1]);
+         translate[1]->set_buffer(translate[1], 0, buffer[1], output_format_size, count - 1);
+         translate[1]->run_elts(translate[1], elts, count, 0, buffer[2]);
+         translate[0]->set_buffer(translate[0], 0, buffer[2], input_format_size, count - 1);
+         translate[0]->run_elts(translate[0], elts, count, 0, buffer[3]);
+         translate[1]->set_buffer(translate[1], 0, buffer[3], output_format_size, count - 1);
+         translate[1]->run_elts(translate[1], elts, count, 0, buffer[4]);
 
          for (i = 0; i < count; ++i)
          {



More information about the mesa-commit mailing list