diff options
author | Rob Clark <robdclark@gmail.com> | 2017-02-21 11:31:53 -0500 |
---|---|---|
committer | Rob Clark <robdclark@gmail.com> | 2017-02-21 11:31:58 -0500 |
commit | 9180f2feccc3f98b68f42cb0c8687ada74a78685 (patch) | |
tree | 36c32876cc25d60e9eaabadce197a4986b68242f | |
parent | 42e1a59e44854949bb703402d0df1db00377f26b (diff) |
make eglGetPlatformDisplayEXT optional
Pull in get_proc() macro from yuv and atomic-fence branches. Once those
parts get merged into a unified kmscube we'll want to look up more
extension fxns.
-rw-r--r-- | kmscube.c | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -60,6 +60,8 @@ static struct { GLint modelviewmatrix, modelviewprojectionmatrix, normalmatrix; GLuint vbo; GLuint positionsoffset, colorsoffset, normalsoffset; + + PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT; } gl; static struct { @@ -375,12 +377,16 @@ static int init_gl(void) " gl_FragColor = vVaryingColor; \n" "} \n"; - PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL; - get_platform_display = - (void *) eglGetProcAddress("eglGetPlatformDisplayEXT"); - assert(get_platform_display != NULL); +#define get_proc(name) do { \ + gl.name = (void *)eglGetProcAddress(#name); \ + } while (0) + + get_proc(eglGetPlatformDisplayEXT); - gl.display = get_platform_display(EGL_PLATFORM_GBM_KHR, gbm.dev, NULL); + if (gl.eglGetPlatformDisplayEXT) + gl.display = gl.eglGetPlatformDisplayEXT(EGL_PLATFORM_GBM_KHR, gbm.dev, NULL); + else + gl.display = eglGetDisplay(gbm.dev); if (!eglInitialize(gl.display, &major, &minor)) { printf("failed to initialize\n"); |