[Piglit] [PATCH] egl-nok-swap-region: Fix build against new eglext.h

Adam Jackson ajax at redhat.com
Thu Sep 8 04:06:39 UTC 2016


On Thu, 2016-09-08 at 03:42 +0100, Emil Velikov wrote:
> > On 7 September 2016 at 21:50, Adam Jackson <ajax at redhat.com> wrote:
> > index 075df97..6512b6b 100644
> > --- a/tests/egl/egl-nok-swap-region.c
> > +++ b/tests/egl/egl-nok-swap-region.c
> > @@ -28,6 +28,7 @@
> >   * Test EGL_NOK_swap_region.
> >   */
> > 
> > +#define PFNEGLSWAPBUFFERSREGIONNOK PFNEGLSWAPBUFFERSREGIONNOKPROC
> >  #include "piglit-util-gl.h"
> >  #include "egl-util.h"
> > 
> > @@ -64,10 +65,10 @@ draw(struct egl_state *state)
> >                 { 55, 55, red },
> >                 { 55, state->height - 55, green },
> >         };
> > -       PFNEGLSWAPBUFFERSREGIONNOK swap_buffers_region;
> > +       PFNEGLSWAPBUFFERSREGIONNOKPROC swap_buffers_region;
> >         int i;
> > 
> > -       swap_buffers_region = (PFNEGLSWAPBUFFERSREGIONNOK)
> > +       swap_buffers_region = (PFNEGLSWAPBUFFERSREGIONNOKPROC)

> It could be the late hour but things look backwards.
> Namely: Using the PROC version yet defining the non-PROC one.

Yes, we're defining the non-PROC string to be replaced with the PROCful
string, such that when the preprocessor subsequently sees...

typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOK)
(EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint*
rects);

... it swaps in the ...PROC string, and the PROCful version is the type
def'd, and then that is what the rest of the test uses. If on the other
hand the new headers are used, then no typedef named ...NOK is
declared, and nothing happens.

> Please don't forget the ifndef PFN... guard.

It's the first preprocessor statement in the only compilation unit, an
ifndef would do nothing.

- ajax


More information about the Piglit mailing list