2014-08-09 14:31:27 +00:00
|
|
|
// Copyright 2014 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2014-08-09 14:31:27 +00:00
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2015-09-18 16:40:00 +00:00
|
|
|
#include "Common/GL/GLInterface/EGLX11.h"
|
2015-09-26 21:13:07 +00:00
|
|
|
#include "Common/Logging/Log.h"
|
2014-08-09 14:31:27 +00:00
|
|
|
|
|
|
|
EGLDisplay cInterfaceEGLX11::OpenDisplay()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
dpy = XOpenDisplay(nullptr);
|
|
|
|
XWindow.Initialize(dpy);
|
|
|
|
return eglGetDisplay(dpy);
|
2014-08-09 14:31:27 +00:00
|
|
|
}
|
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
EGLNativeWindowType cInterfaceEGLX11::InitializePlatform(EGLNativeWindowType host_window,
|
|
|
|
EGLConfig config)
|
2014-08-09 14:31:27 +00:00
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
EGLint vid;
|
|
|
|
eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid);
|
2014-08-09 14:31:27 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
XVisualInfo visTemplate;
|
|
|
|
visTemplate.visualid = vid;
|
2014-08-09 14:31:27 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
XVisualInfo* vi;
|
|
|
|
int nVisuals;
|
|
|
|
vi = XGetVisualInfo(dpy, VisualIDMask, &visTemplate, &nVisuals);
|
2014-08-09 14:31:27 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
XWindowAttributes attribs;
|
|
|
|
if (!XGetWindowAttributes(dpy, (Window)host_window, &attribs))
|
|
|
|
{
|
|
|
|
ERROR_LOG(VIDEO, "Window attribute retrieval failed");
|
|
|
|
return 0;
|
|
|
|
}
|
2014-10-23 12:54:05 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
s_backbuffer_width = attribs.width;
|
|
|
|
s_backbuffer_height = attribs.height;
|
2014-10-23 12:54:05 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
return (EGLNativeWindowType)XWindow.CreateXWindow((Window)host_window, vi);
|
2014-08-09 14:31:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void cInterfaceEGLX11::ShutdownPlatform()
|
|
|
|
{
|
2016-06-24 08:43:46 +00:00
|
|
|
XWindow.DestroyXWindow();
|
|
|
|
XCloseDisplay(dpy);
|
2014-08-09 14:31:27 +00:00
|
|
|
}
|