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

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

View File

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

View File

@ -0,0 +1,49 @@
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
#pragma once
#include <string>
#include "Common/Common.h"
enum GLInterfaceMode {
MODE_DETECT = 0,
MODE_OPENGL,
MODE_OPENGLES2,
MODE_OPENGLES3,
};
class cInterfaceBase
{
protected:
// Window dimensions.
u32 s_backbuffer_width;
u32 s_backbuffer_height;
u32 s_opengl_mode;
public:
virtual void Swap() {}
virtual void UpdateFPSDisplay(const std::string& text) {}
virtual void SetMode(u32 mode) { s_opengl_mode = GLInterfaceMode::MODE_OPENGL; }
virtual u32 GetMode() { return s_opengl_mode; }
virtual void* GetFuncAddress(const std::string& name) { return nullptr; }
virtual bool Create(void *&window_handle) { return true; }
virtual bool MakeCurrent() { return true; }
virtual bool ClearCurrent() { return true; }
virtual void Shutdown() {}
virtual void SwapInterval(int Interval) { }
virtual u32 GetBackBufferWidth() { return s_backbuffer_width; }
virtual u32 GetBackBufferHeight() { return s_backbuffer_height; }
virtual void SetBackBufferDimensions(u32 W, u32 H) {s_backbuffer_width = W; s_backbuffer_height = H; }
virtual void Update() { }
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/Core.h"
#include "VideoBackends/OGL/GLInterfaceBase.h"
#include "VideoBackends/OGL/GLUtil.h"
#include "VideoBackends/OGL/Render.h"
#include "VideoBackends/OGL/VideoBackend.h"
#include "VideoCommon/VideoConfig.h"
GLWindow GLWin;
cInterfaceBase *GLInterface;
namespace OGL
@ -35,15 +35,7 @@ void VideoBackend::UpdateFPSDisplay(const std::string& text)
}
void InitInterface()
{
#if defined(USE_EGL) && USE_EGL
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
GLInterface = HostGL_CreateGLInterface();
}
GLuint OpenGL_CompileProgram(const char* vertexShader, const char* fragmentShader)

View File

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

View File

@ -2,7 +2,7 @@
// Licensed under GPLv2
// 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/PerfQuery.h"
#include "VideoCommon/RenderBase.h"

View File

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

View File

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

View File

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

View File

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