mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-14 23:10:33 +02:00
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>
52 lines
1.5 KiB
C++
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;
|
|
};
|
|
|