summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoBackends/OGL/main.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/main.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/Source/Core/VideoBackends/OGL/main.cpp b/Source/Core/VideoBackends/OGL/main.cpp
index 56cd60fc47..2c38986aa9 100644
--- a/Source/Core/VideoBackends/OGL/main.cpp
+++ b/Source/Core/VideoBackends/OGL/main.cpp
@@ -66,7 +66,7 @@ std::string VideoBackend::GetName() const
std::string VideoBackend::GetDisplayName() const
{
- if (g_main_gl_context && g_main_gl_context->GetMode() == GLContext::Mode::OpenGLES)
+ if (g_renderer && static_cast<Renderer*>(g_renderer.get())->IsGLES())
return _trans("OpenGL ES");
else
return _trans("OpenGL");
@@ -108,10 +108,10 @@ void VideoBackend::InitBackendInfo()
g_Config.backend_info.AAModes = {1, 2, 4, 8};
}
-bool VideoBackend::InitializeGLExtensions()
+bool VideoBackend::InitializeGLExtensions(GLContext* context)
{
// Init extension support.
- if (!GLExtensions::Init())
+ if (!GLExtensions::Init(context))
{
// OpenGL 2.0 is required for all shader based drawings. There is no way to get this by
// extensions
@@ -161,15 +161,16 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
{
InitializeShared();
- g_main_gl_context = GLContext::Create(wsi, g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer);
- if (!g_main_gl_context)
+ std::unique_ptr<GLContext> main_gl_context =
+ GLContext::Create(wsi, g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer);
+ if (!main_gl_context)
return false;
- g_main_gl_context->MakeCurrent();
- if (!InitializeGLExtensions() || !FillBackendInfo())
+ main_gl_context->MakeCurrent();
+ if (!InitializeGLExtensions(main_gl_context.get()) || !FillBackendInfo())
return false;
- g_renderer = std::make_unique<Renderer>();
+ g_renderer = std::make_unique<Renderer>(std::move(main_gl_context));
g_vertex_manager = std::make_unique<VertexManager>();
g_perf_query = GetPerfQuery();
ProgramShaderCache::Init();
@@ -195,9 +196,6 @@ void VideoBackend::Shutdown()
g_perf_query.reset();
g_vertex_manager.reset();
g_renderer.reset();
- g_main_gl_context->ClearCurrent();
- g_main_gl_context->Shutdown();
- g_main_gl_context.reset();
ShutdownShared();
}
} // namespace OGL