Merge pull request #3572 from Sonicadvance1/egl_support_headless

Egl support headless
This commit is contained in:
Ryan Houdek
2016-01-30 11:15:07 -05:00
5 changed files with 26 additions and 10 deletions

View File

@ -27,7 +27,7 @@ protected:
EGLContext egl_ctx;
EGLDisplay egl_dpy;
virtual EGLDisplay OpenDisplay() { return EGL_NO_DISPLAY; }
virtual EGLDisplay OpenDisplay() { return eglGetDisplay(EGL_DEFAULT_DISPLAY); }
virtual EGLNativeWindowType InitializePlatform(EGLNativeWindowType host_window, EGLConfig config) { return (EGLNativeWindowType)EGL_DEFAULT_DISPLAY; }
virtual void ShutdownPlatform() {}

View File

@ -18,6 +18,8 @@
#else
#include "Common/GL/GLInterface/GLX.h"
#endif
#elif defined(USE_EGL) && USE_EGL && defined(USE_HEADLESS)
#include "Common/GL/GLInterface/EGL.h"
#else
#error Platform doesnt have a GLInterface
#endif
@ -30,6 +32,8 @@ std::unique_ptr<cInterfaceBase> HostGL_CreateGLInterface()
return std::make_unique<cInterfaceAGL>();
#elif defined(_WIN32)
return std::make_unique<cInterfaceWGL>();
#elif defined(USE_EGL) && defined(USE_HEADLESS)
return std::make_unique<cInterfaceEGL>();
#elif defined(HAVE_X11) && HAVE_X11
#if defined(USE_EGL) && USE_EGL
return std::make_unique<cInterfaceEGLX11>();

View File

@ -194,7 +194,7 @@ if(wxWidgets_FOUND)
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE})
endif()
if(USE_X11)
if(USE_X11 OR ENABLE_HEADLESS)
set(DOLPHIN_NOGUI_EXE ${DOLPHIN_EXE_BASE}-nogui)
add_executable(${DOLPHIN_NOGUI_EXE} ${SRCS} ${NOGUI_SRCS})
target_link_libraries(${DOLPHIN_NOGUI_EXE} ${LIBS})

View File

@ -35,11 +35,11 @@ static bool running = true;
class Platform
{
public:
virtual void Init() = 0;
virtual void SetTitle(const std::string &title) = 0;
virtual void MainLoop() = 0;
virtual void Shutdown() = 0;
virtual ~Platform() {};
virtual void Init() {}
virtual void SetTitle(const std::string &title) {}
virtual void MainLoop() { while(running) {} }
virtual void Shutdown() {}
virtual ~Platform() {}
};
static Platform* platform;
@ -54,7 +54,7 @@ void Host_Message(int Id)
running = false;
}
static void* s_window_handle;
static void* s_window_handle = nullptr;
void* Host_GetRenderHandle()
{
return s_window_handle;
@ -291,7 +291,9 @@ class PlatformX11 : public Platform
static Platform* GetPlatform()
{
#if HAVE_X11
#if defined(USE_EGL) && defined(USE_HEADLESS)
return new Platform();
#elif HAVE_X11
return new PlatformX11();
#endif
return nullptr;