Move GLInterface around to remove VideoBackends dependency on DolphinWX

This commit is contained in:
Pierre Bourdon 2014-08-01 23:21:03 -07:00
parent 7e83a0ea9b
commit 226a9c2392
30 changed files with 71 additions and 45 deletions

View File

@ -42,6 +42,8 @@ void Host_UpdateLogDisplay();
void Host_UpdateMainFrame(); void Host_UpdateMainFrame();
void Host_UpdateStatusBar(const std::string& text, int Filed = 0); void Host_UpdateStatusBar(const std::string& text, int Filed = 0);
void Host_UpdateTitle(const std::string& title); void Host_UpdateTitle(const std::string& title);
void Host_ShowVideoConfig(void* parent, const std::string& backend_name,
const std::string& config_name);
// TODO (neobrain): Remove these from host! // TODO (neobrain): Remove these from host!
void* Host_GetInstance(); void* Host_GetInstance();

View File

@ -123,6 +123,7 @@ else()
endif() endif()
endif() endif()
set(SRCS ${SRCS} GLInterface/GLInterface.cpp)
if(WIN32) if(WIN32)
set(SRCS ${SRCS} stdafx.cpp) set(SRCS ${SRCS} stdafx.cpp)

View File

@ -74,6 +74,7 @@
<ClCompile Include="FrameTools.cpp" /> <ClCompile Include="FrameTools.cpp" />
<ClCompile Include="GameListCtrl.cpp" /> <ClCompile Include="GameListCtrl.cpp" />
<ClCompile Include="GeckoCodeDiag.cpp" /> <ClCompile Include="GeckoCodeDiag.cpp" />
<ClCompile Include="GLInterface\GLInterface.cpp" />
<ClCompile Include="GLInterface\WGL.cpp" /> <ClCompile Include="GLInterface\WGL.cpp" />
<ClCompile Include="HotkeyDlg.cpp" /> <ClCompile Include="HotkeyDlg.cpp" />
<ClCompile Include="InputConfigDiag.cpp" /> <ClCompile Include="InputConfigDiag.cpp" />
@ -125,7 +126,6 @@
<ClInclude Include="Frame.h" /> <ClInclude Include="Frame.h" />
<ClInclude Include="GameListCtrl.h" /> <ClInclude Include="GameListCtrl.h" />
<ClInclude Include="GeckoCodeDiag.h" /> <ClInclude Include="GeckoCodeDiag.h" />
<ClInclude Include="GLInterface\InterfaceBase.h" />
<ClInclude Include="GLInterface\WGL.h" /> <ClInclude Include="GLInterface\WGL.h" />
<ClInclude Include="Globals.h" /> <ClInclude Include="Globals.h" />
<ClInclude Include="HotkeyDlg.h" /> <ClInclude Include="HotkeyDlg.h" />

View File

@ -27,6 +27,7 @@
</Filter> </Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="GLInterface\GLInterface.cpp" />
<ClCompile Include="GLInterface\WGL.cpp" /> <ClCompile Include="GLInterface\WGL.cpp" />
<ClCompile Include="Main.cpp" /> <ClCompile Include="Main.cpp" />
<ClCompile Include="MainNoGUI.cpp" /> <ClCompile Include="MainNoGUI.cpp" />
@ -155,7 +156,6 @@
<ClCompile Include="stdafx.cpp" /> <ClCompile Include="stdafx.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="GLInterface\InterfaceBase.h" />
<ClInclude Include="GLInterface\WGL.h" /> <ClInclude Include="GLInterface\WGL.h" />
<ClInclude Include="Main.h" /> <ClInclude Include="Main.h" />
<ClInclude Include="WXInputBase.h" /> <ClInclude Include="WXInputBase.h" />

View File

