mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Move the EndFrame/Present split one level out, to NativeApp.cpp
This commit is contained in:
parent
e06e919624
commit
1b6d4df3a4
6 changed files with 26 additions and 6 deletions
|
@ -139,6 +139,7 @@ public:
|
|||
|
||||
void BeginFrame() override;
|
||||
void EndFrame() override;
|
||||
void Present() override;
|
||||
|
||||
int GetFrameCount() override { return frameCount_; }
|
||||
|
||||
|
@ -433,6 +434,9 @@ void D3D11DrawContext::HandleEvent(Event ev, int width, int height, void *param1
|
|||
|
||||
void D3D11DrawContext::EndFrame() {
|
||||
curPipeline_ = nullptr;
|
||||
}
|
||||
|
||||
void D3D11DrawContext::Present() {
|
||||
frameCount_++;
|
||||
}
|
||||
|
||||
|
|
|
@ -580,6 +580,8 @@ public:
|
|||
}
|
||||
|
||||
void EndFrame() override;
|
||||
void Present() override;
|
||||
|
||||
int GetFrameCount() override { return frameCount_; }
|
||||
|
||||
void UpdateDynamicUniformBuffer(const void *ub, size_t size) override;
|
||||
|
@ -966,6 +968,9 @@ void D3D9Context::BindNativeTexture(int index, void *nativeTexture) {
|
|||
|
||||
void D3D9Context::EndFrame() {
|
||||
curPipeline_ = nullptr;
|
||||
}
|
||||
|
||||
void D3D9Context::Present() {
|
||||
frameCount_++;
|
||||
}
|
||||
|
||||
|
|
|
@ -369,6 +369,7 @@ public:
|
|||
|
||||
void BeginFrame() override;
|
||||
void EndFrame() override;
|
||||
void Present() override;
|
||||
|
||||
int GetFrameCount() override {
|
||||
return frameCount_;
|
||||
|
@ -803,8 +804,10 @@ void OpenGLContext::EndFrame() {
|
|||
FrameData &frameData = frameData_[renderManager_.GetCurFrame()];
|
||||
renderManager_.EndPushBuffer(frameData.push); // upload the data!
|
||||
renderManager_.Finish();
|
||||
|
||||
Invalidate(InvalidationFlags::CACHED_RENDER_STATE);
|
||||
}
|
||||
|
||||
void OpenGLContext::Present() {
|
||||
frameCount_++;
|
||||
}
|
||||
|
||||
|
|
|
@ -481,6 +481,8 @@ public:
|
|||
|
||||
void BeginFrame() override;
|
||||
void EndFrame() override;
|
||||
void Present() override;
|
||||
|
||||
void WipeQueue() override;
|
||||
|
||||
int GetFrameCount() override {
|
||||
|
@ -1115,12 +1117,14 @@ void VKContext::BeginFrame() {
|
|||
}
|
||||
|
||||
void VKContext::EndFrame() {
|
||||
// Do all the work to submit the command buffers etc.
|
||||
renderManager_.Finish();
|
||||
renderManager_.Present();
|
||||
|
||||
// Unbind stuff, to avoid accidentally relying on it across frames (and provide some protection against forgotten unbinds of deleted things).
|
||||
Invalidate(InvalidationFlags::CACHED_RENDER_STATE);
|
||||
}
|
||||
|
||||
void VKContext::Present() {
|
||||
renderManager_.Present();
|
||||
frameCount_++;
|
||||
}
|
||||
|
||||
|
|
|
@ -816,6 +816,8 @@ public:
|
|||
// Frame management (for the purposes of sync and resource management, necessary with modern APIs). Default implementations here.
|
||||
virtual void BeginFrame() {}
|
||||
virtual void EndFrame() = 0;
|
||||
virtual void Present() = 0;
|
||||
|
||||
virtual void WipeQueue() {}
|
||||
|
||||
// This should be avoided as much as possible, in favor of clearing when binding a render target, which is native
|
||||
|
|
|
@ -1136,16 +1136,18 @@ void NativeFrame(GraphicsContext *graphicsContext) {
|
|||
g_screenManager->getDrawContext()->SetDebugFlags(debugFlags);
|
||||
|
||||
g_draw->BeginFrame();
|
||||
|
||||
// All actual rendering happen in here.
|
||||
g_screenManager->render();
|
||||
if (g_screenManager->getUIContext()->Text()) {
|
||||
g_screenManager->getUIContext()->Text()->OncePerFrame();
|
||||
}
|
||||
|
||||
// This triggers present.
|
||||
g_draw->EndFrame();
|
||||
|
||||
// This, between EndFrame and Present, is where we should actually wait to do present time management.
|
||||
// There might not be a meaningful distinction here for all backends..
|
||||
|
||||
g_draw->Present();
|
||||
|
||||
if (resized) {
|
||||
INFO_LOG(G3D, "Resized flag set - recalculating bounds");
|
||||
resized = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue