[client] opengl: make ds functions optional

Using a macro ENABLE_OPENGL just like ENABLE_EGL to optionally remove
OpenGL implementation code. This is mostly because on Wayland it's just
a rehash of the EGL code (as EGL is the only way to create OpenGL
contexts on Wayland).
This commit is contained in:
Quantum
2021-01-27 15:13:35 -05:00
committed by Geoffrey McRae
parent af2dafbdac
commit ecebcc4c35
7 changed files with 56 additions and 15 deletions

View File

@@ -64,11 +64,13 @@ EGLNativeWindowType app_getEGLNativeWindow(void);
void app_eglSwapBuffers(EGLDisplay display, EGLSurface surface);
#endif
#ifdef ENABLE_OPENGL
LG_DSGLContext app_glCreateContext(void);
void app_glDeleteContext(LG_DSGLContext context);
void app_glMakeCurrent(LG_DSGLContext context);
void app_glSetSwapInterval(int interval);
void app_glSwapBuffers(void);
#endif
void app_clipboardRelease(void);
void app_clipboardNotify(const LG_ClipboardData type, size_t size);

View File

@@ -109,12 +109,14 @@ struct LG_DisplayServerOps
void (*eglSwapBuffers)(EGLDisplay display, EGLSurface surface);
#endif
#ifdef ENABLE_OPENGL
/* opengl platform specific methods */
LG_DSGLContext (*glCreateContext)(void);
void (*glDeleteContext)(LG_DSGLContext context);
void (*glMakeCurrent)(LG_DSGLContext context);
void (*glSetSwapInterval)(int interval);
void (*glSwapBuffers)(void);
#endif
/* dm specific cursor implementations */
void (*showPointer)(bool show);
@@ -159,6 +161,12 @@ struct LG_DisplayServerOps
#define ASSERT_EGL_FN(x)
#endif
#ifdef ENABLE_OPENGL
#define ASSERT_OPENGL_FN(x) assert(x)
#else
#define ASSERT_OPENGL_FN(x)
#endif
#define ASSERT_LG_DS_VALID(x) \
assert((x)->probe ); \
assert((x)->earlyInit ); \
@@ -170,11 +178,11 @@ struct LG_DisplayServerOps
ASSERT_EGL_FN((x)->getEGLDisplay ); \
ASSERT_EGL_FN((x)->getEGLNativeWindow ); \
ASSERT_EGL_FN((x)->eglSwapBuffers ); \
assert((x)->glCreateContext ); \
assert((x)->glDeleteContext ); \
assert((x)->glMakeCurrent ); \
assert((x)->glSetSwapInterval ); \
assert((x)->glSwapBuffers ); \
ASSERT_OPENGL_FN((x)->glCreateContext ); \
ASSERT_OPENGL_FN((x)->glDeleteContext ); \
ASSERT_OPENGL_FN((x)->glMakeCurrent ); \
ASSERT_OPENGL_FN((x)->glSetSwapInterval); \
ASSERT_OPENGL_FN((x)->glSwapBuffers ); \
assert((x)->showPointer ); \
assert((x)->grabPointer ); \
assert((x)->ungrabPointer ); \