[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

@@ -146,6 +146,7 @@ static bool x11Init(const LG_DSInitParams params)
};
unsigned long swaMask = CWEventMask;
#ifdef ENABLE_OPENGL
if (params.opengl)
{
GLint glXAttribs[] =
@@ -174,6 +175,7 @@ static bool x11Init(const LG_DSInitParams params)
x11.visual->visual, AllocNone);
swaMask |= CWColormap;
}
#endif
x11.window = XCreateWindow(
x11.display,
@@ -911,6 +913,7 @@ static void x11EGLSwapBuffers(EGLDisplay display, EGLSurface surface)
}
#endif
#ifdef ENABLE_OPENGL
static LG_DSGLContext x11GLCreateContext(void)
{
return (LG_DSGLContext)
@@ -936,6 +939,7 @@ static void x11GLSwapBuffers(void)
{
glXSwapBuffers(x11.display, x11.window);
}
#endif
static void x11ShowPointer(bool show)
{
@@ -1488,11 +1492,13 @@ struct LG_DisplayServerOps LGDS_X11 =
.getEGLNativeWindow = x11GetEGLNativeWindow,
.eglSwapBuffers = x11EGLSwapBuffers,
#endif
#ifdef ENABLE_OPENGL
.glCreateContext = x11GLCreateContext,
.glDeleteContext = x11GLDeleteContext,
.glMakeCurrent = x11GLMakeCurrent,
.glSetSwapInterval = x11GLSetSwapInterval,
.glSwapBuffers = x11GLSwapBuffers,
#endif
.showPointer = x11ShowPointer,
.grabPointer = x11GrabPointer,
.ungrabPointer = x11UngrabPointer,