summaryrefslogtreecommitdiff
path: root/kmscube.c
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2017-02-21 11:31:53 -0500
committerRob Clark <robdclark@gmail.com>2017-02-21 11:31:58 -0500
commit9180f2feccc3f98b68f42cb0c8687ada74a78685 (patch)
tree36c32876cc25d60e9eaabadce197a4986b68242f /kmscube.c
parent42e1a59e44854949bb703402d0df1db00377f26b (diff)
downloadkmscube-9180f2feccc3f98b68f42cb0c8687ada74a78685.tar.gz
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.
Diffstat (limited to 'kmscube.c')
-rw-r--r--kmscube.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/kmscube.c b/kmscube.c
index 1f4f320..3d74f9d 100644
--- a/kmscube.c
+++ b/kmscube.c
@@ -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");