GHOST: Fix OpenGL backend isolation on Linux
This makes sure you can compile without the WITH_OPENGL_BACKEND option.
This commit is contained in:
parent
b5749f8e8a
commit
40f89d23cb
|
@ -407,6 +407,8 @@ GHOST_TSuccess GHOST_System::createFullScreenWindow(GHOST_Window **window,
|
|||
gpuSettings.context_type = GHOST_kDrawingContextTypeOpenGL;
|
||||
#elif defined(WITH_METAL_BACKEND)
|
||||
gpuSettings.context_type = GHOST_kDrawingContextTypeMetal;
|
||||
#elif defined(WITH_VULKAN_BACKEND)
|
||||
gpuSettings.context_type = GHOST_kDrawingContextTypeVulkan;
|
||||
#else
|
||||
# error
|
||||
#endif
|
||||
|
|
|
@ -87,6 +87,7 @@ enum {
|
|||
#define _NET_WM_STATE_ADD 1
|
||||
// #define _NET_WM_STATE_TOGGLE 2 // UNUSED
|
||||
|
||||
#ifdef WITH_OPENGL_BACKEND
|
||||
static XVisualInfo *get_x11_visualinfo(Display *display)
|
||||
{
|
||||
int num_visuals;
|
||||
|
@ -94,6 +95,7 @@ static XVisualInfo *get_x11_visualinfo(Display *display)
|
|||
vinfo_template.screen = DefaultScreen(display);
|
||||
return XGetVisualInfo(display, VisualScreenMask, &vinfo_template, &num_visuals);
|
||||
}
|
||||
#endif
|
||||
|
||||
GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
|
||||
Display *display,
|
||||
|
@ -130,10 +132,13 @@ GHOST_WindowX11::GHOST_WindowX11(GHOST_SystemX11 *system,
|
|||
m_valid_setup(false),
|
||||
m_is_debug_context(is_debug)
|
||||
{
|
||||
#ifdef WITH_OPENGL_BACKEND
|
||||
if (type == GHOST_kDrawingContextTypeOpenGL) {
|
||||
m_visualInfo = get_x11_visualinfo(m_display);
|
||||
}
|
||||
else {
|
||||
else
|
||||
#endif
|
||||
{
|
||||
XVisualInfo tmp = {nullptr};
|
||||
int n;
|
||||
m_visualInfo = XGetVisualInfo(m_display, 0, &tmp, &n);
|
||||
|
@ -1197,6 +1202,7 @@ static GHOST_Context *create_egl_context(GHOST_SystemX11 *system,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENGL_BACKEND
|
||||
static GHOST_Context *create_glx_context(Window window,
|
||||
Display *display,
|
||||
GLXFBConfig fbconfig,
|
||||
|
@ -1224,6 +1230,7 @@ static GHOST_Context *create_glx_context(Window window,
|
|||
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type)
|
||||
{
|
||||
|
@ -1247,6 +1254,7 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_OPENGL_BACKEND
|
||||
if (type == GHOST_kDrawingContextTypeOpenGL) {
|
||||
|
||||
/* During development:
|
||||
|
@ -1261,7 +1269,7 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
|
|||
|
||||
GHOST_Context *context;
|
||||
|
||||
#ifdef USE_EGL
|
||||
# ifdef USE_EGL
|
||||
/* Try to initialize an EGL context. */
|
||||
for (int minor = 5; minor >= 0; --minor) {
|
||||
context = create_egl_context(
|
||||
|
@ -1278,7 +1286,7 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
|
|||
}
|
||||
|
||||
/* EGL initialization failed, try to fallback to a GLX context. */
|
||||
#endif
|
||||
# endif
|
||||
for (int minor = 5; minor >= 0; --minor) {
|
||||
context = create_glx_context(m_window,
|
||||
m_display,
|
||||
|
@ -1310,6 +1318,7 @@ GHOST_Context *GHOST_WindowX11::newDrawingContext(GHOST_TDrawingContextType type
|
|||
fflush(stderr);
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue