[PATCH] tests: Remove GLfloat usage.

John Kåre Alsaker john.kare.alsaker at gmail.com
Thu Oct 4 07:22:06 PDT 2012


On Thu, Oct 4, 2012 at 8:22 AM, Pekka Paalanen <ppaalanen at gmail.com> wrote:
> On Wed,  3 Oct 2012 17:30:05 +0200
> John Kåre Alsaker <john.kare.alsaker at gmail.com> wrote:
>
>> ---
>>  tests/matrix-test.c  | 3 +--
>>  tests/surface-test.c | 2 +-
>>  tests/test-client.c  | 3 +--
>>  3 files changed, 3 insertions(+), 5 deletions(-)
>
> Hi John,
>
> With the reservation, that GLfloat is always the same as float type in
> C on systems where Weston is supported, I agree with these changes.
Even when it isn't it should be changed since we introduced the
concept of multiple renderers. Weston shouldn't require OpenGL ES
headers to be around. That would make including the desktop OpenGL
headers in a desktop renderer tricky and if we want to use a software
renderer we might not even have them. The output matrix conversion
(from float to GLfloat) would only happen once per output per frame,
so that isn't a big deal.

>
> Did you check that matrix-test produces the same reports before and
> after these patches?
It prints, 'tests: <number around 7080000> ok, 1 not invertible but
ok, 4 failed.' before and after.

>
> For whatever version I had compiled, it produced the summary:
> tests: 7309134 ok, 1 not invertible but ok, 4 failed.
> and that is ok. Few failures are acceptable, since the input matrices
> can be quite bad in the test. When doing changes that are not supposed
> to affect the computations, there should be no change in the output,
> except for timing jitter. The pseudo-random sequence the test uses is
> always initialised with the same constant, so the sequence will be the
> same, too.
>
>
> Thanks,
> pq
>
>
>> diff --git a/tests/matrix-test.c b/tests/matrix-test.c
>> index 8e9d13f..cc78492 100644
>> --- a/tests/matrix-test.c
>> +++ b/tests/matrix-test.c
>> @@ -22,7 +22,6 @@
>>
>>  #include <stdio.h>
>>  #include <stdlib.h>
>> -#include <GLES2/gl2.h>
>>  #include <math.h>
>>  #include <unistd.h>
>>  #include <signal.h>
>> @@ -54,7 +53,7 @@ read_timer(void)
>>  }
>>
>>  static double
>> -det3x3(const GLfloat *c0, const GLfloat *c1, const GLfloat *c2)
>> +det3x3(const float *c0, const float *c1, const float *c2)
>>  {
>>       return (double)
>>               c0[0] * c1[1] * c2[2] +
>> diff --git a/tests/surface-test.c b/tests/surface-test.c
>> index e8fcb9e..28243b1 100644
>> --- a/tests/surface-test.c
>> +++ b/tests/surface-test.c
>> @@ -30,7 +30,7 @@
>>  TEST(surface_transform)
>>  {
>>       struct weston_surface *surface;
>> -     GLfloat x, y;
>> +     float x, y;
>>
>>       surface = weston_surface_create(compositor);
>>       weston_surface_configure(surface, 100, 100, 200, 200);
>> diff --git a/tests/test-client.c b/tests/test-client.c
>> index 0009a8e..8acbf89 100644
>> --- a/tests/test-client.c
>> +++ b/tests/test-client.c
>> @@ -27,7 +27,6 @@
>>  #include <assert.h>
>>  #include <poll.h>
>>  #include <wayland-client.h>
>> -#include <GLES2/gl2.h> /* needed for GLfloat */
>>  #include <linux/input.h>
>>
>>  struct display {
>> @@ -41,7 +40,7 @@ struct input {
>>       struct wl_seat *seat;
>>       struct wl_pointer *pointer;
>>       struct wl_keyboard *keyboard;
>> -     GLfloat x, y;
>> +     float x, y;
>>       uint32_t button_mask;
>>       struct surface *pointer_focus;
>>       struct surface *keyboard_focus;
>


More information about the wayland-devel mailing list