2013-01-17 16:58:48 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2007-2012 Gabest
|
|
|
|
* http://www.gabest.org
|
|
|
|
*
|
|
|
|
* 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; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* 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 for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "GSWndEGL.h"
|
|
|
|
|
2016-05-01 09:43:18 +00:00
|
|
|
#if defined(__unix__) && defined(EGL_SUPPORTED)
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
// static method
|
|
|
|
int GSWndEGL::SelectPlatform()
|
|
|
|
{
|
|
|
|
// Check the supported extension
|
|
|
|
const char *client_extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
|
|
|
|
if (!client_extensions) {
|
|
|
|
fprintf(stderr, "EGL: Client extension not supported\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
fprintf(stdout, "EGL: Supported extensions: %s\n", client_extensions);
|
|
|
|
|
|
|
|
// Check platform extensions are supported (Note: there are core in 1.5)
|
|
|
|
if (!strstr(client_extensions, "EGL_EXT_platform_base")) {
|
|
|
|
fprintf(stderr, "EGL: Dynamic platform selection isn't supported\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Finally we can select the platform
|
|
|
|
#if GS_EGL_X11
|
|
|
|
if (strstr(client_extensions, "EGL_EXT_platform_x11")) {
|
|
|
|
fprintf(stdout, "EGL: select X11 platform\n");
|
|
|
|
return EGL_PLATFORM_X11_KHR;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#if GS_EGL_WL
|
|
|
|
if (strstr(client_extensions, "EGL_EXT_platform_wayland")) {
|
|
|
|
fprintf(stdout, "EGL: select Wayland platform\n");
|
|
|
|
return EGL_PLATFORM_WAYLAND_KHR;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
fprintf(stderr, "EGL: no compatible platform found\n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GSWndEGL::GSWndEGL(int platform)
|
|
|
|
: m_native_window(nullptr), m_platform(platform)
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-06-16 09:40:38 +00:00
|
|
|
void GSWndEGL::CreateContext(int major, int minor)
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
|
|
|
EGLConfig eglConfig;
|
2014-04-12 10:40:23 +00:00
|
|
|
EGLint numConfigs = 0;
|
2013-01-17 16:58:48 +00:00
|
|
|
EGLint contextAttribs[] =
|
|
|
|
{
|
|
|
|
EGL_CONTEXT_MAJOR_VERSION_KHR, major,
|
|
|
|
EGL_CONTEXT_MINOR_VERSION_KHR, minor,
|
2013-08-05 20:25:25 +00:00
|
|
|
#ifdef ENABLE_OGL_DEBUG
|
|
|
|
EGL_CONTEXT_FLAGS_KHR, EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR,
|
2015-12-29 21:27:24 +00:00
|
|
|
#else
|
|
|
|
// Open Source isn't happy with an unsupported flags...
|
|
|
|
//EGL_CONTEXT_FLAGS_KHR, GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR,
|
2013-08-05 20:25:25 +00:00
|
|
|
#endif
|
|
|
|
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR, EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
|
2013-01-17 16:58:48 +00:00
|
|
|
EGL_NONE
|
|
|
|
};
|
2013-07-06 09:42:46 +00:00
|
|
|
EGLint NullContextAttribs[] = { EGL_NONE };
|
2013-01-17 16:58:48 +00:00
|
|
|
EGLint attrList[] = {
|
|
|
|
EGL_RED_SIZE, 8,
|
|
|
|
EGL_GREEN_SIZE, 8,
|
|
|
|
EGL_BLUE_SIZE, 8,
|
2017-04-21 17:08:27 +00:00
|
|
|
EGL_DEPTH_SIZE, 0,
|
2013-01-17 16:58:48 +00:00
|
|
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
|
|
|
EGL_NONE
|
|
|
|
};
|
|
|
|
|
2016-10-21 15:32:56 +00:00
|
|
|
BindAPI();
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2014-04-12 10:40:23 +00:00
|
|
|
eglChooseConfig(m_eglDisplay, attrList, &eglConfig, 1, &numConfigs);
|
|
|
|
if ( numConfigs == 0 )
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
2015-08-12 07:55:16 +00:00
|
|
|
fprintf(stderr,"EGL: Failed to get a frame buffer config! (0x%x)\n", eglGetError() );
|
2013-06-16 09:40:38 +00:00
|
|
|
throw GSDXRecoverableError();
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
m_eglSurface = eglCreatePlatformWindowSurface(m_eglDisplay, eglConfig, m_native_window, nullptr);
|
2013-01-17 16:58:48 +00:00
|
|
|
if ( m_eglSurface == EGL_NO_SURFACE )
|
|
|
|
{
|
2013-05-25 14:28:16 +00:00
|
|
|
fprintf(stderr,"EGL: Failed to get a window surface\n");
|
2013-06-16 09:40:38 +00:00
|
|
|
throw GSDXRecoverableError();
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2013-07-06 09:42:46 +00:00
|
|
|
m_eglContext = eglCreateContext(m_eglDisplay, eglConfig, EGL_NO_CONTEXT, contextAttribs);
|
|
|
|
EGLint status = eglGetError();
|
2013-10-05 10:37:48 +00:00
|
|
|
if (status == EGL_BAD_ATTRIBUTE || status == EGL_BAD_MATCH) {
|
2013-07-06 09:42:46 +00:00
|
|
|
// Radeon/Gallium don't support advance attribute. Fallback to random value
|
2013-10-05 10:37:48 +00:00
|
|
|
// Note: Intel gives an EGL_BAD_MATCH. I don't know why but let's by stubborn and retry.
|
2014-12-07 11:12:53 +00:00
|
|
|
fprintf(stderr, "EGL: warning your driver doesn't support advance openGL context attributes\n");
|
2013-07-06 09:42:46 +00:00
|
|
|
m_eglContext = eglCreateContext(m_eglDisplay, eglConfig, EGL_NO_CONTEXT, NullContextAttribs);
|
|
|
|
status = eglGetError();
|
|
|
|
}
|
2013-01-17 16:58:48 +00:00
|
|
|
if ( m_eglContext == EGL_NO_CONTEXT )
|
|
|
|
{
|
2013-05-25 14:28:16 +00:00
|
|
|
fprintf(stderr,"EGL: Failed to create the context\n");
|
2013-07-06 09:42:46 +00:00
|
|
|
fprintf(stderr,"EGL STATUS: %x\n", status);
|
2013-06-16 09:40:38 +00:00
|
|
|
throw GSDXRecoverableError();
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( !eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext) )
|
|
|
|
{
|
2013-06-16 09:40:38 +00:00
|
|
|
throw GSDXRecoverableError();
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void GSWndEGL::AttachContext()
|
|
|
|
{
|
|
|
|
if (!IsContextAttached()) {
|
2016-10-21 15:32:56 +00:00
|
|
|
// The setting of the API is local to a thread. This function
|
2013-06-07 19:16:27 +00:00
|
|
|
// can be called from 2 threads.
|
2016-10-21 15:32:56 +00:00
|
|
|
BindAPI();
|
2013-06-07 19:16:27 +00:00
|
|
|
|
2013-01-17 16:58:48 +00:00
|
|
|
//fprintf(stderr, "Attach the context\n");
|
|
|
|
eglMakeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext);
|
|
|
|
m_ctx_attached = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void GSWndEGL::DetachContext()
|
|
|
|
{
|
|
|
|
if (IsContextAttached()) {
|
|
|
|
//fprintf(stderr, "Detach the context\n");
|
|
|
|
eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
|
|
|
m_ctx_attached = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-07-03 18:02:16 +00:00
|
|
|
void GSWndEGL::PopulateWndGlFunction()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-10-21 15:32:56 +00:00
|
|
|
void GSWndEGL::BindAPI()
|
|
|
|
{
|
|
|
|
eglBindAPI(EGL_OPENGL_API);
|
|
|
|
EGLenum api = eglQueryAPI();
|
|
|
|
if (api != EGL_OPENGL_API) {
|
|
|
|
fprintf(stderr,"EGL: Failed to bind the OpenGL API got 0x%x instead\n", api);
|
|
|
|
throw GSDXRecoverableError();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-01-17 16:58:48 +00:00
|
|
|
bool GSWndEGL::Attach(void* handle, bool managed)
|
|
|
|
{
|
|
|
|
m_managed = managed;
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
m_native_window = AttachNativeWindow(handle);
|
|
|
|
|
2013-06-16 09:40:38 +00:00
|
|
|
OpenEGLDisplay();
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-07-03 18:02:16 +00:00
|
|
|
FullContextInit();
|
2013-06-16 08:43:50 +00:00
|
|
|
|
2013-01-17 16:58:48 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void GSWndEGL::Detach()
|
|
|
|
{
|
|
|
|
// Actually the destructor is not called when there is only a GSclose/GSshutdown
|
|
|
|
// The window still need to be closed
|
|
|
|
DetachContext();
|
2013-06-30 11:18:46 +00:00
|
|
|
eglDestroyContext(m_eglDisplay, m_eglContext);
|
2017-04-29 08:39:53 +00:00
|
|
|
m_eglContext = nullptr;
|
|
|
|
|
2013-06-30 11:18:46 +00:00
|
|
|
eglDestroySurface(m_eglDisplay, m_eglSurface);
|
2017-04-29 08:39:53 +00:00
|
|
|
m_eglSurface = nullptr;
|
|
|
|
|
2013-01-17 16:58:48 +00:00
|
|
|
CloseEGLDisplay();
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
DestroyNativeResources();
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-05-26 15:26:46 +00:00
|
|
|
bool GSWndEGL::Create(const std::string& title, int w, int h)
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
|
|
|
if(w <= 0 || h <= 0) {
|
2016-05-24 19:52:06 +00:00
|
|
|
w = theApp.GetConfigI("ModeWidth");
|
|
|
|
h = theApp.GetConfigI("ModeHeight");
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
m_managed = true;
|
|
|
|
|
2013-06-16 09:40:38 +00:00
|
|
|
OpenEGLDisplay();
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
m_native_window = CreateNativeWindow(w, h);
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-07-03 18:02:16 +00:00
|
|
|
FullContextInit();
|
2013-06-16 16:33:08 +00:00
|
|
|
|
2013-06-16 09:40:38 +00:00
|
|
|
return true;
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2013-08-03 08:29:01 +00:00
|
|
|
void* GSWndEGL::GetProcAddress(const char* name, bool opt)
|
2013-06-16 08:43:50 +00:00
|
|
|
{
|
|
|
|
void* ptr = (void*)eglGetProcAddress(name);
|
2017-04-29 08:39:53 +00:00
|
|
|
if (ptr == nullptr) {
|
2019-02-09 10:16:51 +00:00
|
|
|
if (theApp.GetConfigB("debug_opengl"))
|
|
|
|
fprintf(stderr, "Failed to find %s\n", name);
|
|
|
|
|
2013-08-03 08:29:01 +00:00
|
|
|
if (!opt)
|
|
|
|
throw GSDXRecoverableError();
|
2013-06-16 08:43:50 +00:00
|
|
|
}
|
|
|
|
return ptr;
|
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
GSVector4i GSWndEGL::GetClientRect()
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
2017-04-29 08:39:53 +00:00
|
|
|
EGLint h = 0;
|
|
|
|
EGLint w = 0;
|
|
|
|
eglQuerySurface(m_eglDisplay, m_eglSurface, EGL_HEIGHT, &h);
|
|
|
|
eglQuerySurface(m_eglDisplay, m_eglSurface, EGL_WIDTH, &w);
|
|
|
|
|
|
|
|
return GSVector4i(0, 0, w, h);
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-08-21 22:02:29 +00:00
|
|
|
void GSWndEGL::SetSwapInterval()
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
2017-04-29 08:39:53 +00:00
|
|
|
// 0 -> disable vsync
|
|
|
|
// n -> wait n frame
|
2017-08-21 22:02:29 +00:00
|
|
|
eglSwapInterval(m_eglDisplay, m_vsync);
|
2017-04-29 08:39:53 +00:00
|
|
|
}
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
void GSWndEGL::Flip()
|
|
|
|
{
|
2017-08-21 22:02:29 +00:00
|
|
|
if (m_vsync_change_requested.exchange(false))
|
|
|
|
SetSwapInterval();
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
eglSwapBuffers(m_eglDisplay, m_eglSurface);
|
|
|
|
}
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
void GSWndEGL::CloseEGLDisplay()
|
|
|
|
{
|
|
|
|
eglReleaseThread();
|
|
|
|
eglTerminate(m_eglDisplay);
|
|
|
|
}
|
|
|
|
|
|
|
|
void GSWndEGL::OpenEGLDisplay()
|
|
|
|
{
|
|
|
|
// We only need a native display when we manage the window ourself.
|
|
|
|
// By default, EGL will create its own native display. This way the driver knows
|
|
|
|
// that display will be thread safe and so it can enable multithread optimization.
|
|
|
|
void *native_display = (m_managed) ? CreateNativeDisplay() : nullptr;
|
|
|
|
|
|
|
|
// Create an EGL display from the native display
|
|
|
|
m_eglDisplay = eglGetPlatformDisplay(m_platform, native_display, nullptr);
|
|
|
|
if (m_eglDisplay == EGL_NO_DISPLAY) {
|
|
|
|
fprintf(stderr,"EGL: Failed to open a display! (0x%x)\n", eglGetError() );
|
|
|
|
throw GSDXRecoverableError();
|
|
|
|
}
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
if (!eglInitialize(m_eglDisplay, nullptr, nullptr)) {
|
|
|
|
fprintf(stderr,"EGL: Failed to initialize the display! (0x%x)\n", eglGetError() );
|
|
|
|
throw GSDXRecoverableError();
|
|
|
|
}
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// X11 platform
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#if GS_EGL_X11
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
GSWndEGL_X11::GSWndEGL_X11()
|
|
|
|
: GSWndEGL(EGL_PLATFORM_X11_KHR), m_NativeDisplay(nullptr), m_NativeWindow(0)
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
2017-04-29 08:39:53 +00:00
|
|
|
}
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
void *GSWndEGL_X11::CreateNativeDisplay()
|
|
|
|
{
|
|
|
|
if (m_NativeDisplay == nullptr)
|
|
|
|
m_NativeDisplay = XOpenDisplay(nullptr);
|
|
|
|
|
|
|
|
return (void*)m_NativeDisplay;
|
|
|
|
}
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
void *GSWndEGL_X11::CreateNativeWindow(int w, int h)
|
|
|
|
{
|
|
|
|
const int depth = 0, x = 0, y = 0, border_width = 1;
|
|
|
|
#if 0
|
|
|
|
// Old X code in case future code will still require it
|
|
|
|
m_NativeWindow = XCreateSimpleWindow(m_NativeDisplay, DefaultRootWindow(m_NativeDisplay), 0, 0, w, h, 0, 0, 0);
|
|
|
|
XMapWindow (m_NativeDisplay, m_NativeWindow);
|
|
|
|
#endif
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
if (m_NativeDisplay == nullptr) {
|
|
|
|
fprintf(stderr, "EGL X11: display wasn't created before the window\n");
|
|
|
|
throw GSDXRecoverableError();
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
xcb_connection_t *c = XGetXCBConnection(m_NativeDisplay);
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
const xcb_setup_t *setup = xcb_get_setup(c);
|
|
|
|
|
|
|
|
xcb_screen_t *screen = (xcb_setup_roots_iterator (setup)).data;
|
|
|
|
|
|
|
|
m_NativeWindow = xcb_generate_id(c);
|
|
|
|
|
|
|
|
if (m_NativeWindow == 0) {
|
|
|
|
fprintf(stderr, "EGL X11: failed to create the native window\n");
|
|
|
|
throw GSDXRecoverableError();
|
|
|
|
}
|
|
|
|
|
|
|
|
xcb_create_window (c, depth, m_NativeWindow, screen->root, x, y, w, h,
|
|
|
|
border_width, InputOutput, screen->root_visual, 0, nullptr);
|
|
|
|
|
|
|
|
xcb_map_window (c, m_NativeWindow);
|
|
|
|
|
|
|
|
xcb_flush(c);
|
|
|
|
|
|
|
|
return (void*)&m_NativeWindow;
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
void *GSWndEGL_X11::AttachNativeWindow(void *handle)
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
2017-04-29 08:39:53 +00:00
|
|
|
m_NativeWindow = *(Window*)handle;
|
|
|
|
return handle;
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
void GSWndEGL_X11::DestroyNativeResources()
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
2017-04-29 08:39:53 +00:00
|
|
|
if (m_NativeDisplay) {
|
|
|
|
XCloseDisplay(m_NativeDisplay);
|
|
|
|
m_NativeDisplay = nullptr;
|
|
|
|
}
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
bool GSWndEGL_X11::SetWindowText(const char* title)
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
2017-04-29 08:39:53 +00:00
|
|
|
if (!m_managed) return true;
|
|
|
|
|
|
|
|
xcb_connection_t *c = XGetXCBConnection(m_NativeDisplay);
|
|
|
|
|
|
|
|
xcb_change_property(c, XCB_PROP_MODE_REPLACE, m_NativeWindow,
|
|
|
|
XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8,
|
|
|
|
strlen (title), title);
|
|
|
|
|
|
|
|
return true;
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
// Wayland platform (just a place holder)
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#if GS_EGL_WL
|
|
|
|
|
|
|
|
GSWndEGL_WL::GSWndEGL_WL()
|
|
|
|
: GSWndEGL(EGL_PLATFORM_WAYLAND_KHR), m_NativeDisplay(nullptr), m_NativeWindow(nullptr)
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
void *GSWndEGL_WL::CreateNativeDisplay()
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
2017-04-29 08:39:53 +00:00
|
|
|
if (m_NativeDisplay == nullptr)
|
|
|
|
m_NativeDisplay = wl_display_connect(NULL);
|
|
|
|
|
|
|
|
return (void*)m_NativeDisplay;
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
void *GSWndEGL_WL::CreateNativeWindow(int w, int h)
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
2017-04-29 08:39:53 +00:00
|
|
|
return nullptr;
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
void *GSWndEGL_WL::AttachNativeWindow(void *handle)
|
2013-01-17 16:58:48 +00:00
|
|
|
{
|
2017-04-29 08:39:53 +00:00
|
|
|
m_NativeWindow = (wl_egl_window*)handle;
|
|
|
|
return handle;
|
|
|
|
}
|
2013-01-17 16:58:48 +00:00
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
void GSWndEGL_WL::DestroyNativeResources()
|
|
|
|
{
|
|
|
|
if (m_NativeDisplay) {
|
|
|
|
wl_display_disconnect(m_NativeDisplay);
|
|
|
|
m_NativeDisplay = nullptr;
|
2015-08-12 07:55:16 +00:00
|
|
|
}
|
2013-01-17 16:58:48 +00:00
|
|
|
}
|
|
|
|
|
2017-04-29 08:39:53 +00:00
|
|
|
bool GSWndEGL_WL::SetWindowText(const char* title)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2013-01-17 16:58:48 +00:00
|
|
|
#endif
|