Files
ppsspp/Common/GPU/OpenGL/OpenGLGraphicsContext.cpp
T
Henrik RydgårdandClaude Opus 5.5 34da53de5a Android GL: Support PresentMode::IMMEDIATE with eglSwapInterval
Now that EGL is ours rather than GLSurfaceView's, the swap interval can be set,
so turning vsync off (and fast-forward without skipping flips) works on Android
GL too. Not in VR, where OpenXR presents, and not with a config whose minimum
swap interval is 1.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-10 15:45:27 +02:00

36 lines
1.3 KiB
C++

#include "OpenGLGraphicsContext.h"
#include "Common/System/Display.h"
#include "Common/GPU/OpenGL/GLFeatures.h"
#include "Common/Log.h"
#include "Core/ConfigValues.h"
#include "Core/System.h"
#include "Core/Config.h"
OpenGLGraphicsContext::OpenGLGraphicsContext() {
SetGPUBackend(GPUBackend::OPENGL);
// NOTE: On some Android devices, OpenGL is not yet available here so calling CheckGLExtension here
// doesn't work.
// OpenGL handles rotated rendering in the driver.
g_display.rotation = DisplayRotation::ROTATE_0;
g_display.rot_matrix.setIdentity();
}
bool OpenGLGraphicsContext::InitSurface(WindowSystem winsys, void *data1, void *data2, std::string *errorMessage) {
CheckGLExtensions();
INFO_LOG(Log::G3D, "OpenGLGraphicsContext::InitSurface");
draw_ = Draw::T3DCreateGLContext(CanChangeSwapInterval()); // Can't fail
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
// TODO: In VR mode, we don't want a lot of inflight frames.
renderManager_->SetInflightFrames(g_Config.iInflightFrames);
const bool result = draw_->CreatePresets();
_dbg_assert_(result);
return true;
}
void OpenGLGraphicsContext::ShutdownSurface() {
INFO_LOG(Log::G3D, "OpenGLGraphicsContext::ShutdownSurface");
renderManager_ = nullptr; // owned by draw_.
delete draw_;
draw_ = nullptr;
}