Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenGL: Fix some confusion between gpu->BeginHostFrame and gpu->BeginFrame #18520

Merged
merged 1 commit into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Core/HLE/sceDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,8 @@ void __DisplayFlip(int cyclesLate) {
}

void hleAfterFlip(u64 userdata, int cyclesLate) {
gpu->BeginFrame(); // doesn't really matter if begin or end of frame.
gpu->PSPFrame();

PPGeNotifyFrame();

// This seems like as good a time as any to check if the config changed.
Expand Down
4 changes: 2 additions & 2 deletions GPU/D3D11/GPU_D3D11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ void GPU_D3D11::DeviceRestore(Draw::DrawContext *draw) {
// Nothing needed.
}

void GPU_D3D11::BeginFrame() {
GPUCommonHW::BeginFrame();
void GPU_D3D11::BeginHostFrame() {
GPUCommonHW::BeginHostFrame();

textureCache_->StartFrame();
drawEngine_.BeginFrame();
Expand Down
2 changes: 1 addition & 1 deletion GPU/D3D11/GPU_D3D11.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class GPU_D3D11 : public GPUCommonHW {
void FinishDeferred() override;

private:
void BeginFrame() override;
void BeginHostFrame() override;

ID3D11Device *device_;
ID3D11DeviceContext *context_;
Expand Down
5 changes: 3 additions & 2 deletions GPU/Directx9/GPU_DX9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,12 @@ void GPU_DX9::ReapplyGfxState() {
GPUCommonHW::ReapplyGfxState();
}

void GPU_DX9::BeginFrame() {
void GPU_DX9::BeginHostFrame() {
GPUCommonHW::BeginHostFrame();

textureCache_->StartFrame();
drawEngine_.BeginFrame();

GPUCommonHW::BeginFrame();
shaderManagerDX9_->DirtyLastShader();

framebufferManager_->BeginFrame();
Expand Down
2 changes: 1 addition & 1 deletion GPU/Directx9/GPU_DX9.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class GPU_DX9 : public GPUCommonHW {
void FinishDeferred() override;

private:
void BeginFrame() override;
void BeginHostFrame() override;

LPDIRECT3DDEVICE9 device_;
LPDIRECT3DDEVICE9EX deviceEx_;
Expand Down
29 changes: 12 additions & 17 deletions GPU/GLES/GPU_GLES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,23 +245,6 @@ void GPU_GLES::BeginHostFrame() {
GPUCommonHW::BeginHostFrame();
drawEngine_.BeginFrame();

if (gstate_c.useFlagsChanged) {
// TODO: It'd be better to recompile them in the background, probably?
// This most likely means that saw equal depth changed.
WARN_LOG(G3D, "Shader use flags changed, clearing all shaders and depth buffers");
shaderManager_->ClearShaders();
framebufferManager_->ClearAllDepthBuffers();
gstate_c.useFlagsChanged = false;
}
}

void GPU_GLES::EndHostFrame() {
drawEngine_.EndFrame();
}

void GPU_GLES::BeginFrame() {
GPUCommonHW::BeginFrame();

textureCache_->StartFrame();

// Save the cache from time to time. TODO: How often? We save on exit, so shouldn't need to do this all that often.
Expand All @@ -276,6 +259,18 @@ void GPU_GLES::BeginFrame() {
framebufferManager_->BeginFrame();

fragmentTestCache_.Decimate();
if (gstate_c.useFlagsChanged) {
// TODO: It'd be better to recompile them in the background, probably?
// This most likely means that saw equal depth changed.
WARN_LOG(G3D, "Shader use flags changed, clearing all shaders and depth buffers");
shaderManager_->ClearShaders();
framebufferManager_->ClearAllDepthBuffers();
gstate_c.useFlagsChanged = false;
}
}

void GPU_GLES::EndHostFrame() {
drawEngine_.EndFrame();
}

void GPU_GLES::FinishDeferred() {
Expand Down
2 changes: 0 additions & 2 deletions GPU/GLES/GPU_GLES.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ class GPU_GLES : public GPUCommonHW {
private:
void BuildReportingInfo() override;

void BeginFrame() override;

FramebufferManagerGLES *framebufferManagerGL_;
TextureCacheGLES *textureCacheGL_;
DrawEngineGLES drawEngine_;
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ bool GPUCommon::InterpretList(DisplayList &list) {
return gpuState == GPUSTATE_DONE || gpuState == GPUSTATE_ERROR;
}

void GPUCommon::BeginFrame() {
void GPUCommon::PSPFrame() {
immCount_ = 0;
if (dumpNextFrame_) {
NOTICE_LOG(G3D, "DUMPING THIS FRAME");
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class GPUCommon : public GPUInterface, public GPUDebugInterface {
}
}

void BeginFrame() override;
void PSPFrame() override;

virtual void CheckDepthUsage(VirtualFramebuffer *vfb) {}
virtual void FastRunLoop(DisplayList &list) = 0;
Expand Down
4 changes: 2 additions & 2 deletions GPU/GPUCommonHW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ void GPUCommonHW::UpdateCmdInfo() {
}
}

void GPUCommonHW::BeginFrame() {
GPUCommon::BeginFrame();
void GPUCommonHW::BeginHostFrame() {
GPUCommon::BeginHostFrame();
if (drawEngineCommon_->EverUsedExactEqualDepth() && !sawExactEqualDepth_) {
sawExactEqualDepth_ = true;
gstate_c.SetUseFlags(CheckGPUFeatures());
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUCommonHW.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GPUCommonHW : public GPUCommon {
void DeviceLost() override;
void DeviceRestore(Draw::DrawContext *draw) override;

void BeginFrame() override;
void BeginHostFrame() override;

u32 CheckGPUFeatures() const override;

Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class GPUInterface {

// Framebuffer management
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) = 0;
virtual void BeginFrame() = 0; // Can be a good place to draw the "memory" framebuffer for accelerated plugins
virtual void PSPFrame() = 0;
virtual void CopyDisplayToOutput(bool reallyDirty) = 0;

// Tells the GPU to update the gpuStats structure.
Expand Down