Remove support for EGL under X11
Now, the only supported EGL platform is Android. We might eventually add back support for EGL/X11 or EGL/Wayland, but it will have to be architected differently.
This commit is contained in:
parent
8bd4b9d2f9
commit
12f073c56b
|
@ -73,11 +73,7 @@ set(ANDROID_SRCS Android/ButtonManager.cpp
|
||||||
MainAndroid.cpp)
|
MainAndroid.cpp)
|
||||||
|
|
||||||
if(USE_EGL)
|
if(USE_EGL)
|
||||||
set(SRCS ${SRCS} GLInterface/Platform.cpp
|
set(SRCS ${SRCS} GLInterface/EGL.cpp)
|
||||||
GLInterface/EGL.cpp)
|
|
||||||
if(USE_X11)
|
|
||||||
set(SRCS ${SRCS} GLInterface/X11_Util.cpp)
|
|
||||||
endif()
|
|
||||||
else()
|
else()
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(SRCS ${SRCS} GLInterface/WGL.cpp)
|
set(SRCS ${SRCS} GLInterface/WGL.cpp)
|
||||||
|
@ -86,7 +82,6 @@ else()
|
||||||
else()
|
else()
|
||||||
set(SRCS ${SRCS} GLInterface/GLX.cpp
|
set(SRCS ${SRCS} GLInterface/GLX.cpp
|
||||||
GLInterface/X11_Util.cpp)
|
GLInterface/X11_Util.cpp)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
set(SRCS ${SRCS} GLInterface/GLInterface.cpp)
|
set(SRCS ${SRCS} GLInterface/GLInterface.cpp)
|
||||||
|
|
|
@ -9,11 +9,10 @@
|
||||||
// Show the current FPS
|
// Show the current FPS
|
||||||
void cInterfaceEGL::UpdateFPSDisplay(const std::string& text)
|
void cInterfaceEGL::UpdateFPSDisplay(const std::string& text)
|
||||||
{
|
{
|
||||||
Platform.UpdateFPSDisplay(text);
|
|
||||||
}
|
}
|
||||||
void cInterfaceEGL::Swap()
|
void cInterfaceEGL::Swap()
|
||||||
{
|
{
|
||||||
Platform.SwapBuffers();
|
eglSwapBuffers(GLWin.egl_dpy, GLWin.egl_surf);
|
||||||
}
|
}
|
||||||
void cInterfaceEGL::SwapInterval(int Interval)
|
void cInterfaceEGL::SwapInterval(int Interval)
|
||||||
{
|
{
|
||||||
|
@ -93,7 +92,7 @@ bool cInterfaceEGL::Create(void *&window_handle)
|
||||||
const char *s;
|
const char *s;
|
||||||
EGLint egl_major, egl_minor;
|
EGLint egl_major, egl_minor;
|
||||||
|
|
||||||
GLWin.egl_dpy = Platform.EGLGetDisplay();
|
GLWin.egl_dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
|
|
||||||
if (!GLWin.egl_dpy)
|
if (!GLWin.egl_dpy)
|
||||||
{
|
{
|
||||||
|
@ -157,8 +156,14 @@ bool cInterfaceEGL::Create(void *&window_handle)
|
||||||
else
|
else
|
||||||
eglBindAPI(EGL_OPENGL_ES_API);
|
eglBindAPI(EGL_OPENGL_ES_API);
|
||||||
|
|
||||||
if (!Platform.Init(config, window_handle))
|
EGLint format;
|
||||||
return false;
|
eglGetConfigAttrib(GLWin.egl_dpy, config, EGL_NATIVE_VISUAL_ID, &format);
|
||||||
|
ANativeWindow_setBuffersGeometry((EGLNativeWindowType)Host_GetRenderHandle(), 0, 0, format);
|
||||||
|
int none, width, height;
|
||||||
|
Host_GetRenderWindowSize(none, none, width, height);
|
||||||
|
GLWin.width = width;
|
||||||
|
GLWin.height = height;
|
||||||
|
GLInterface->SetBackBufferDimensions(width, height);
|
||||||
|
|
||||||
s = eglQueryString(GLWin.egl_dpy, EGL_VERSION);
|
s = eglQueryString(GLWin.egl_dpy, EGL_VERSION);
|
||||||
INFO_LOG(VIDEO, "EGL_VERSION = %s\n", s);
|
INFO_LOG(VIDEO, "EGL_VERSION = %s\n", s);
|
||||||
|
@ -179,7 +184,7 @@ bool cInterfaceEGL::Create(void *&window_handle)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLWin.native_window = Platform.CreateWindow();
|
GLWin.native_window = Host_GetRenderHandle();
|
||||||
|
|
||||||
GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config, GLWin.native_window, nullptr);
|
GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config, GLWin.native_window, nullptr);
|
||||||
if (!GLWin.egl_surf)
|
if (!GLWin.egl_surf)
|
||||||
|
@ -188,8 +193,6 @@ bool cInterfaceEGL::Create(void *&window_handle)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Platform.ToggleFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
|
|
||||||
|
|
||||||
window_handle = (void *)GLWin.native_window;
|
window_handle = (void *)GLWin.native_window;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +204,6 @@ bool cInterfaceEGL::MakeCurrent()
|
||||||
// Close backend
|
// Close backend
|
||||||
void cInterfaceEGL::Shutdown()
|
void cInterfaceEGL::Shutdown()
|
||||||
{
|
{
|
||||||
Platform.DestroyWindow();
|
|
||||||
if (GLWin.egl_ctx && !eglMakeCurrent(GLWin.egl_dpy, GLWin.egl_surf, GLWin.egl_surf, GLWin.egl_ctx))
|
if (GLWin.egl_ctx && !eglMakeCurrent(GLWin.egl_dpy, GLWin.egl_surf, GLWin.egl_surf, GLWin.egl_ctx))
|
||||||
NOTICE_LOG(VIDEO, "Could not release drawing context.");
|
NOTICE_LOG(VIDEO, "Could not release drawing context.");
|
||||||
if (GLWin.egl_ctx)
|
if (GLWin.egl_ctx)
|
||||||
|
|
|
@ -10,29 +10,11 @@
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "VideoBackends/OGL/GLInterfaceBase.h"
|
#include "VideoBackends/OGL/GLInterfaceBase.h"
|
||||||
|
|
||||||
|
|
||||||
class cPlatform
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
#if HAVE_X11
|
|
||||||
cXInterface XInterface;
|
|
||||||
#endif
|
|
||||||
public:
|
|
||||||
bool Init(EGLConfig config, void *window_handle);
|
|
||||||
EGLDisplay EGLGetDisplay(void);
|
|
||||||
EGLNativeWindowType CreateWindow(void);
|
|
||||||
void DestroyWindow(void);
|
|
||||||
void UpdateFPSDisplay(const std::string& text);
|
|
||||||
void SwapBuffers();
|
|
||||||
};
|
|
||||||
|
|
||||||
class cInterfaceEGL : public cInterfaceBase
|
class cInterfaceEGL : public cInterfaceBase
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
cPlatform Platform;
|
|
||||||
void DetectMode();
|
void DetectMode();
|
||||||
public:
|
public:
|
||||||
friend class cPlatform;
|
|
||||||
void SwapInterval(int Interval);
|
void SwapInterval(int Interval);
|
||||||
void Swap();
|
void Swap();
|
||||||
void SetMode(u32 mode) { s_opengl_mode = mode; }
|
void SetMode(u32 mode) { s_opengl_mode = mode; }
|
||||||
|
|
|
@ -7,12 +7,6 @@
|
||||||
#include "Common/Thread.h"
|
#include "Common/Thread.h"
|
||||||
|
|
||||||
#if USE_EGL
|
#if USE_EGL
|
||||||
// Currently Android/EGL and X11/EGL platforms are supported.
|
|
||||||
|
|
||||||
#if HAVE_X11
|
|
||||||
#include "DolphinWX/GLInterface/X11_Util.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "DolphinWX/GLInterface/EGL.h"
|
#include "DolphinWX/GLInterface/EGL.h"
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
#include "DolphinWX/GLInterface/AGL.h"
|
#include "DolphinWX/GLInterface/AGL.h"
|
||||||
|
@ -31,13 +25,11 @@ typedef struct {
|
||||||
EGLContext egl_ctx;
|
EGLContext egl_ctx;
|
||||||
EGLDisplay egl_dpy;
|
EGLDisplay egl_dpy;
|
||||||
EGLNativeWindowType native_window;
|
EGLNativeWindowType native_window;
|
||||||
#elif HAVE_X11
|
#elif defined(__APPLE__)
|
||||||
GLXContext ctx;
|
|
||||||
#endif
|
|
||||||
#if defined(__APPLE__)
|
|
||||||
NSView *cocoaWin;
|
NSView *cocoaWin;
|
||||||
NSOpenGLContext *cocoaCtx;
|
NSOpenGLContext *cocoaCtx;
|
||||||
#elif HAVE_X11
|
#elif HAVE_X11
|
||||||
|
GLXContext ctx;
|
||||||
int screen;
|
int screen;
|
||||||
Window win;
|
Window win;
|
||||||
Window parent;
|
Window parent;
|
||||||
|
|
|
@ -1,68 +0,0 @@
|
||||||
// Copyright 2014 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include "Core/Host.h"
|
|
||||||
#include "DolphinWX/GLInterface/GLInterface.h"
|
|
||||||
|
|
||||||
bool cPlatform::Init(EGLConfig config, void *window_handle)
|
|
||||||
{
|
|
||||||
#if HAVE_X11
|
|
||||||
if (!XInterface.Initialize(config, window_handle))
|
|
||||||
return false;
|
|
||||||
#elif ANDROID
|
|
||||||
EGLint format;
|
|
||||||
eglGetConfigAttrib(GLWin.egl_dpy, config, EGL_NATIVE_VISUAL_ID, &format);
|
|
||||||
ANativeWindow_setBuffersGeometry((EGLNativeWindowType)Host_GetRenderHandle(), 0, 0, format);
|
|
||||||
int none, width, height;
|
|
||||||
Host_GetRenderWindowSize(none, none, width, height);
|
|
||||||
GLInterface->SetBackBufferDimensions(width, height);
|
|
||||||
#endif
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
EGLDisplay cPlatform::EGLGetDisplay(void)
|
|
||||||
{
|
|
||||||
#if HAVE_X11
|
|
||||||
return (EGLDisplay) XInterface.EGLGetDisplay();
|
|
||||||
#elif ANDROID
|
|
||||||
return eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
|
||||||
#endif
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
EGLNativeWindowType cPlatform::CreateWindow(void)
|
|
||||||
{
|
|
||||||
#if HAVE_X11
|
|
||||||
return (EGLNativeWindowType) XInterface.CreateWindow();
|
|
||||||
#endif
|
|
||||||
#ifdef ANDROID
|
|
||||||
return (EGLNativeWindowType)Host_GetRenderHandle();
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cPlatform::DestroyWindow(void)
|
|
||||||
{
|
|
||||||
#if HAVE_X11
|
|
||||||
XInterface.DestroyWindow();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void cPlatform::UpdateFPSDisplay(const std::string& text)
|
|
||||||
{
|
|
||||||
#if HAVE_X11
|
|
||||||
XInterface.UpdateFPSDisplay(text);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
cPlatform::SwapBuffers()
|
|
||||||
{
|
|
||||||
#if HAVE_X11
|
|
||||||
XInterface.SwapBuffers();
|
|
||||||
#elif ANDROID
|
|
||||||
eglSwapBuffers(GLWin.egl_dpy, GLWin.egl_surf);
|
|
||||||
#endif
|
|
||||||
}
|
|
|
@ -6,104 +6,6 @@
|
||||||
#include "DolphinWX/GLInterface/GLInterface.h"
|
#include "DolphinWX/GLInterface/GLInterface.h"
|
||||||
#include "VideoCommon/VideoConfig.h"
|
#include "VideoCommon/VideoConfig.h"
|
||||||
|
|
||||||
#if USE_EGL
|
|
||||||
bool cXInterface::ServerConnect(void)
|
|
||||||
{
|
|
||||||
GLWin.dpy = XOpenDisplay(nullptr);
|
|
||||||
|
|
||||||
if (!GLWin.dpy)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool cXInterface::Initialize(void *config, void *window_handle)
|
|
||||||
{
|
|
||||||
XVisualInfo visTemplate;
|
|
||||||
int num_visuals;
|
|
||||||
EGLint vid;
|
|
||||||
|
|
||||||
if (!GLWin.dpy) {
|
|
||||||
printf("Error: couldn't open X display\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!eglGetConfigAttrib(GLWin.egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
|
|
||||||
printf("Error: eglGetConfigAttrib() failed\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The X window visual must match the EGL config */
|
|
||||||
visTemplate.visualid = vid;
|
|
||||||
GLWin.vi = XGetVisualInfo(GLWin.dpy, VisualIDMask, &visTemplate, &num_visuals);
|
|
||||||
if (!GLWin.vi) {
|
|
||||||
printf("Error: couldn't get X visual\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
GLWin.evdpy = XOpenDisplay(nullptr);
|
|
||||||
GLWin.parent = (Window) window_handle;
|
|
||||||
GLWin.screen = DefaultScreen(GLWin.dpy);
|
|
||||||
|
|
||||||
if (GLWin.parent == 0)
|
|
||||||
GLWin.parent = RootWindow(GLWin.dpy, GLWin.screen);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *cXInterface::EGLGetDisplay(void)
|
|
||||||
{
|
|
||||||
return eglGetDisplay(GLWin.dpy);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *cXInterface::CreateWindow(void)
|
|
||||||
{
|
|
||||||
Atom wmProtocols[1];
|
|
||||||
|
|
||||||
// Setup window attributes
|
|
||||||
GLWin.attr.colormap = XCreateColormap(GLWin.evdpy,
|
|
||||||
GLWin.parent, GLWin.vi->visual, AllocNone);
|
|
||||||
GLWin.attr.event_mask = KeyPressMask | StructureNotifyMask | FocusChangeMask;
|
|
||||||
GLWin.attr.background_pixel = BlackPixel(GLWin.evdpy, GLWin.screen);
|
|
||||||
GLWin.attr.border_pixel = 0;
|
|
||||||
|
|
||||||
// Create the window
|
|
||||||
GLWin.win = XCreateWindow(GLWin.evdpy, GLWin.parent,
|
|
||||||
0, 0, 1, 1, 0,
|
|
||||||
GLWin.vi->depth, InputOutput, GLWin.vi->visual,
|
|
||||||
CWBorderPixel | CWBackPixel | CWColormap | CWEventMask, &GLWin.attr);
|
|
||||||
wmProtocols[0] = XInternAtom(GLWin.evdpy, "WM_DELETE_WINDOW", True);
|
|
||||||
XSetWMProtocols(GLWin.evdpy, GLWin.win, wmProtocols, 1);
|
|
||||||
XSetStandardProperties(GLWin.evdpy, GLWin.win, "GPU", "GPU", None, nullptr, 0, nullptr);
|
|
||||||
XMapRaised(GLWin.evdpy, GLWin.win);
|
|
||||||
XSync(GLWin.evdpy, True);
|
|
||||||
|
|
||||||
GLWin.xEventThread = std::thread(&cXInterface::XEventThread, this);
|
|
||||||
|
|
||||||
return (void *) GLWin.win;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cXInterface::DestroyWindow(void)
|
|
||||||
{
|
|
||||||
XDestroyWindow(GLWin.evdpy, GLWin.win);
|
|
||||||
GLWin.win = 0;
|
|
||||||
if (GLWin.xEventThread.joinable())
|
|
||||||
GLWin.xEventThread.join();
|
|
||||||
XFreeColormap(GLWin.evdpy, GLWin.attr.colormap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cXInterface::UpdateFPSDisplay(const std::string& text)
|
|
||||||
{
|
|
||||||
XStoreName(GLWin.evdpy, GLWin.win, text.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
void cXInterface::SwapBuffers()
|
|
||||||
{
|
|
||||||
eglSwapBuffers(GLWin.egl_dpy, GLWin.egl_surf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cXInterface::XEventThread()
|
|
||||||
#else
|
|
||||||
void cX11Window::CreateXWindow(void)
|
void cX11Window::CreateXWindow(void)
|
||||||
{
|
{
|
||||||
Atom wmProtocols[1];
|
Atom wmProtocols[1];
|
||||||
|
@ -139,7 +41,6 @@ void cX11Window::DestroyXWindow(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void cX11Window::XEventThread()
|
void cX11Window::XEventThread()
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
while (GLWin.win)
|
while (GLWin.win)
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,21 +9,6 @@
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
#if USE_EGL
|
|
||||||
class cXInterface
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
void XEventThread();
|
|
||||||
public:
|
|
||||||
bool ServerConnect(void);
|
|
||||||
bool Initialize(void *config, void *window_handle);
|
|
||||||
void *EGLGetDisplay(void);
|
|
||||||
void *CreateWindow(void);
|
|
||||||
void DestroyWindow(void);
|
|
||||||
void UpdateFPSDisplay(const std::string& text);
|
|
||||||
void SwapBuffers();
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
class cX11Window
|
class cX11Window
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -32,4 +17,3 @@ public:
|
||||||
void CreateXWindow(void);
|
void CreateXWindow(void);
|
||||||
void DestroyXWindow(void);
|
void DestroyXWindow(void);
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
|
@ -29,10 +29,6 @@
|
||||||
#include "DolphinWX/X11Utils.h"
|
#include "DolphinWX/X11Utils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_EGL
|
|
||||||
#include "DolphinWX/GLInterface/GLInterface.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue