Fix tests to work with some OpenGL ES / EGL implementations.

macos/v1.5.9
Yaron Cohen-Tal 10 years ago
parent 4c4a6e49ca
commit 540952010b
  1. 3
      README.md
  2. 10
      test/egl_and_glx_different_pointers.c
  3. 10
      test/egl_common.c
  4. 2
      test/egl_common.h
  5. 8
      test/egl_gl.c
  6. 2
      test/egl_has_extension_nocontext.c
  7. 36
      test/egl_without_glx.c

@ -28,6 +28,7 @@ Building (Unix)
./autogen.sh
make
make check [optional]
sudo make install
Dependencies for debian:
@ -51,7 +52,7 @@ Building (MSVC 2013)
1) Check src\Makefile.vc to ensure that PYTHONDIR is pointing to your Python installation, either a 32-bit or a 64-bit (x64) installation of Python will do.
2) Open an MSVC Command prompt and run "nmake Makefile.vc CFG=release" or "nmake Makefile.vc CFG=debug" in src\ for a release or debug build.
3) Optionally, add src\ into your PATH and run the previous step in test\. Run the tests by running the built .exe's.
4) Assuming you want to install in %INSTALL_DIR%, copy gl.h, gl_generated.h, wgl.h, wgl_generated.h, egl.h and egl_generated.h from include\epoxy\ to %INSTALL_DIR%\include\epoxy\, copy src\epoxy.lib to %INSTALL_DIR%\lib\ and copy epoxy-vs12.dll and epoxy-vs12.pdb (if you've built a debug build) from src\ to %INSTALL_DIR%\bin\. Create directories as needed.
4) Assuming you want to install in %INSTALL_DIR%, copy common.h, gl.h, gl_generated.h, wgl.h, wgl_generated.h, egl.h and egl_generated.h from include\epoxy\ to %INSTALL_DIR%\include\epoxy\, copy src\epoxy.lib to %INSTALL_DIR%\lib\ and copy epoxy-vs12.dll and epoxy-vs12.pdb (if you've built a debug build) from src\ to %INSTALL_DIR%\bin\. Create directories as needed.
5) To clean the project, repeat steps 2 and 3, adding " clean" to the commands.
Switching your code to using epoxy

@ -136,7 +136,7 @@ init_glx(Display **out_dpy, GLXContext *out_ctx, Drawable *out_draw)
#ifdef USE_EGL
static bool
make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
make_egl_current_and_test(EGLDisplay dpy, EGLContext ctx)
{
const char *string;
GLuint shader;
@ -171,15 +171,15 @@ make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
}
static void
init_egl(EGLDisplay **out_dpy, EGLContext *out_ctx)
init_egl(EGLDisplay *out_dpy, EGLContext *out_ctx)
{
EGLDisplay *dpy = get_egl_display_or_skip();
EGLDisplay dpy = get_egl_display_or_skip();
static const EGLint config_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
static const EGLint context_attribs[] = {
@ -212,7 +212,7 @@ main(int argc, char **argv)
{
bool pass = true;
#ifdef USE_EGL
EGLDisplay *egl_dpy;
EGLDisplay egl_dpy;
EGLContext egl_ctx;
#endif
#ifdef USE_GLX

@ -24,25 +24,25 @@
#include <err.h>
#include <epoxy/egl.h>
#include "egl_common.h"
#include <X11/Xlib.h>
/**
* Do whatever it takes to get us an EGL display for the system.
*
* This needs to be ported to other window systems.
*/
EGLDisplay *
EGLDisplay
get_egl_display_or_skip(void)
{
Display *dpy = XOpenDisplay(NULL);
EGLint major, minor;
EGLDisplay *edpy;
EGLDisplay edpy;
bool ok;
if (!dpy)
errx(77, "couldn't open display\n");
edpy = eglGetDisplay(dpy);
if (!edpy)
edpy = eglGetDisplay((EGLNativeDisplayType)dpy);
if (edpy == EGL_NO_DISPLAY)
errx(1, "Couldn't get EGL display for X11 Display.\n");
ok = eglInitialize(edpy, &major, &minor);

@ -21,5 +21,5 @@
* IN THE SOFTWARE.
*/
EGLDisplay *
EGLDisplay
get_egl_display_or_skip(void);

@ -44,7 +44,7 @@
#include "dlwrap.h"
static bool
make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
make_egl_current_and_test(EGLDisplay dpy, EGLContext ctx)
{
const char *string;
GLuint shader;
@ -73,9 +73,9 @@ make_egl_current_and_test(EGLDisplay *dpy, EGLContext ctx)
}
static void
init_egl(EGLDisplay **out_dpy, EGLContext *out_ctx)
init_egl(EGLDisplay *out_dpy, EGLContext *out_ctx)
{
EGLDisplay *dpy = get_egl_display_or_skip();
EGLDisplay dpy = get_egl_display_or_skip();
static const EGLint config_attribs[] = {
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_RED_SIZE, 1,
@ -113,7 +113,7 @@ int
main(int argc, char **argv)
{
bool pass = true;
EGLDisplay *egl_dpy;
EGLDisplay egl_dpy;
EGLContext egl_ctx;
/* Force epoxy to have loaded both EGL and GLX libs already -- we

@ -43,7 +43,7 @@ main(int argc, char **argv)
{
bool pass = true;
EGLDisplay *dpy = get_egl_display_or_skip();
EGLDisplay dpy = get_egl_display_or_skip();
const char *extensions = eglQueryString(dpy, EGL_EXTENSIONS);
char *first_space;
char *an_extension;

@ -43,34 +43,6 @@
#include "egl_common.h"
/**
* Wraps the system dlopen(), which libepoxy will end up calling when
* it tries to dlopen() the API libraries, and errors out the
* libraries we're trying to simulate not being installed on the
* system.
*/
void *
dlopen(const char *filename, int flag)
{
void * (*dlopen_unwrapped)(const char *filename, int flag);
if (!strcmp(filename, "libGL.so.1"))
return NULL;
#if GLES_VERSION == 2
if (!strcmp(filename, "libGLESv1_CM.so.1"))
return NULL;
#else
if (!strcmp(filename, "libGLESv2.so.2"))
return NULL;
#endif
dlopen_unwrapped = dlsym(RTLD_NEXT, "dlopen");
assert(dlopen_unwrapped);
return dlopen_unwrapped(filename, flag);
}
static EGLenum last_api;
static EGLenum extra_error = EGL_SUCCESS;
@ -119,7 +91,7 @@ int
main(int argc, char **argv)
{
bool pass = true;
EGLDisplay *dpy = get_egl_display_or_skip();
EGLDisplay dpy = get_egl_display_or_skip();
EGLint context_attribs[] = {
EGL_CONTEXT_CLIENT_VERSION, GLES_VERSION,
EGL_NONE
@ -130,7 +102,11 @@ main(int argc, char **argv)
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
#if GLES_VERSION == 2
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
#else
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
#endif
EGL_NONE
};
EGLint count;

Loading…
Cancel
Save