@ -8,7 +8,7 @@
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
#endif #endif
#include "DolphinWX/GLInterface/InterfaceBase.h" #include "VideoBackends/OGL/GLInterfaceBase.h"
class cInterfaceAGL : public cInterfaceBase class cInterfaceAGL : public cInterfaceBase
{ {

View File

@ -8,7 +8,7 @@
#include <EGL/egl.h> #include <EGL/egl.h>
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "DolphinWX/GLInterface/InterfaceBase.h" #include "VideoBackends/OGL/GLInterfaceBase.h"
class cPlatform class cPlatform

View File

@ -0,0 +1,23 @@
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#include "DolphinWX/GLInterface/GLInterface.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
GLWindow GLWin;
cInterfaceBase* HostGL_CreateGLInterface()
{
#if defined(USE_EGL) && USE_EGL
return new cInterfaceEGL;
#elif defined(__APPLE__)
return new cInterfaceAGL;
#elif defined(_WIN32)
return new cInterfaceWGL;
#elif defined(HAVE_X11) && HAVE_X11
return new cInterfaceGLX;
#else
return nullptr;
#endif
}

View File

@ -108,5 +108,4 @@ typedef struct {
unsigned int width, height; unsigned int width, height;
} GLWindow; } GLWindow;
extern cInterfaceBase *GLInterface;
extern GLWindow GLWin; extern GLWindow GLWin;

View File

@ -6,8 +6,8 @@
#include <string> #include <string>
#include "DolphinWX/GLInterface/InterfaceBase.h"
#include "DolphinWX/GLInterface/X11_Util.h" #include "DolphinWX/GLInterface/X11_Util.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
class cInterfaceGLX : public cInterfaceBase class cInterfaceGLX : public cInterfaceBase
{ {

View File

@ -5,7 +5,7 @@
#pragma once #pragma once
#include <string> #include <string>
#include "DolphinWX/GLInterface/InterfaceBase.h" #include "VideoBackends/OGL/GLInterfaceBase.h"
class cInterfaceWGL : public cInterfaceBase class cInterfaceWGL : public cInterfaceBase
{ {

View File

@ -46,6 +46,7 @@
#include "DolphinWX/Frame.h" #include "DolphinWX/Frame.h"
#include "DolphinWX/Globals.h" #include "DolphinWX/Globals.h"
#include "DolphinWX/Main.h" #include "DolphinWX/Main.h"
#include "DolphinWX/VideoConfigDiag.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
#include "DolphinWX/Debugger/CodeWindow.h" #include "DolphinWX/Debugger/CodeWindow.h"
#include "DolphinWX/Debugger/JitWindow.h" #include "DolphinWX/Debugger/JitWindow.h"
@ -699,3 +700,11 @@ void Host_ConnectWiimote(int wm_idx, bool connect)
{ {
CFrame::ConnectWiimote(wm_idx, connect); CFrame::ConnectWiimote(wm_idx, connect);
} }
void Host_ShowVideoConfig(void* parent, const std::string& backend_name,
const std::string& config_name)
{
VideoConfigDiag diag((wxWindow*)parent, WxStrToStr(backend_name),
WxStrToStr(config_name));
diag.ShowModal();
}

View File

@ -127,6 +127,8 @@ void Host_SysMessage(const char *fmt, ...)
void Host_SetWiiMoteConnectionState(int _State) {} void Host_SetWiiMoteConnectionState(int _State) {}
void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {}
#define DVD_BANNER_WIDTH 96 #define DVD_BANNER_WIDTH 96
#define DVD_BANNER_HEIGHT 32 #define DVD_BANNER_HEIGHT 32
std::vector<std::string> m_volume_names; std::vector<std::string> m_volume_names;

View File

@ -17,6 +17,7 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/CoreParameter.h" #include "Core/CoreParameter.h"
#include "Core/Host.h"
#include "Core/HW/Wiimote.h" #include "Core/HW/Wiimote.h"
#include "Core/PowerPC/PowerPC.h" #include "Core/PowerPC/PowerPC.h"
@ -135,6 +136,8 @@ void Host_SysMessage(const char *fmt, ...)
void Host_SetWiiMoteConnectionState(int _State) {} void Host_SetWiiMoteConnectionState(int _State) {}
void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {}
#if HAVE_X11 #if HAVE_X11
void X11_MainLoop() void X11_MainLoop()
{ {

View File

@ -31,6 +31,7 @@
#include "DolphinWX/Main.h" #include "DolphinWX/Main.h"
#include "DolphinWX/VideoConfigDiag.h" #include "DolphinWX/VideoConfigDiag.h"
#include "DolphinWX/WxUtils.h" #include "DolphinWX/WxUtils.h"
#include "VideoBackends/OGL/main.h"
#include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoBackendBase.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"

View File

@ -5,10 +5,6 @@
#include "Common/Thread.h" #include "Common/Thread.h"
#include "InputCommon/ControllerInterface/ControllerInterface.h" #include "InputCommon/ControllerInterface/ControllerInterface.h"
#if USE_EGL
#include "DolphinWX/GLInterface/GLInterface.h"
#endif
#ifdef CIFACE_USE_XINPUT #ifdef CIFACE_USE_XINPUT
#include "InputCommon/ControllerInterface/XInput/XInput.h" #include "InputCommon/ControllerInterface/XInput/XInput.h"
#endif #endif
@ -57,16 +53,10 @@ void ControllerInterface::Initialize()
ciface::XInput::Init(m_devices); ciface::XInput::Init(m_devices);
#endif #endif
#ifdef CIFACE_USE_XLIB #ifdef CIFACE_USE_XLIB
#if USE_EGL
if (GLWin.platform == EGL_PLATFORM_X11) {
#endif
ciface::Xlib::Init(m_devices, m_hwnd); ciface::Xlib::Init(m_devices, m_hwnd);
#ifdef CIFACE_USE_X11_XINPUT2 #ifdef CIFACE_USE_X11_XINPUT2
ciface::XInput2::Init(m_devices, m_hwnd); ciface::XInput2::Init(m_devices, m_hwnd);
#endif #endif
#if USE_EGL
}
#endif
#endif #endif
#ifdef CIFACE_USE_OSX #ifdef CIFACE_USE_OSX
ciface::OSX::Init(m_devices, m_hwnd); ciface::OSX::Init(m_devices, m_hwnd);

View File

@ -6,6 +6,7 @@
#include <unordered_map> #include <unordered_map>
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLExtensions/GLExtensions.h" #include "VideoBackends/OGL/GLExtensions/GLExtensions.h"
#if defined(__linux__) || defined(__APPLE__) #if defined(__linux__) || defined(__APPLE__)

View File

@ -4,8 +4,6 @@
#include <string> #include <string>
#include "DolphinWX/GLInterface/GLInterface.h"
#include "VideoBackends/OGL/GLExtensions/ARB_blend_func_extended.h" #include "VideoBackends/OGL/GLExtensions/ARB_blend_func_extended.h"
#include "VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h" #include "VideoBackends/OGL/GLExtensions/ARB_buffer_storage.h"
#include "VideoBackends/OGL/GLExtensions/ARB_debug_output.h" #include "VideoBackends/OGL/GLExtensions/ARB_debug_output.h"

View File

@ -41,3 +41,9 @@ public:
virtual void Update() { } virtual void Update() { }
virtual bool PeekMessages() { return false; } virtual bool PeekMessages() { return false; }
}; };
extern cInterfaceBase *GLInterface;
// This function has to be defined along the Host_ functions from Core/Host.h.
// Current canonical implementation: DolphinWX/GLInterface/GLInterface.cpp.
cInterfaceBase* HostGL_CreateGLInterface();

View File

@ -8,13 +8,13 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLUtil.h" #include "VideoBackends/OGL/GLUtil.h"
#include "VideoBackends/OGL/Render.h" #include "VideoBackends/OGL/Render.h"
#include "VideoBackends/OGL/VideoBackend.h" #include "VideoBackends/OGL/VideoBackend.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"
GLWindow GLWin;
cInterfaceBase *GLInterface; cInterfaceBase *GLInterface;
namespace OGL namespace OGL
@ -35,15 +35,7 @@ void VideoBackend::UpdateFPSDisplay(const std::string& text)
} }
void InitInterface() void InitInterface()
{ {
#if defined(USE_EGL) && USE_EGL GLInterface = HostGL_CreateGLInterface();
GLInterface = new cInterfaceEGL;
#elif defined(__APPLE__)
GLInterface = new cInterfaceAGL;
#elif defined(_WIN32)
GLInterface = new cInterfaceWGL;
#elif defined(HAVE_X11) && HAVE_X11
GLInterface = new cInterfaceGLX;
#endif
} }
GLuint OpenGL_CompileProgram(const char* vertexShader, const char* fragmentShader) GLuint OpenGL_CompileProgram(const char* vertexShader, const char* fragmentShader)

View File

@ -5,7 +5,6 @@
#pragma once #pragma once
#include "Common/MathUtil.h" #include "Common/MathUtil.h"
#include "DolphinWX/GLInterface/GLInterface.h"
#include "VideoBackends/OGL/GLExtensions/GLExtensions.h" #include "VideoBackends/OGL/GLExtensions/GLExtensions.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"

View File

@ -2,7 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "DolphinWX/GLInterface/GLInterface.h" #include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLUtil.h" #include "VideoBackends/OGL/GLUtil.h"
#include "VideoBackends/OGL/PerfQuery.h" #include "VideoBackends/OGL/PerfQuery.h"
#include "VideoCommon/RenderBase.h" #include "VideoCommon/RenderBase.h"

View File

@ -20,6 +20,7 @@
#include "Core/Movie.h" #include "Core/Movie.h"
#include "VideoBackends/OGL/FramebufferManager.h" #include "VideoBackends/OGL/FramebufferManager.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLUtil.h" #include "VideoBackends/OGL/GLUtil.h"
#include "VideoBackends/OGL/main.h" #include "VideoBackends/OGL/main.h"
#include "VideoBackends/OGL/PostProcessing.h" #include "VideoBackends/OGL/PostProcessing.h"
@ -1459,7 +1460,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbHeight,const EFBRectangl
if (!bLastFrameDumped) if (!bLastFrameDumped)
{ {
#ifdef _WIN32 #ifdef _WIN32
bAVIDumping = AVIDump::Start((HWND)((cInterfaceWGL*)GLInterface)->m_window_handle, w, h); bAVIDumping = AVIDump::Start(nullptr, w, h);
#else #else
bAVIDumping = AVIDump::Start(w, h); bAVIDumping = AVIDump::Start(w, h);
#endif #endif

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2 // Licensed under GPLv2
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/SamplerCache.h" #include "VideoBackends/OGL/SamplerCache.h"
#include "VideoCommon/DriverDetails.h" #include "VideoCommon/DriverDetails.h"

View File

@ -19,6 +19,7 @@
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "VideoBackends/OGL/FramebufferManager.h" #include "VideoBackends/OGL/FramebufferManager.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/ProgramShaderCache.h" #include "VideoBackends/OGL/ProgramShaderCache.h"
#include "VideoBackends/OGL/Render.h" #include "VideoBackends/OGL/Render.h"
#include "VideoBackends/OGL/TextureCache.h" #include "VideoBackends/OGL/TextureCache.h"

View File

@ -49,6 +49,7 @@ Make AA apply instantly during gameplay if possible
#include "Core/Host.h" #include "Core/Host.h"
#include "VideoBackends/OGL/FramebufferManager.h" #include "VideoBackends/OGL/FramebufferManager.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLUtil.h" #include "VideoBackends/OGL/GLUtil.h"
#include "VideoBackends/OGL/PerfQuery.h" #include "VideoBackends/OGL/PerfQuery.h"
#include "VideoBackends/OGL/PostProcessing.h" #include "VideoBackends/OGL/PostProcessing.h"
@ -82,11 +83,6 @@ Make AA apply instantly during gameplay if possible
#include "Common/IniFile.h" #include "Common/IniFile.h"
#endif #endif
#if defined(HAVE_WX) && HAVE_WX
#include "DolphinWX/VideoConfigDiag.h"
#include "DolphinWX/Debugger/DebuggerPanel.h"
#endif // HAVE_WX
namespace OGL namespace OGL
{ {
@ -160,11 +156,8 @@ static void InitBackendInfo()
void VideoBackend::ShowConfig(void *_hParent) void VideoBackend::ShowConfig(void *_hParent)
{ {
#if defined(HAVE_WX) && HAVE_WX
InitBackendInfo(); InitBackendInfo();
VideoConfigDiag diag((wxWindow*)_hParent, "OpenGL", "gfx_opengl"); Host_ShowVideoConfig(_hParent, "OpenGL", "gfx_opengl");
diag.ShowModal();
#endif
} }
bool VideoBackend::Initialize(void *&window_handle) bool VideoBackend::Initialize(void *&window_handle)

View File

@ -4,4 +4,6 @@
#pragma once #pragma once
#include <string>
#include "VideoCommon/MainBase.h" #include "VideoCommon/MainBase.h"

View File

@ -4,6 +4,7 @@
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/Software/BPMemLoader.h" #include "VideoBackends/Software/BPMemLoader.h"
#include "VideoBackends/Software/DebugUtil.h" #include "VideoBackends/Software/DebugUtil.h"
#include "VideoBackends/Software/EfbCopy.h" #include "VideoBackends/Software/EfbCopy.h"

View File

@ -5,6 +5,7 @@
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/MemoryUtil.h" #include "Common/MemoryUtil.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/Software/BPMemLoader.h" #include "VideoBackends/Software/BPMemLoader.h"
#include "VideoBackends/Software/DebugUtil.h" #include "VideoBackends/Software/DebugUtil.h"
#include "VideoBackends/Software/HwRasterizer.h" #include "VideoBackends/Software/HwRasterizer.h"

View File

@ -8,6 +8,7 @@
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLUtil.h" #include "VideoBackends/OGL/GLUtil.h"
#include "VideoBackends/Software/RasterFont.h" #include "VideoBackends/Software/RasterFont.h"
#include "VideoBackends/Software/SWCommandProcessor.h" #include "VideoBackends/Software/SWCommandProcessor.h"

View File

@ -12,9 +12,11 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/Host.h"
#include "Core/HW/Memmap.h" #include "Core/HW/Memmap.h"
#include "Core/HW/VideoInterface.h" #include "Core/HW/VideoInterface.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLExtensions/GLExtensions.h" #include "VideoBackends/OGL/GLExtensions/GLExtensions.h"
#include "VideoBackends/Software/BPMemLoader.h" #include "VideoBackends/Software/BPMemLoader.h"
#include "VideoBackends/Software/Clipper.h" #include "VideoBackends/Software/Clipper.h"
@ -65,10 +67,7 @@ std::string VideoSoftware::GetName() const
void VideoSoftware::ShowConfig(void *_hParent) void VideoSoftware::ShowConfig(void *_hParent)
{ {
#if defined(HAVE_WX) && HAVE_WX Host_ShowVideoConfig(_hParent, "Software", "gfx_software");
VideoConfigDialog diag((wxWindow*)_hParent, "Software", "gfx_software");
diag.ShowModal();
#endif
} }
bool VideoSoftware::Initialize(void *&window_handle) bool VideoSoftware::Initialize(void *&window_handle)