[Piglit] [PATCH] egl-util: remove GL include

Daniel Kurtz djkurtz at chromium.org
Mon Aug 18 04:15:30 PDT 2014


On Mon, Aug 18, 2014 at 5:43 PM, Ken Phillis Jr <kphillisjr at gmail.com> wrote:
>
> I think a ifdef is needed since egl can create opengl contexts.


EGL can create an OpenGL context using an EGLConfig that has
EGL_RENDERABLE_TYPE with EGL_OPENGL_BIT.
It does so by first binding to the OpenGL API, perhaps something like this:

  const EGLint egl_attribs[] = { ...,
     EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
     EGL_NONE };
  EGLConfig egl_configs[1];
  EGLint num_configs;

  ...

  eglChooseConfig(egl_display, egl_attribs, &configs,
ARRAY_SIZE(configs), &num_configs);
  if (num_configs > 0) {
    eglBindAPI(EGL_OPENGL_API);
    eglCreateContext(egl_display, egl_configs[0], EGL_NO_CONTEXT, attrib_list);
  }

EGL_OPENGL_API and EGL_OPENGL_BIT are both defined in EGL/egl.h,
however, not GL/gl.h.

I'm confused... what #ifdef is missing?

>
> On Aug 17, 2014 7:32 PM, "Daniel Kurtz" <djkurtz at chromium.org> wrote:
>>
>>
>> On Aug 18, 2014 3:49 AM, "Kristian Høgsberg" <krh at bitplanet.net> wrote:
>> >
>> > On Sun, Aug 17, 2014 at 7:19 AM, Ken Phillis Jr <kphillisjr at gmail.com> wrote:
>> > > This patch looks good to me.
>> > >
>> > > On Aug 17, 2014 7:39 AM, "Daniel Kurtz" <djkurtz at chromium.org> wrote:
>> > >>
>> > >> EGL util should not in any way depend on the headers of a particular
>> > >> client library.
>> > >>
>> > >> In fact, this breaks compilation on pure OpenGL ES systems, since they
>> > >> do not have OpenGL headers installed (<GL/gl.h>).
>> > >>
>> > >> Signed-off-by: Daniel Kurtz <djkurtz at chromium.org>
>> > >> ---
>> > >> I've test built this change on two different systems with EGL/OpenGL
>> > >> ES-only
>> > >> (ARM Mali and Nvidia Tegra).
>> > >>
>> > >> I have not built on a system with EGL + OpenGL, or mixed GL/GLES... does
>> > >> anybody have a system like that and can double check?
>> >
>> > It certainly shouldn't be in the header, but egl-util.c needs it and
>> > breaks if you remove it.
>>
>> egl-util.c builds fine for GLES without <GL/gl.h> (and breaks with it).  Why is it needed for GL?  What am I missing?
>>
>> > Kristian
>> >
>> > >>
>> > >> Also, I do not have commit access, so can someone please submit this for
>> > >> me if
>> > >> it looks good?
>> > >>
>> > >> Thanks,
>> > >> -djk
>> > >>
>> > >>  tests/egl/egl-util.h | 1 -
>> > >>  1 file changed, 1 deletion(-)
>> > >>
>> > >> diff --git a/tests/egl/egl-util.h b/tests/egl/egl-util.h
>> > >> index f5c74fd..27d2926 100644
>> > >> --- a/tests/egl/egl-util.h
>> > >> +++ b/tests/egl/egl-util.h
>> > >> @@ -12,7 +12,6 @@
>> > >>  #include <X11/Xlib.h>
>> > >>  #include <X11/Xutil.h>
>> > >>  #include <X11/keysym.h>
>> > >> -#include <GL/gl.h>
>> > >>  #include <EGL/egl.h>
>> > >>  #include <EGL/eglext.h>
>> > >>
>> > >> --
>> > >> 2.1.0.rc2.206.gedb03e5
>> > >>
>> > >> _______________________________________________
>> > >> Piglit mailing list
>> > >> Piglit at lists.freedesktop.org
>> > >> http://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list