Skip to content

Commit

Permalink
Remove "SwapBuffers" from the GraphicsContext interface.
Browse files Browse the repository at this point in the history
Buildfixes

More buildfix

headless buildfix

One more buildfix
  • Loading branch information
hrydgard committed Aug 10, 2023
1 parent ed9b033 commit 1ea11c2
Show file tree
Hide file tree
Showing 20 changed files with 5 additions and 33 deletions.
2 changes: 0 additions & 2 deletions Common/GraphicsContext.h
Expand Up @@ -16,8 +16,6 @@ class GraphicsContext {
virtual void Shutdown() = 0;
virtual void SwapInterval(int interval) = 0;

virtual void SwapBuffers() = 0;

// Used during window resize. Must be called from the window thread,
// not the rendering thread or CPU thread.
virtual void Pause() {}
Expand Down
4 changes: 0 additions & 4 deletions Core/Core.cpp
Expand Up @@ -227,10 +227,6 @@ void Core_RunLoop(GraphicsContext *ctx) {
if (sleepTime > 0)
sleep_ms(sleepTime);
}

if ((!windowHidden && !Core_IsStepping()) || menuThrottle) {
ctx->SwapBuffers();
}
}

void Core_DoSingleStep() {
Expand Down
1 change: 0 additions & 1 deletion Qt/QtMain.h
Expand Up @@ -70,7 +70,6 @@ class QtGLGraphicsContext : public GraphicsContext {
// See TODO in constructor.
// renderManager_->SwapInterval(interval);
}
void SwapBuffers() override {}
void Resize() override {}

Draw::DrawContext *GetDrawContext() override {
Expand Down
4 changes: 0 additions & 4 deletions SDL/SDLGLGraphicsContext.h
Expand Up @@ -19,10 +19,6 @@ class SDLGLGraphicsContext : public GraphicsContext {
void Shutdown() override;
void ShutdownFromRenderThread() override;

void SwapBuffers() override {
// Do nothing, the render thread takes care of this.
}

// Gets forwarded to the render thread.
void SwapInterval(int interval) override;

Expand Down
2 changes: 0 additions & 2 deletions SDL/SDLMain.cpp
Expand Up @@ -1452,8 +1452,6 @@ int main(int argc, char *argv[]) {
break;
}

graphicsContext->SwapBuffers();

{
std::lock_guard<std::mutex> guard(g_mutexWindow);
if (g_windowState.update) {
Expand Down
4 changes: 0 additions & 4 deletions SDL/SDLVulkanGraphicsContext.h
Expand Up @@ -26,10 +26,6 @@ class SDLVulkanGraphicsContext : public GraphicsContext {

void Shutdown() override;

void SwapBuffers() override {
// We don't do it this way.
}

void Resize() override;

void Poll() override;
Expand Down
1 change: 0 additions & 1 deletion UWP/PPSSPP_UWPMain.h
Expand Up @@ -20,7 +20,6 @@ class UWPGraphicsContext : public GraphicsContext {

void Shutdown() override;
void SwapInterval(int interval) override {}
void SwapBuffers() override {}
void Resize() override {}
Draw::DrawContext * GetDrawContext() override {
return draw_;
Expand Down
1 change: 0 additions & 1 deletion Windows/GPU/D3D11Context.h
Expand Up @@ -31,7 +31,6 @@ class D3D11Context : public WindowsGraphicsContext {
bool Init(HINSTANCE hInst, HWND window, std::string *error_message) override;
void Shutdown() override;
void SwapInterval(int interval) override;
void SwapBuffers() override {}

void Resize() override;

Expand Down
1 change: 0 additions & 1 deletion Windows/GPU/D3D9Context.h
Expand Up @@ -35,7 +35,6 @@ class D3D9Context : public WindowsGraphicsContext {
bool Init(HINSTANCE hInst, HWND window, std::string *error_message) override;
void Shutdown() override;
void SwapInterval(int interval) override;
void SwapBuffers() override {}

void Resize() override;

Expand Down
2 changes: 1 addition & 1 deletion Windows/GPU/WindowsGLContext.cpp
Expand Up @@ -39,7 +39,7 @@
// Currently, just compile time for debugging. May be NVIDIA only.
static const int simulateGLES = false;

void WindowsGLContext::SwapBuffers() {
void WindowsGLContext::Poll() {
// We no longer call RenderManager::Swap here, it's handled by the render thread, which
// we're not on here.

Expand Down
3 changes: 2 additions & 1 deletion Windows/GPU/WindowsGLContext.h
Expand Up @@ -18,7 +18,8 @@ class WindowsGLContext : public WindowsGraphicsContext {

void Shutdown() override;
void SwapInterval(int interval) override;
void SwapBuffers() override;

void Poll() override;

// Used during window resize. Must be called from the window thread,
// not the rendering thread or CPU thread.
Expand Down
1 change: 0 additions & 1 deletion Windows/GPU/WindowsGraphicsContext.h
Expand Up @@ -7,4 +7,3 @@ class WindowsGraphicsContext : public GraphicsContext {
public:
virtual bool Init(HINSTANCE hInst, HWND window, std::string *error_message) = 0;
};

1 change: 0 additions & 1 deletion Windows/GPU/WindowsVulkanContext.h
Expand Up @@ -30,7 +30,6 @@ class WindowsVulkanContext : public WindowsGraphicsContext {
bool Init(HINSTANCE hInst, HWND window, std::string *error_message) override;
void Shutdown() override;
void SwapInterval(int interval) override {}
void SwapBuffers() override {}
void Resize() override;
void Poll() override;

Expand Down
1 change: 0 additions & 1 deletion android/jni/AndroidJavaGLContext.h
Expand Up @@ -15,7 +15,6 @@ class AndroidJavaEGLGraphicsContext : public AndroidGraphicsContext {
void ShutdownFromRenderThread() override;

void Shutdown() override {}
void SwapBuffers() override {}
void SwapInterval(int interval) override {}
void Resize() override {}

Expand Down
1 change: 0 additions & 1 deletion android/jni/AndroidVulkanContext.h
Expand Up @@ -16,7 +16,6 @@ class AndroidVulkanContext : public AndroidGraphicsContext {

void Shutdown() override;
void SwapInterval(int interval) override;
void SwapBuffers() override {}
void Resize() override;

void *GetAPIContext() override { return g_Vulkan; }
Expand Down
3 changes: 0 additions & 3 deletions headless/SDLHeadlessHost.cpp
Expand Up @@ -96,7 +96,6 @@ class GLDummyGraphicsContext : public GraphicsContext {
void Shutdown() override {}
void Resize() override {}
void SwapInterval(int interval) override {}
void SwapBuffers() override {}

private:
Draw::DrawContext *draw_ = nullptr;
Expand Down Expand Up @@ -193,7 +192,6 @@ bool SDLHeadlessHost::InitGraphics(std::string *error_message, GraphicsContext *
if (!gfx_->ThreadFrame()) {
break;
}
gfx_->SwapBuffers();
}

threadState_ = RenderThreadState::STOPPING;
Expand Down Expand Up @@ -221,7 +219,6 @@ void SDLHeadlessHost::ShutdownGraphics() {
}

void SDLHeadlessHost::SwapBuffers() {
gfx_->SwapBuffers();
}

#endif
2 changes: 0 additions & 2 deletions headless/WindowsHeadlessHost.cpp
Expand Up @@ -132,7 +132,6 @@ bool WindowsHeadlessHost::InitGraphics(std::string *error_message, GraphicsConte
if (!gfx_->ThreadFrame()) {
break;
}
gfx_->SwapBuffers();
}

threadState_ = RenderThreadState::STOPPING;
Expand Down Expand Up @@ -173,5 +172,4 @@ void WindowsHeadlessHost::SwapBuffers() {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
gfx_->SwapBuffers();
}
1 change: 0 additions & 1 deletion ios/ViewController.mm
Expand Up @@ -64,7 +64,6 @@
}

void SwapInterval(int interval) override {}
void SwapBuffers() override {}
void Resize() override {}
void Shutdown() override {}

Expand Down
1 change: 1 addition & 0 deletions libretro/LibretroGraphicsContext.h
Expand Up @@ -22,6 +22,7 @@ class LibretroGraphicsContext : public GraphicsContext {
DestroyDrawContext();
}
void SwapInterval(int interval) override {}
virtual void SwapBuffers() = 0;
void Resize() override {}

virtual void GotBackbuffer();
Expand Down
2 changes: 1 addition & 1 deletion libretro/libretro.cpp
Expand Up @@ -1174,7 +1174,7 @@ namespace Libretro

if (ctx->GetDrawContext()) {
ctx->GetDrawContext()->EndFrame();
ctx->GetDrawContext()->Present();
ctx->GetDrawContext()->Present(1);
}
}

Expand Down

0 comments on commit 1ea11c2

Please sign in to comment.