summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software
diff options
context:
space:
mode:
authorStenzek <stenzek@gmail.com>2018-10-03 23:02:45 +1000
committerStenzek <stenzek@gmail.com>2018-10-20 21:11:34 +1000
commit134d967be2dd4ba9531abb8ba8494c3ac423ca72 (patch)
tree3486a0d8a8f5c1a141bccc1e9cc56306cde327b4 /Source/Core/VideoBackends/Software
parent74b82bab3b6e4e8a1799bbcbdc5244f20f4d2826 (diff)
Refactoring and cleanup of GLInterface (now GLContext)
Diffstat (limited to 'Source/Core/VideoBackends/Software')
-rw-r--r--Source/Core/VideoBackends/Software/SWOGLWindow.cpp31
-rw-r--r--Source/Core/VideoBackends/Software/SWOGLWindow.h2
-rw-r--r--Source/Core/VideoBackends/Software/SWmain.cpp6
3 files changed, 15 insertions, 24 deletions
diff --git a/Source/Core/VideoBackends/Software/SWOGLWindow.cpp b/Source/Core/VideoBackends/Software/SWOGLWindow.cpp
index 695f58cc1d..dd390bc6dc 100644
--- a/Source/Core/VideoBackends/Software/SWOGLWindow.cpp
+++ b/Source/Core/VideoBackends/Software/SWOGLWindow.cpp
@@ -4,7 +4,7 @@
#include <memory>
-#include "Common/GL/GLInterfaceBase.h"
+#include "Common/GL/GLContext.h"
#include "Common/GL/GLUtil.h"
#include "Common/Logging/Log.h"
@@ -15,9 +15,8 @@ std::unique_ptr<SWOGLWindow> SWOGLWindow::s_instance;
void SWOGLWindow::Init(void* window_handle)
{
- GLUtil::InitInterface();
- GLInterface->SetMode(GLInterfaceMode::MODE_DETECT);
- if (!GLInterface->Create(window_handle))
+ g_main_gl_context = GLContext::Create(window_handle);
+ if (!g_main_gl_context)
{
ERROR_LOG(VIDEO, "GLInterface::Create failed.");
}
@@ -27,8 +26,8 @@ void SWOGLWindow::Init(void* window_handle)
void SWOGLWindow::Shutdown()
{
- GLInterface->Shutdown();
- GLInterface.reset();
+ g_main_gl_context->Shutdown();
+ g_main_gl_context.reset();
s_instance.reset();
}
@@ -66,10 +65,9 @@ void SWOGLWindow::Prepare()
" TexCoord = vec2(rawpos.x, -rawpos.y);\n"
"}\n";
- std::string header = GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL ?
- "#version 140\n" :
- "#version 300 es\n"
- "precision highp float;\n";
+ std::string header = g_main_gl_context->IsGLES() ? "#version 300 es\n"
+ "precision highp float;\n" :
+ "#version 140\n";
m_image_program = GLUtil::CompileProgram(header + vertex_shader, header + frag_shader);
@@ -93,10 +91,10 @@ void SWOGLWindow::PrintText(const std::string& text, int x, int y, u32 color)
void SWOGLWindow::ShowImage(AbstractTexture* image, const EFBRectangle& xfb_region)
{
SW::SWTexture* sw_image = static_cast<SW::SWTexture*>(image);
- GLInterface->Update(); // just updates the render window position and the backbuffer size
+ g_main_gl_context->Update(); // just updates the render window position and the backbuffer size
- GLsizei glWidth = (GLsizei)GLInterface->GetBackBufferWidth();
- GLsizei glHeight = (GLsizei)GLInterface->GetBackBufferHeight();
+ GLsizei glWidth = (GLsizei)g_main_gl_context->GetBackBufferWidth();
+ GLsizei glHeight = (GLsizei)g_main_gl_context->GetBackBufferHeight();
glViewport(0, 0, glWidth, glHeight);
@@ -123,10 +121,5 @@ void SWOGLWindow::ShowImage(AbstractTexture* image, const EFBRectangle& xfb_regi
// }
m_text.clear();
- GLInterface->Swap();
-}
-
-int SWOGLWindow::PeekMessages()
-{
- return GLInterface->PeekMessages();
+ g_main_gl_context->Swap();
}
diff --git a/Source/Core/VideoBackends/Software/SWOGLWindow.h b/Source/Core/VideoBackends/Software/SWOGLWindow.h
index 64ee2414bc..eadf3171cb 100644
--- a/Source/Core/VideoBackends/Software/SWOGLWindow.h
+++ b/Source/Core/VideoBackends/Software/SWOGLWindow.h
@@ -26,8 +26,6 @@ public:
// Image to show, will be swapped immediately
void ShowImage(AbstractTexture* image, const EFBRectangle& xfb_region);
- int PeekMessages();
-
static std::unique_ptr<SWOGLWindow> s_instance;
private:
diff --git a/Source/Core/VideoBackends/Software/SWmain.cpp b/Source/Core/VideoBackends/Software/SWmain.cpp
index 6ca183b57c..8781a2da9b 100644
--- a/Source/Core/VideoBackends/Software/SWmain.cpp
+++ b/Source/Core/VideoBackends/Software/SWmain.cpp
@@ -9,7 +9,7 @@
#include "Common/Common.h"
#include "Common/CommonTypes.h"
-#include "Common/GL/GLInterfaceBase.h"
+#include "Common/GL/GLContext.h"
#include "VideoBackends/Software/Clipper.h"
#include "VideoBackends/Software/DebugUtil.h"
@@ -88,7 +88,7 @@ bool VideoSoftware::Initialize(void* window_handle)
Rasterizer::Init();
DebugUtil::Init();
- GLInterface->MakeCurrent();
+ g_main_gl_context->MakeCurrent();
SWOGLWindow::s_instance->Prepare();
g_renderer = std::make_unique<SWRenderer>();
@@ -116,4 +116,4 @@ void VideoSoftware::Shutdown()
g_renderer.reset();
ShutdownShared();
}
-}
+} // namespace SW