summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorScott Moreau <oreaus@gmail.com>2014-01-19 19:06:55 -0700
committerScott Moreau <oreaus@gmail.com>2014-01-20 00:32:01 -0700
commit4b3c338930464c2d3d33d1e6fbd5397ef3067a2e (patch)
tree39adbe867707848aed8ecfed6c1a0e53eed89f58 /Source/Core
parent75020b9b513a31db4e1070ecb314282c53d6b2e4 (diff)
Merge Platform.h into GLInterface.h
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/DolphinWX/GLInterface.h85
-rw-r--r--Source/Core/DolphinWX/GLInterface/EGL.h23
-rw-r--r--Source/Core/DolphinWX/GLInterface/Platform.cpp2
-rw-r--r--Source/Core/DolphinWX/GLInterface/Platform.h162
-rw-r--r--Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp7
-rw-r--r--Source/Core/DolphinWX/GLInterface/X11_Util.cpp4
-rw-r--r--Source/Core/DolphinWX/MainNoGUI.cpp2
-rw-r--r--Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp2
8 files changed, 100 insertions, 187 deletions
diff --git a/Source/Core/DolphinWX/GLInterface.h b/Source/Core/DolphinWX/GLInterface.h
index a4a94209d0..f3dc32c4b8 100644
--- a/Source/Core/DolphinWX/GLInterface.h
+++ b/Source/Core/DolphinWX/GLInterface.h
@@ -5,37 +5,96 @@
#ifndef _GLINTERFACE_H_
#define _GLINTERFACE_H_
+#include "Thread.h"
+
#if USE_EGL
-#include "GLInterface/Platform.h"
-#else
+// Currently Wayland/EGL and X11/EGL platforms are supported.
+// The platform may be spelected at run time by setting the
+// environment variable DOLPHIN_EGL_PLATFORM to "wayland" or "x11".
+
+enum egl_platform {
+ EGL_PLATFORM_NONE,
+ EGL_PLATFORM_WAYLAND,
+ EGL_PLATFORM_X11,
+ EGL_PLATFORM_ANDROID
+};
+
+#if HAVE_X11
+#include "GLInterface/X11_Util.h"
+#endif
+#if HAVE_WAYLAND
+#include "GLInterface/Wayland_Util.h"
+#endif
-#include "Thread.h"
-#if defined(USE_EGL) && USE_EGL
#include "GLInterface/EGL.h"
#elif defined(__APPLE__)
#include "GLInterface/AGL.h"
#elif defined(_WIN32)
#include "GLInterface/WGL.h"
-#elif defined(HAVE_X11) && HAVE_X11
+#elif HAVE_X11
#include "GLInterface/GLX.h"
#include <GL/glx.h>
#else
#error Platform doesnt have a GLInterface
#endif
+#if HAVE_WAYLAND
+struct geometry {
+ int width;
+ int height;
+};
+
+struct xkb {
+ struct xkb_context *context;
+ struct xkb_keymap *keymap;
+ struct xkb_state *state;
+ xkb_mod_mask_t control_mask;
+ xkb_mod_mask_t alt_mask;
+ xkb_mod_mask_t shift_mask;
+};
+#endif
typedef struct {
-#if defined(USE_EGL) && USE_EGL // This is currently a X11/EGL implementation for desktop
- int screen;
+#if HAVE_WAYLAND
+ struct wl_display *wl_display;
+ struct wl_registry *wl_registry;
+ struct wl_compositor *wl_compositor;
+ struct wl_shell *wl_shell;
+ struct wl_seat *wl_seat;
+ struct {
+ struct wl_pointer *wl_pointer;
+ uint32_t serial;
+ } pointer;
+ struct {
+ struct wl_keyboard *wl_keyboard;
+ struct xkb xkb;
+ uint32_t modifiers;
+ } keyboard;
+ struct wl_shm *wl_shm;
+ struct wl_cursor_theme *wl_cursor_theme;
+ struct wl_cursor *wl_cursor;
+ struct wl_surface *wl_cursor_surface;
+ struct geometry geometry, window_size;
+ struct wl_egl_window *wl_egl_native;
+ struct wl_surface *wl_surface;
+ struct wl_shell_surface *wl_shell_surface;
+ bool fullscreen, running;
+#endif
+
+
+#if USE_EGL
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
- int x, y;
- unsigned int width, height;
-#elif defined(__APPLE__)
+ enum egl_platform platform;
+ EGLNativeWindowType native_window;
+#elif HAVE_X11
+ GLXContext ctx;
+#endif
+#if defined(__APPLE__)
NSView *cocoaWin;
NSOpenGLContext *cocoaCtx;
-#elif defined(HAVE_X11) && HAVE_X11
+#elif HAVE_X11
int screen;
Window win;
Window parent;
@@ -43,16 +102,14 @@ typedef struct {
// evdpy is to be used by XEventThread only
Display *dpy, *evdpy;
XVisualInfo *vi;
- GLXContext ctx;
XSetWindowAttributes attr;
std::thread xEventThread;
+#endif
int x, y;
unsigned int width, height;
-#endif
} GLWindow;
extern cInterfaceBase *GLInterface;
extern GLWindow GLWin;
#endif
-#endif
diff --git a/Source/Core/DolphinWX/GLInterface/EGL.h b/Source/Core/DolphinWX/GLInterface/EGL.h
index 82583c1b72..2286bd74d3 100644
--- a/Source/Core/DolphinWX/GLInterface/EGL.h
+++ b/Source/Core/DolphinWX/GLInterface/EGL.h
@@ -19,8 +19,29 @@
#include <EGL/egl.h>
#include "InterfaceBase.h"
+#include "ConfigManager.h"
-class cPlatform;
+
+class cPlatform
+{
+private:
+#if HAVE_X11
+ cXInterface XInterface;
+#endif
+#if HAVE_WAYLAND
+ cWaylandInterface WaylandInterface;
+#endif
+public:
+ enum egl_platform platform;
+ bool SelectDisplay(void);
+ bool Init(EGLConfig config);
+ EGLDisplay EGLGetDisplay(void);
+ EGLNativeWindowType CreateWindow(void);
+ void DestroyWindow(void);
+ void UpdateFPSDisplay(const char *text);
+ void ToggleFullscreen(bool fullscreen);
+ void SwapBuffers();
+};
class cInterfaceEGL : public cInterfaceBase
{
diff --git a/Source/Core/DolphinWX/GLInterface/Platform.cpp b/Source/Core/DolphinWX/GLInterface/Platform.cpp
index 212ca49214..57a6c54a1c 100644
--- a/Source/Core/DolphinWX/GLInterface/Platform.cpp
+++ b/Source/Core/DolphinWX/GLInterface/Platform.cpp
@@ -16,7 +16,7 @@
// http://code.google.com/p/dolphin-emu/
#include "Host.h"
-#include "Platform.h"
+#include "GLInterface.h"
bool cPlatform::SelectDisplay(void)
{
diff --git a/Source/Core/DolphinWX/GLInterface/Platform.h b/Source/Core/DolphinWX/GLInterface/Platform.h
deleted file mode 100644
index 9c0d479a54..0000000000
--- a/Source/Core/DolphinWX/GLInterface/Platform.h
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright (C) 2013 Scott Moreau <oreaus@gmail.com>
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-#ifndef _EGLPLATFORM_H_
-#define _EGLPLATFORM_H_
-
-#include "Thread.h"
-#include "ConfigManager.h"
-
-#if USE_EGL
-// We must include wayland-egl.h before egl.h so our
-// native types are defined as wayland native types
-#if HAVE_WAYLAND && !HAVE_X11
-#include <wayland-egl.h>
-#endif
-#include <EGL/egl.h>
-#endif
-
-#if HAVE_X11
-#include "X11_Util.h"
-#endif
-#if HAVE_WAYLAND
-#include "Wayland_Util.h"
-#endif
-
-#if USE_EGL
-// There may be multiple EGL platforms
-enum egl_platform {
- EGL_PLATFORM_NONE,
- EGL_PLATFORM_WAYLAND,
- EGL_PLATFORM_X11,
- EGL_PLATFORM_ANDROID
-};
-
-class cPlatform
-{
-private:
-#if HAVE_X11
- cXInterface XInterface;
-#endif
-#if HAVE_WAYLAND
- cWaylandInterface WaylandInterface;
-#endif
-public:
- enum egl_platform platform;
- bool SelectDisplay(void);
- bool Init(EGLConfig config);
- EGLDisplay EGLGetDisplay(void);
- EGLNativeWindowType CreateWindow(void);
- void DestroyWindow(void);
- void UpdateFPSDisplay(const char *text);
- void ToggleFullscreen(bool fullscreen);
- void SwapBuffers();
-};
-
-#include "GLInterface/EGL.h"
-
-#if HAVE_WAYLAND
-#include <wayland-egl.h>
-#endif
-#elif defined(__APPLE__)
-#include "GLInterface/AGL.h"
-#elif defined(_WIN32)
-#include "GLInterface/WGL.h"
-#elif HAVE_X11
-#include "GLInterface/GLX.h"
-#endif
-
-#if HAVE_WAYLAND
-struct geometry {
- int width;
- int height;
-};
-
-struct xkb {
- struct xkb_context *context;
- struct xkb_keymap *keymap;
- struct xkb_state *state;
- xkb_mod_mask_t control_mask;
- xkb_mod_mask_t alt_mask;
- xkb_mod_mask_t shift_mask;
-};
-#endif
-
-typedef struct {
-// Currently Wayland/EGL and X11/EGL platforms are supported.
-// The platform may be spelected at run time by setting the
-// environment variable DOLPHIN_EGL_PLATFORM to "wayland" or "x11".
-#if USE_EGL
- EGLSurface egl_surf;
- EGLContext egl_ctx;
- EGLDisplay egl_dpy;
- enum egl_platform platform;
-#endif
- EGLNativeWindowType native_window;
-#if HAVE_WAYLAND
- struct wl_display *wl_display;
- struct wl_registry *wl_registry;
- struct wl_compositor *wl_compositor;
- struct wl_shell *wl_shell;
- struct wl_seat *wl_seat;
- struct {
- struct wl_pointer *wl_pointer;
- uint32_t serial;
- } pointer;
- struct {
- struct wl_keyboard *wl_keyboard;
- struct xkb xkb;
- uint32_t modifiers;
- } keyboard;
- struct wl_shm *wl_shm;
- struct wl_cursor_theme *wl_cursor_theme;
- struct wl_cursor *wl_cursor;
- struct wl_surface *wl_cursor_surface;
- struct geometry geometry, window_size;
- struct wl_egl_window *wl_egl_native;
- struct wl_surface *wl_surface;
- struct wl_shell_surface *wl_shell_surface;
- struct wl_callback *wl_callback;
- bool fullscreen, running;
-#endif
-#if HAVE_X11
- int screen;
- // dpy used for egl/glx stuff, evdpy for window events etc.
- // evdpy is to be used by XEventThread only
- Display *dpy;
- Display *evdpy;
-#if !USE_EGL
- GLXContext ctx;
-#endif
- Window win;
- Window parent;
- XVisualInfo *vi;
- XSetWindowAttributes attr;
- std::thread xEventThread;
- int x, y;
- unsigned int width, height;
-#elif defined(ANDROID)
- unsigned int width, height;
-#elif defined(__APPLE__)
- NSWindow *cocoaWin;
- NSOpenGLContext *cocoaCtx;
-#endif
-} GLWindow;
-
-extern cInterfaceBase *GLInterface;
-extern GLWindow GLWin;
-
-#endif
diff --git a/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp b/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp
index 71b75c7c1e..21b1bad4f5 100644
--- a/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp
+++ b/Source/Core/DolphinWX/GLInterface/Wayland_Util.cpp
@@ -360,11 +360,7 @@ bool cWaylandInterface::Initialize(void *config)
void *cWaylandInterface::EGLGetDisplay(void)
{
-#if HAVE_X11
- return eglGetDisplay((_XDisplay *) GLWin.wl_display);
-#else
return eglGetDisplay(GLWin.wl_display);
-#endif
}
void *cWaylandInterface::CreateWindow(void)
@@ -393,9 +389,6 @@ void cWaylandInterface::DestroyWindow(void)
wl_shell_surface_destroy(GLWin.wl_shell_surface);
wl_surface_destroy(GLWin.wl_surface);
-
- if (GLWin.wl_callback)
- wl_callback_destroy(GLWin.wl_callback);
}
void cWaylandInterface::UpdateFPSDisplay(const char *text)
diff --git a/Source/Core/DolphinWX/GLInterface/X11_Util.cpp b/Source/Core/DolphinWX/GLInterface/X11_Util.cpp
index c6528a674c..fe7bc66f8e 100644
--- a/Source/Core/DolphinWX/GLInterface/X11_Util.cpp
+++ b/Source/Core/DolphinWX/GLInterface/X11_Util.cpp
@@ -74,7 +74,11 @@ bool cXInterface::Initialize(void *config)
void *cXInterface::EGLGetDisplay(void)
{
+#if HAVE_WAYLAND
+ return eglGetDisplay((wl_display *) GLWin.dpy);
+#else
return eglGetDisplay(GLWin.dpy);
+#endif
}
void *cXInterface::CreateWindow(void)
diff --git a/Source/Core/DolphinWX/MainNoGUI.cpp b/Source/Core/DolphinWX/MainNoGUI.cpp
index 49ac423415..ee10bd87b4 100644
--- a/Source/Core/DolphinWX/MainNoGUI.cpp
+++ b/Source/Core/DolphinWX/MainNoGUI.cpp
@@ -18,7 +18,7 @@
#if HAVE_WAYLAND
#include <wayland-client.h>
-#include "GLInterface/Platform.h"
+#include "GLInterface.h"
#endif
#ifdef __APPLE__
diff --git a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
index 493b8ba791..ab99273c31 100644
--- a/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/ControllerInterface.cpp
@@ -1,7 +1,7 @@
#include "ControllerInterface.h"
#if USE_EGL
-#include "GLInterface/Platform.h"
+#include "GLInterface.h"
#endif
#ifdef CIFACE_USE_XINPUT