dolphin/Source/Core/DolphinWX/GLInterface/GLInterface.h

116 lines
2.4 KiB
C
Raw Normal View History

// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
2012-12-17 21:01:52 +00:00
#ifndef _GLINTERFACE_H_
#define _GLINTERFACE_H_
2012-12-17 21:01:52 +00:00
2014-01-20 02:06:55 +00:00
#include "Thread.h"
#if USE_EGL
2014-01-20 02:06:55 +00:00
// 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 "GLInterface/EGL.h"
2012-12-17 21:01:52 +00:00
#elif defined(__APPLE__)
#include "GLInterface/AGL.h"
2012-12-17 21:01:52 +00:00
#elif defined(_WIN32)
#include "GLInterface/WGL.h"
2014-01-20 02:06:55 +00:00
#elif HAVE_X11
#include "GLInterface/GLX.h"
#include <GL/glx.h>
2013-02-26 19:49:00 +00:00
#else
#error Platform doesnt have a GLInterface
2012-12-17 21:01:52 +00:00
#endif
2014-01-20 02:06:55 +00:00
#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
2012-12-17 21:01:52 +00:00
typedef struct {
2014-01-20 02:06:55 +00:00
#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
2012-12-17 21:01:52 +00:00
EGLSurface egl_surf;
EGLContext egl_ctx;
EGLDisplay egl_dpy;
2014-01-20 02:06:55 +00:00
enum egl_platform platform;
EGLNativeWindowType native_window;
#elif HAVE_X11
GLXContext ctx;
#endif
#if defined(__APPLE__)
2013-03-14 02:34:52 +00:00
NSView *cocoaWin;
2012-12-17 21:01:52 +00:00
NSOpenGLContext *cocoaCtx;
2014-01-20 02:06:55 +00:00
#elif HAVE_X11
2012-12-17 21:01:52 +00:00
int screen;
Window win;
Window parent;
// dpy used for glx stuff, evdpy for window events etc.
// evdpy is to be used by XEventThread only
Display *dpy, *evdpy;
XVisualInfo *vi;
XSetWindowAttributes attr;
std::thread xEventThread;
2014-01-20 02:06:55 +00:00
#endif
2012-12-17 21:01:52 +00:00
int x, y;
unsigned int width, height;
} GLWindow;
extern cInterfaceBase *GLInterface;
extern GLWindow GLWin;
#endif