Files
parallel-gx1/Source/Core/DolphinLibretro/VideoContexts/GLContextLR.cpp
T
LibretroAdmin a390228b51 GL: no contexts of the core's own, the frontend's libretro GL context alone
The OpenGL renderer draws on the context the frontend hands over
through libretro GL, and the core makes no context of its own: the
platform context code goes, EGL, EGLX11, EGL for Android, WGL, AGL,
BGL and the GLX window, with the shared contexts made for the shader
compiler's threads, and GLContext::Create makes the libretro context
alone. Programs are compiled on the frontend's context, so the OpenGL
backend reports no background compiling and its shader compiler runs
no threads; the shared-context compiler, its glFinish and VAO rebinds
and the driver bug that switched it off go with it. Android no longer
links libEGL.
2026-11-07 01:36:34 +01:00

64 lines
1.5 KiB
C++

#include "GLContextLR.h"
#include "Common/Logging/Log.h"
#include "Core/Config/MainSettings.h"
#include "VideoCommon/VideoCommon.h"
#include "VideoCommon/Present.h"
#include "DolphinLibretro/Common/Options.h"
#include "DolphinLibretro/VideoContexts/ContextStatus.h"
#include "DolphinLibretro/Video.h"
#include <memory>
GLContextLR::GLContextLR()
{
}
GLContextLR::~GLContextLR() = default;
void* GLContextLR::GetFuncAddress(const std::string& name)
{
return (void*)Libretro::Video::hw_render.get_proc_address(name.c_str());
}
bool GLContextLR::Initialize(const WindowSystemInfo& wsi, bool stereo, bool core)
{
const int efbScale = Libretro::Options::GetCached<int>(Libretro::Options::gfx_settings::EFB_SCALE, 1);
m_backbuffer_width = Libretro::Video::GetAdjustedBaseWidth() * efbScale;
m_backbuffer_height = Libretro::Video::GetAdjustedBaseHeight() * efbScale;
switch (Libretro::Video::hw_render.context_type)
{
case RETRO_HW_CONTEXT_OPENGLES_VERSION:
case RETRO_HW_CONTEXT_OPENGLES3:
m_opengl_mode = Mode::OpenGLES;
break;
case RETRO_HW_CONTEXT_OPENGL_CORE:
case RETRO_HW_CONTEXT_OPENGL:
default:
m_opengl_mode = Mode::OpenGL;
break;
}
if (!g_context_status.IsReady())
{
m_initialized = false;
return false;
}
m_initialized = true;
return true;
}
void GLContextLR::Swap()
{
Libretro::Video::video_cb(RETRO_HW_FRAME_BUFFER_VALID, m_backbuffer_width, m_backbuffer_height,
0);
}
void GLContextLR::Shutdown()
{
m_initialized = false;
}