Files
ppsspp/Common/GPU/OpenGL/OpenGLGraphicsContext.h
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

52 lines
1.5 KiB
C++

#pragma once
#include "Common/GPU/GraphicsContext.h"
#include "Common/GPU/OpenGL/GLRenderManager.h"
#include "Common/GPU/thin3d_create.h"
// This one is mainly useful for the backends that already initialize GL in platform-specific code.
// It doesn't have the real initialization that we need to do on some platforms.
class OpenGLGraphicsContext : public GraphicsContext {
public:
OpenGLGraphicsContext();
~OpenGLGraphicsContext() override { delete draw_; }
bool NeedsSeparateEmuThread() const override { return true; }
bool InitSurface(WindowSystem winsys, void *data1, void *data2, std::string *error_message) override;
void ShutdownSurface() override;
void Resize() override {}
Draw::DrawContext *GetDrawContext() override {
return draw_;
}
// Called from render thread
void ThreadStart() override {
renderManager_->ThreadStart(draw_);
}
bool ThreadFrame() override {
return renderManager_->ThreadFrame();
}
void ThreadEnd() override {
renderManager_->ThreadEnd();
}
// Call from emu thread
void NotifyEmuThreadExit() override {
renderManager_->SetSkipGLCalls();
renderManager_->NotifyEmuThreadExit();
}
protected:
// Whether the subclass can set the swap interval (SetSwapIntervalFunction), which PresentMode::IMMEDIATE needs.
virtual bool CanChangeSwapInterval() const { return false; }
// Protected rather than private so a subclass that owns the real context (see
// android/jni/AndroidEGLGraphicsContext.h) can hook up a swap function.
Draw::DrawContext *draw_ = nullptr;
GLRenderManager *renderManager_ = nullptr;
};