mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
+2
-28
@@ -6,7 +6,6 @@ cmake_minimum_required(VERSION 2.8)
|
||||
option(ANDROID "Enables a build for Android" OFF)
|
||||
option(USE_EGL "Enables EGL OpenGL Interface" OFF)
|
||||
option(TRY_X11 "Enables X11 Support" ON)
|
||||
option(TRY_WAYLAND "Enables Wayland Support" OFF)
|
||||
option(USE_UPNP "Enables UPnP port mapping support" ON)
|
||||
option(DISABLE_WX "Disable wxWidgets (use CLI interface)" OFF)
|
||||
option(ENABLE_PCH "Use PCH to speed up compilation" ON)
|
||||
@@ -324,7 +323,6 @@ if(ANDROID)
|
||||
message("Building for Android")
|
||||
add_definitions(-DANDROID)
|
||||
set(USE_X11 0)
|
||||
set(USE_WAYLAND 0)
|
||||
set(USE_UPNP 0)
|
||||
set(USE_EGL 1)
|
||||
endif()
|
||||
@@ -407,26 +405,8 @@ if(NOT ANDROID)
|
||||
endif(OPENAL_FOUND)
|
||||
|
||||
set(USE_X11 0)
|
||||
set(USE_WAYLAND 0)
|
||||
|
||||
if(UNIX AND NOT APPLE)
|
||||
# Note: The convention is to check TRY_X11 or TRY_WAYLAND where needed.
|
||||
# This is where we detect platforms and set the variables accordingly.
|
||||
pkg_check_modules(WAYLAND wayland-egl wayland-client wayland-cursor)
|
||||
if(TRY_WAYLAND AND WAYLAND_FOUND)
|
||||
pkg_check_modules(XKBCOMMON xkbcommon)
|
||||
if(XKBCOMMON_FOUND)
|
||||
set(USE_WAYLAND 1)
|
||||
add_definitions(-DHAVE_WAYLAND)
|
||||
include_directories(${WAYLAND_INCLUDE_DIR})
|
||||
message("Wayland support enabled")
|
||||
endif(XKBCOMMON_FOUND)
|
||||
else()
|
||||
set(USE_WAYLAND 0)
|
||||
message("Wayland support disabled")
|
||||
add_definitions(-DHAVE_WAYLAND=0)
|
||||
endif(TRY_WAYLAND AND WAYLAND_FOUND)
|
||||
|
||||
# Note: We do not need to explicitly check for X11 as it is done in the cmake
|
||||
# FindOpenGL module on linux.
|
||||
if(TRY_X11 AND X11_FOUND)
|
||||
@@ -441,19 +421,13 @@ if(NOT ANDROID)
|
||||
add_definitions(-DHAVE_X11=0)
|
||||
endif(TRY_X11 AND X11_FOUND)
|
||||
|
||||
if (NOT USE_WAYLAND AND NOT USE_X11)
|
||||
if (NOT USE_X11)
|
||||
message(FATAL_ERROR "\n"
|
||||
"No suitable display platform found\n"
|
||||
"Requires wayland or x11 to run")
|
||||
"Requires x11 to run")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# For now Wayland and EGL are tied to each other.
|
||||
# The alternative would be an shm path
|
||||
if(USE_WAYLAND)
|
||||
set(USE_EGL 1)
|
||||
endif()
|
||||
|
||||
if(USE_X11)
|
||||
check_lib(XRANDR Xrandr)
|
||||
if(XRANDR_FOUND)
|
||||
|
||||
@@ -126,21 +126,6 @@ void DisplayMessage(const std::string& message, int time_in_ms)
|
||||
}
|
||||
|
||||
g_video_backend->Video_AddMessage(message, time_in_ms);
|
||||
|
||||
if (_CoreParameter.bRenderToMain &&
|
||||
SConfig::GetInstance().m_InterfaceStatusbar)
|
||||
{
|
||||
Host_UpdateStatusBar(message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Host_UpdateTitle(message);
|
||||
}
|
||||
}
|
||||
|
||||
void *GetWindowHandle()
|
||||
{
|
||||
return g_pWindowHandle;
|
||||
}
|
||||
|
||||
bool IsRunning()
|
||||
@@ -213,9 +198,6 @@ bool Init()
|
||||
!!SConfig::GetInstance().m_SYSCONF->GetData<u8>("IPL.AR"));
|
||||
}
|
||||
|
||||
// g_pWindowHandle is first the m_Panel handle,
|
||||
// then it is updated to the render window handle,
|
||||
// within g_video_backend->Initialize()
|
||||
g_pWindowHandle = Host_GetRenderHandle();
|
||||
|
||||
// Start the emu thread
|
||||
@@ -700,10 +682,6 @@ void UpdateTitle()
|
||||
}
|
||||
// This is our final "frame counter" string
|
||||
std::string SMessage = StringFromFormat("%s | %s", SSettings.c_str(), SFPS.c_str());
|
||||
std::string TMessage = StringFromFormat("%s | %s", scm_rev_str, SMessage.c_str());
|
||||
|
||||
// Show message
|
||||
g_video_backend->UpdateFPSDisplay(SMessage);
|
||||
|
||||
// Update the audio timestretcher with the current speed
|
||||
if (soundStream)
|
||||
@@ -712,16 +690,7 @@ void UpdateTitle()
|
||||
pMixer->UpdateSpeed((float)Speed / 100);
|
||||
}
|
||||
|
||||
if (_CoreParameter.bRenderToMain &&
|
||||
SConfig::GetInstance().m_InterfaceStatusbar)
|
||||
{
|
||||
Host_UpdateStatusBar(SMessage);
|
||||
Host_UpdateTitle(scm_rev_str);
|
||||
}
|
||||
else
|
||||
{
|
||||
Host_UpdateTitle(TMessage);
|
||||
}
|
||||
Host_UpdateTitle(SMessage);
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
|
||||
@@ -59,9 +59,6 @@ void SaveScreenShot();
|
||||
|
||||
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
|
||||
void* GetWindowHandle();
|
||||
|
||||
|
||||
// This displays messages in a user-visible way.
|
||||
void DisplayMessage(const std::string& message, int time_in_ms);
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ void Host_SetWiiMoteConnectionState(int _State);
|
||||
void Host_SysMessage(const char *fmt, ...);
|
||||
void Host_UpdateDisasmDialog();
|
||||
void Host_UpdateMainFrame();
|
||||
void Host_UpdateStatusBar(const std::string& text, int Filed = 0);
|
||||
void Host_UpdateTitle(const std::string& title);
|
||||
void Host_ShowVideoConfig(void* parent, const std::string& backend_name,
|
||||
const std::string& config_name);
|
||||
|
||||
@@ -279,9 +279,6 @@ bool PPCSymbolDB::SaveMap(const std::string& filename, bool WithCodes) const
|
||||
mapFile.c_str()).c_str(), "Confirm", wxYES_NO)) return false;
|
||||
}
|
||||
|
||||
if (WithCodes)
|
||||
Host_UpdateStatusBar("Saving code, please stand by ...");
|
||||
|
||||
// Make a file
|
||||
File::IOFile f(mapFile, "w");
|
||||
if (!f)
|
||||
@@ -342,8 +339,6 @@ bool PPCSymbolDB::SaveMap(const std::string& filename, bool WithCodes) const
|
||||
fprintf(f.GetHandle(), "\n");
|
||||
}
|
||||
}
|
||||
// ---------------
|
||||
Host_UpdateStatusBar(StringFromFormat("Saved %s", mapFile.c_str()).c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IniFile.h"
|
||||
#include "Common/Thread.h"
|
||||
#include "DolphinWX/Android/ButtonManager.h"
|
||||
#include "DolphinWX/GLInterface/GLInterface.h"
|
||||
|
||||
namespace ButtonManager
|
||||
{
|
||||
|
||||
@@ -10,9 +10,6 @@ if(NOT ANDROID)
|
||||
if(USE_X11)
|
||||
set(LIBS ${LIBS} ${XRANDR_LIBRARIES})
|
||||
endif()
|
||||
if(USE_WAYLAND)
|
||||
set(LIBS ${LIBS} ${WAYLAND_LIBRARIES} ${XKBCOMMON_LIBRARIES})
|
||||
endif()
|
||||
|
||||
link_directories(${CMAKE_PREFIX_PATH}/lib)
|
||||
else()
|
||||
@@ -76,25 +73,23 @@ set(ANDROID_SRCS Android/ButtonManager.cpp
|
||||
MainAndroid.cpp)
|
||||
|
||||
if(USE_EGL)
|
||||
set(SRCS ${SRCS} GLInterface/Platform.cpp
|
||||
GLInterface/EGL.cpp)
|
||||
if(USE_WAYLAND)
|
||||
set(SRCS ${SRCS} GLInterface/Wayland_Util.cpp)
|
||||
endif()
|
||||
if(USE_X11)
|
||||
set(SRCS ${SRCS} GLInterface/X11_Util.cpp)
|
||||
endif()
|
||||
else()
|
||||
if(WIN32)
|
||||
set(SRCS ${SRCS} GLInterface/WGL.cpp)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(SRCS ${SRCS} GLInterface/AGL.cpp)
|
||||
else()
|
||||
set(SRCS ${SRCS} GLInterface/GLX.cpp
|
||||
GLInterface/X11_Util.cpp)
|
||||
|
||||
set(SRCS ${SRCS} GLInterface/EGL.cpp)
|
||||
if(ANDROID)
|
||||
set(SRCS ${SRCS} GLInterface/EGLAndroid.cpp)
|
||||
elseif(USE_X11)
|
||||
set(SRCS ${SRCS} GLInterface/EGLX11.cpp)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set(SRCS ${SRCS} GLInterface/WGL.cpp)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
set(SRCS ${SRCS} GLInterface/AGL.cpp)
|
||||
elseif(USE_X11)
|
||||
set(SRCS ${SRCS} GLInterface/GLX.cpp
|
||||
GLInterface/X11_Util.cpp)
|
||||
endif()
|
||||
|
||||
set(SRCS ${SRCS} GLInterface/GLInterface.cpp)
|
||||
|
||||
set(NOGUI_SRCS MainNoGUI.cpp)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
@@ -100,7 +100,6 @@
|
||||
<ClCompile Include="WxUtils.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="GLInterface\GLInterface.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="AboutDolphin.h" />
|
||||
<ClInclude Include="ARCodeAddEdit.h" />
|
||||
|
||||
@@ -282,7 +282,6 @@
|
||||
<ClInclude Include="WiimoteConfigDiag.h">
|
||||
<Filter>GUI</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="GLInterface\GLInterface.h" />
|
||||
<ClInclude Include="SoftwareVideoConfigDialog.h">
|
||||
<Filter>GUI\Video</Filter>
|
||||
</ClInclude>
|
||||
|
||||
@@ -2,14 +2,6 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
|
||||
// CFrame is the main parent window. Inside CFrame there is an m_Panel that is
|
||||
// the parent for the rendering window (when we render to the main window). In
|
||||
// Windows the rendering window is created by giving CreateWindow()
|
||||
// m_Panel->GetHandle() as parent window and creating a new child window to
|
||||
// m_Panel. The new child window handle that is returned by CreateWindow() can
|
||||
// be accessed from Core::GetWindowHandle().
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
@@ -636,6 +628,21 @@ WXLRESULT CFrame::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
|
||||
}
|
||||
#endif
|
||||
|
||||
void CFrame::UpdateTitle(const std::string &str)
|
||||
{
|
||||
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain &&
|
||||
SConfig::GetInstance().m_InterfaceStatusbar)
|
||||
{
|
||||
GetStatusBar()->SetStatusText(str, 0);
|
||||
m_RenderFrame->SetTitle(scm_rev_str);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string titleStr = StringFromFormat("%s | %s", scm_rev_str, str.c_str());
|
||||
m_RenderFrame->SetTitle(titleStr);
|
||||
}
|
||||
}
|
||||
|
||||
void CFrame::OnHostMessage(wxCommandEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
@@ -650,8 +657,7 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
|
||||
break;
|
||||
|
||||
case IDM_UPDATETITLE:
|
||||
if (m_RenderFrame != nullptr)
|
||||
m_RenderFrame->SetTitle(event.GetString());
|
||||
SetTitle(event.GetString());
|
||||
break;
|
||||
|
||||
case IDM_WINDOWSIZEREQUEST:
|
||||
|
||||
@@ -126,6 +126,7 @@ public:
|
||||
void UpdateWiiMenuChoice(wxMenuItem *WiiMenuItem=nullptr);
|
||||
void PopulateSavedPerspectives();
|
||||
static void ConnectWiimote(int wm_idx, bool connect);
|
||||
void UpdateTitle(const std::string &str);
|
||||
|
||||
const CGameListCtrl *GetGameListCtrl() const;
|
||||
|
||||
|
||||
@@ -2,18 +2,6 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
|
||||
/*
|
||||
1.1 Windows
|
||||
|
||||
CFrame is the main parent window. Inside CFrame there is m_Panel which is the
|
||||
parent for the rendering window (when we render to the main window). In Windows
|
||||
the rendering window is created by giving CreateWindow() m_Panel->GetHandle()
|
||||
as parent window and creating a new child window to m_Panel. The new child
|
||||
window handle that is returned by CreateWindow() can be accessed from
|
||||
Core::GetWindowHandle().
|
||||
*/
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <mutex>
|
||||
@@ -840,13 +828,6 @@ void CFrame::OnRenderParentResize(wxSizeEvent& event)
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = width;
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = height;
|
||||
}
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
wxRect client_rect = m_RenderParent->GetClientRect();
|
||||
XMoveResizeWindow(X11Utils::XDisplayFromHandle(GetHandle()),
|
||||
(Window) Core::GetWindowHandle(),
|
||||
client_rect.x, client_rect.y,
|
||||
client_rect.width, client_rect.height);
|
||||
#endif
|
||||
m_LogWindow->Refresh();
|
||||
m_LogWindow->Update();
|
||||
}
|
||||
|
||||
@@ -4,28 +4,29 @@
|
||||
|
||||
#include <wx/panel.h>
|
||||
|
||||
#include "DolphinWX/GLInterface/GLInterface.h"
|
||||
#include "DolphinWX/GLInterface/AGL.h"
|
||||
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
#include "VideoCommon/VertexShaderManager.h"
|
||||
#include "VideoCommon/VideoConfig.h"
|
||||
|
||||
void cInterfaceAGL::Swap()
|
||||
{
|
||||
[GLWin.cocoaCtx flushBuffer];
|
||||
[cocoaCtx flushBuffer];
|
||||
}
|
||||
|
||||
// Create rendering window.
|
||||
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
|
||||
bool cInterfaceAGL::Create(void *&window_handle)
|
||||
bool cInterfaceAGL::Create(void *window_handle)
|
||||
{
|
||||
// FIXME: Get rid of the explicit use of wxPanel here. This shouldn't be necessary.
|
||||
GLWin.cocoaWin = reinterpret_cast<NSView*>(((wxPanel*)window_handle)->GetHandle());
|
||||
NSSize size = [GLWin.cocoaWin frame].size;
|
||||
cocoaWin = reinterpret_cast<NSView*>(((wxPanel*)window_handle)->GetHandle());
|
||||
NSSize size = [cocoaWin frame].size;
|
||||
|
||||
// Enable high-resolution display support.
|
||||
[GLWin.cocoaWin setWantsBestResolutionOpenGLSurface:YES];
|
||||
[cocoaWin setWantsBestResolutionOpenGLSurface:YES];
|
||||
|
||||
NSWindow *window = [GLWin.cocoaWin window];
|
||||
NSWindow *window = [cocoaWin window];
|
||||
|
||||
float scale = [window backingScaleFactor];
|
||||
size.width *= scale;
|
||||
@@ -43,21 +44,21 @@ bool cInterfaceAGL::Create(void *&window_handle)
|
||||
return false;
|
||||
}
|
||||
|
||||
GLWin.cocoaCtx = [[NSOpenGLContext alloc]
|
||||
cocoaCtx = [[NSOpenGLContext alloc]
|
||||
initWithFormat: fmt shareContext: nil];
|
||||
[fmt release];
|
||||
if (GLWin.cocoaCtx == nil) {
|
||||
if (cocoaCtx == nil) {
|
||||
ERROR_LOG(VIDEO, "failed to create context");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (GLWin.cocoaWin == nil) {
|
||||
if (cocoaWin == nil) {
|
||||
ERROR_LOG(VIDEO, "failed to create window");
|
||||
return false;
|
||||
}
|
||||
|
||||
[window makeFirstResponder:GLWin.cocoaWin];
|
||||
[GLWin.cocoaCtx setView: GLWin.cocoaWin];
|
||||
[window makeFirstResponder:cocoaWin];
|
||||
[cocoaCtx setView: cocoaWin];
|
||||
[window makeKeyAndOrderFront: nil];
|
||||
|
||||
return true;
|
||||
@@ -65,7 +66,7 @@ bool cInterfaceAGL::Create(void *&window_handle)
|
||||
|
||||
bool cInterfaceAGL::MakeCurrent()
|
||||
{
|
||||
[GLWin.cocoaCtx makeCurrentContext];
|
||||
[cocoaCtx makeCurrentContext];
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -79,15 +80,15 @@ bool cInterfaceAGL::ClearCurrent()
|
||||
// Close backend
|
||||
void cInterfaceAGL::Shutdown()
|
||||
{
|
||||
[GLWin.cocoaCtx clearDrawable];
|
||||
[GLWin.cocoaCtx release];
|
||||
GLWin.cocoaCtx = nil;
|
||||
[cocoaCtx clearDrawable];
|
||||
[cocoaCtx release];
|
||||
cocoaCtx = nil;
|
||||
}
|
||||
|
||||
void cInterfaceAGL::Update()
|
||||
{
|
||||
NSWindow *window = [GLWin.cocoaWin window];
|
||||
NSSize size = [GLWin.cocoaWin frame].size;
|
||||
NSWindow *window = [cocoaWin window];
|
||||
NSSize size = [cocoaWin frame].size;
|
||||
|
||||
float scale = [window backingScaleFactor];
|
||||
size.width *= scale;
|
||||
@@ -100,11 +101,11 @@ void cInterfaceAGL::Update()
|
||||
s_backbuffer_width = size.width;
|
||||
s_backbuffer_height = size.height;
|
||||
|
||||
[GLWin.cocoaCtx update];
|
||||
[cocoaCtx update];
|
||||
}
|
||||
|
||||
void cInterfaceAGL::SwapInterval(int interval)
|
||||
{
|
||||
[GLWin.cocoaCtx setValues:(GLint *)&interval forParameter:NSOpenGLCPSwapInterval];
|
||||
[cocoaCtx setValues:(GLint *)&interval forParameter:NSOpenGLCPSwapInterval];
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,12 @@
|
||||
|
||||
class cInterfaceAGL : public cInterfaceBase
|
||||
{
|
||||
private:
|
||||
NSView *cocoaWin;
|
||||
NSOpenGLContext *cocoaCtx;
|
||||
public:
|
||||
void Swap();
|
||||
bool Create(void *&window_handle);
|
||||
bool Create(void *window_handle);
|
||||
bool MakeCurrent();
|
||||
bool ClearCurrent();
|
||||
void Shutdown();
|
||||
|
||||
@@ -2,22 +2,18 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/Host.h"
|
||||
#include "DolphinWX/GLInterface/GLInterface.h"
|
||||
#include "DolphinWX/GLInterface/EGL.h"
|
||||
#include "VideoBackends/OGL/GLInterfaceBase.h"
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
|
||||
// Show the current FPS
|
||||
void cInterfaceEGL::UpdateFPSDisplay(const std::string& text)
|
||||
{
|
||||
Platform.UpdateFPSDisplay(text);
|
||||
}
|
||||
void cInterfaceEGL::Swap()
|
||||
{
|
||||
Platform.SwapBuffers();
|
||||
eglSwapBuffers(egl_dpy, egl_surf);
|
||||
}
|
||||
void cInterfaceEGL::SwapInterval(int Interval)
|
||||
{
|
||||
eglSwapInterval(GLWin.egl_dpy, Interval);
|
||||
eglSwapInterval(egl_dpy, Interval);
|
||||
}
|
||||
|
||||
void* cInterfaceEGL::GetFuncAddress(const std::string& name)
|
||||
@@ -43,7 +39,7 @@ void cInterfaceEGL::DetectMode()
|
||||
EGL_NONE };
|
||||
|
||||
// Get how many configs there are
|
||||
if (!eglChooseConfig( GLWin.egl_dpy, attribs, nullptr, 0, &num_configs))
|
||||
if (!eglChooseConfig( egl_dpy, attribs, nullptr, 0, &num_configs))
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
|
||||
goto err_exit;
|
||||
@@ -52,7 +48,7 @@ void cInterfaceEGL::DetectMode()
|
||||
config = new EGLConfig[num_configs];
|
||||
|
||||
// Get all the configurations
|
||||
if (!eglChooseConfig(GLWin.egl_dpy, attribs, config, num_configs, &num_configs))
|
||||
if (!eglChooseConfig(egl_dpy, attribs, config, num_configs, &num_configs))
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
|
||||
goto err_exit;
|
||||
@@ -62,7 +58,7 @@ void cInterfaceEGL::DetectMode()
|
||||
{
|
||||
EGLint attribVal;
|
||||
bool ret;
|
||||
ret = eglGetConfigAttrib(GLWin.egl_dpy, config[i], EGL_RENDERABLE_TYPE, &attribVal);
|
||||
ret = eglGetConfigAttrib(egl_dpy, config[i], EGL_RENDERABLE_TYPE, &attribVal);
|
||||
if (ret)
|
||||
{
|
||||
if (attribVal & EGL_OPENGL_BIT)
|
||||
@@ -88,25 +84,20 @@ err_exit:
|
||||
|
||||
// Create rendering window.
|
||||
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
|
||||
bool cInterfaceEGL::Create(void *&window_handle)
|
||||
bool cInterfaceEGL::Create(void *window_handle)
|
||||
{
|
||||
const char *s;
|
||||
EGLint egl_major, egl_minor;
|
||||
|
||||
if (!Platform.SelectDisplay())
|
||||
return false;
|
||||
egl_dpy = OpenDisplay();
|
||||
|
||||
GLWin.egl_dpy = Platform.EGLGetDisplay();
|
||||
|
||||
if (!GLWin.egl_dpy)
|
||||
if (!egl_dpy)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: eglGetDisplay() failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
GLWin.platform = Platform.platform;
|
||||
|
||||
if (!eglInitialize(GLWin.egl_dpy, &egl_major, &egl_minor))
|
||||
if (!eglInitialize(egl_dpy, &egl_major, &egl_minor))
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: eglInitialize() failed\n");
|
||||
return false;
|
||||
@@ -151,7 +142,7 @@ bool cInterfaceEGL::Create(void *&window_handle)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!eglChooseConfig( GLWin.egl_dpy, attribs, &config, 1, &num_configs))
|
||||
if (!eglChooseConfig( egl_dpy, attribs, &config, 1, &num_configs))
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
|
||||
exit(1);
|
||||
@@ -162,62 +153,57 @@ bool cInterfaceEGL::Create(void *&window_handle)
|
||||
else
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
|
||||
if (!Platform.Init(config, window_handle))
|
||||
return false;
|
||||
EGLNativeWindowType host_window = (EGLNativeWindowType) window_handle;
|
||||
EGLNativeWindowType native_window = InitializePlatform(host_window, config);
|
||||
|
||||
s = eglQueryString(GLWin.egl_dpy, EGL_VERSION);
|
||||
s = eglQueryString(egl_dpy, EGL_VERSION);
|
||||
INFO_LOG(VIDEO, "EGL_VERSION = %s\n", s);
|
||||
|
||||
s = eglQueryString(GLWin.egl_dpy, EGL_VENDOR);
|
||||
s = eglQueryString(egl_dpy, EGL_VENDOR);
|
||||
INFO_LOG(VIDEO, "EGL_VENDOR = %s\n", s);
|
||||
|
||||
s = eglQueryString(GLWin.egl_dpy, EGL_EXTENSIONS);
|
||||
s = eglQueryString(egl_dpy, EGL_EXTENSIONS);
|
||||
INFO_LOG(VIDEO, "EGL_EXTENSIONS = %s\n", s);
|
||||
|
||||
s = eglQueryString(GLWin.egl_dpy, EGL_CLIENT_APIS);
|
||||
s = eglQueryString(egl_dpy, EGL_CLIENT_APIS);
|
||||
INFO_LOG(VIDEO, "EGL_CLIENT_APIS = %s\n", s);
|
||||
|
||||
GLWin.egl_ctx = eglCreateContext(GLWin.egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs );
|
||||
if (!GLWin.egl_ctx)
|
||||
egl_ctx = eglCreateContext(egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs );
|
||||
if (!egl_ctx)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: eglCreateContext failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
GLWin.native_window = Platform.CreateWindow();
|
||||
|
||||
GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config, GLWin.native_window, nullptr);
|
||||
if (!GLWin.egl_surf)
|
||||
egl_surf = eglCreateWindowSurface(egl_dpy, config, native_window, nullptr);
|
||||
if (!egl_surf)
|
||||
{
|
||||
INFO_LOG(VIDEO, "Error: eglCreateWindowSurface failed\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
Platform.ToggleFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
|
||||
|
||||
window_handle = (void *)GLWin.native_window;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cInterfaceEGL::MakeCurrent()
|
||||
{
|
||||
return eglMakeCurrent(GLWin.egl_dpy, GLWin.egl_surf, GLWin.egl_surf, GLWin.egl_ctx);
|
||||
return eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx);
|
||||
}
|
||||
// Close backend
|
||||
void cInterfaceEGL::Shutdown()
|
||||
{
|
||||
Platform.DestroyWindow();
|
||||
if (GLWin.egl_ctx && !eglMakeCurrent(GLWin.egl_dpy, GLWin.egl_surf, GLWin.egl_surf, GLWin.egl_ctx))
|
||||
ShutdownPlatform();
|
||||
if (egl_ctx && !eglMakeCurrent(egl_dpy, egl_surf, egl_surf, egl_ctx))
|
||||
NOTICE_LOG(VIDEO, "Could not release drawing context.");
|
||||
if (GLWin.egl_ctx)
|
||||
if (egl_ctx)
|
||||
{
|
||||
eglMakeCurrent(GLWin.egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (!eglDestroyContext(GLWin.egl_dpy, GLWin.egl_ctx))
|
||||
eglMakeCurrent(egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
if (!eglDestroyContext(egl_dpy, egl_ctx))
|
||||
NOTICE_LOG(VIDEO, "Could not destroy drawing context.");
|
||||
if (!eglDestroySurface(GLWin.egl_dpy, GLWin.egl_surf))
|
||||
if (!eglDestroySurface(egl_dpy, egl_surf))
|
||||
NOTICE_LOG(VIDEO, "Could not destroy window surface.");
|
||||
if (!eglTerminate(GLWin.egl_dpy))
|
||||
if (!eglTerminate(egl_dpy))
|
||||
NOTICE_LOG(VIDEO, "Could not destroy display connection.");
|
||||
GLWin.egl_ctx = nullptr;
|
||||
egl_ctx = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,41 +10,23 @@
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "VideoBackends/OGL/GLInterfaceBase.h"
|
||||
|
||||
|
||||
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, void *window_handle);
|
||||
EGLDisplay EGLGetDisplay(void);
|
||||
EGLNativeWindowType CreateWindow(void);
|
||||
void DestroyWindow(void);
|
||||
void UpdateFPSDisplay(const std::string& text);
|
||||
void ToggleFullscreen(bool fullscreen);
|
||||
void SwapBuffers();
|
||||
};
|
||||
|
||||
class cInterfaceEGL : public cInterfaceBase
|
||||
{
|
||||
private:
|
||||
cPlatform Platform;
|
||||
protected:
|
||||
void DetectMode();
|
||||
EGLSurface egl_surf;
|
||||
EGLContext egl_ctx;
|
||||
EGLDisplay egl_dpy;
|
||||
|
||||
virtual EGLDisplay OpenDisplay() = 0;
|
||||
virtual EGLNativeWindowType InitializePlatform(EGLNativeWindowType host_window, EGLConfig config) = 0;
|
||||
virtual void ShutdownPlatform() = 0;
|
||||
public:
|
||||
friend class cPlatform;
|
||||
void SwapInterval(int Interval);
|
||||
void Swap();
|
||||
void SetMode(u32 mode) { s_opengl_mode = mode; }
|
||||
void UpdateFPSDisplay(const std::string& text);
|
||||
void* GetFuncAddress(const std::string& name);
|
||||
bool Create(void *&window_handle);
|
||||
bool Create(void *window_handle);
|
||||
bool MakeCurrent();
|
||||
void Shutdown();
|
||||
};
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright 2014 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "Core/Host.h"
|
||||
#include "DolphinWX/GLInterface/EGLAndroid.h"
|
||||
|
||||
EGLDisplay cInterfaceEGLAndroid::OpenDisplay()
|
||||
{
|
||||
return eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||
}
|
||||
|
||||
EGLNativeWindowType cInterfaceEGLAndroid::InitializePlatform(EGLNativeWindowType host_window, EGLConfig config)
|
||||
{
|
||||
EGLint format;
|
||||
eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &format);
|
||||
ANativeWindow_setBuffersGeometry(host_window, 0, 0, format);
|
||||
|
||||
int none, width, height;
|
||||
Host_GetRenderWindowSize(none, none, width, height);
|
||||
GLInterface->SetBackBufferDimensions(width, height);
|
||||
|
||||
return host_window;
|
||||
}
|
||||
|
||||
void cInterfaceEGLAndroid::ShutdownPlatform()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright 2014 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DolphinWX/GLInterface/EGL.h"
|
||||
|
||||
class cInterfaceEGLAndroid : public cInterfaceEGL
|
||||
{
|
||||
protected:
|
||||
EGLDisplay OpenDisplay() override;
|
||||
EGLNativeWindowType InitializePlatform(EGLNativeWindowType host_window, EGLConfig config) override;
|
||||
void ShutdownPlatform() override;
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
// Copyright 2014 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "DolphinWX/GLInterface/EGLX11.h"
|
||||
|
||||
EGLDisplay cInterfaceEGLX11::OpenDisplay()
|
||||
{
|
||||
dpy = XOpenDisplay(nullptr);
|
||||
XWindow.Initialize(dpy);
|
||||
return eglGetDisplay(dpy);
|
||||
}
|
||||
|
||||
EGLNativeWindowType cInterfaceEGLX11::InitializePlatform(EGLNativeWindowType host_window, EGLConfig config)
|
||||
{
|
||||
EGLint vid;
|
||||
eglGetConfigAttrib(egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid);
|
||||
|
||||
XVisualInfo visTemplate;
|
||||
visTemplate.visualid = vid;
|
||||
|
||||
XVisualInfo *vi;
|
||||
int nVisuals;
|
||||
vi = XGetVisualInfo(dpy, VisualIDMask, &visTemplate, &nVisuals);
|
||||
|
||||
return (EGLNativeWindowType) XWindow.CreateXWindow((Window) host_window, vi);
|
||||
}
|
||||
|
||||
void cInterfaceEGLX11::ShutdownPlatform()
|
||||
{
|
||||
XWindow.DestroyXWindow();
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
// Copyright 2014 Dolphin Emulator Project
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#include "DolphinWX/GLInterface/EGL.h"
|
||||
#include "DolphinWX/GLInterface/X11_Util.h"
|
||||
|
||||
class cInterfaceEGLX11 : public cInterfaceEGL
|
||||
{
|
||||
private:
|
||||
cX11Window XWindow;
|
||||
Display *dpy;
|
||||
protected:
|
||||
EGLDisplay OpenDisplay() override;
|
||||
EGLNativeWindowType InitializePlatform(EGLNativeWindowType host_window, EGLConfig config) override;
|
||||
void ShutdownPlatform() override;
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user