OpenGL: Fix some confusion between gpu->BeginHostFrame and gpu->BeginFrame, fixing black screen

This commit is contained in:
Henrik Rydgård 2023-12-11 23:05:37 +01:00
parent 65081da7f4
commit 33e48e9675
12 changed files with 27 additions and 32 deletions

View File

@ -690,7 +690,8 @@ void __DisplayFlip(int cyclesLate) {
} }
void hleAfterFlip(u64 userdata, int cyclesLate) { void hleAfterFlip(u64 userdata, int cyclesLate) {
gpu->BeginFrame(); // doesn't really matter if begin or end of frame. gpu->PSPFrame();
PPGeNotifyFrame(); PPGeNotifyFrame();
// This seems like as good a time as any to check if the config changed. // This seems like as good a time as any to check if the config changed.

View File

@ -127,8 +127,8 @@ void GPU_D3D11::DeviceRestore(Draw::DrawContext *draw) {
// Nothing needed. // Nothing needed.
} }
void GPU_D3D11::BeginFrame() { void GPU_D3D11::BeginHostFrame() {
GPUCommonHW::BeginFrame(); GPUCommonHW::BeginHostFrame();
textureCache_->StartFrame(); textureCache_->StartFrame();
drawEngine_.BeginFrame(); drawEngine_.BeginFrame();

View File

@ -44,7 +44,7 @@ protected:
void FinishDeferred() override; void FinishDeferred() override;
private: private:
void BeginFrame() override; void BeginHostFrame() override;
ID3D11Device *device_; ID3D11Device *device_;
ID3D11DeviceContext *context_; ID3D11DeviceContext *context_;

View File

@ -118,11 +118,12 @@ void GPU_DX9::ReapplyGfxState() {
GPUCommonHW::ReapplyGfxState(); GPUCommonHW::ReapplyGfxState();
} }
void GPU_DX9::BeginFrame() { void GPU_DX9::BeginHostFrame() {
GPUCommonHW::BeginHostFrame();
textureCache_->StartFrame(); textureCache_->StartFrame();
drawEngine_.BeginFrame(); drawEngine_.BeginFrame();
GPUCommonHW::BeginFrame();
shaderManagerDX9_->DirtyLastShader(); shaderManagerDX9_->DirtyLastShader();
framebufferManager_->BeginFrame(); framebufferManager_->BeginFrame();

View File

@ -46,7 +46,7 @@ protected:
void FinishDeferred() override; void FinishDeferred() override;
private: private:
void BeginFrame() override; void BeginHostFrame() override;
LPDIRECT3DDEVICE9 device_; LPDIRECT3DDEVICE9 device_;
LPDIRECT3DDEVICE9EX deviceEx_; LPDIRECT3DDEVICE9EX deviceEx_;

View File

@ -245,23 +245,6 @@ void GPU_GLES::BeginHostFrame() {
GPUCommonHW::BeginHostFrame(); GPUCommonHW::BeginHostFrame();
drawEngine_.BeginFrame(); 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(); 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. // Save the cache from time to time. TODO: How often? We save on exit, so shouldn't need to do this all that often.
@ -276,6 +259,18 @@ void GPU_GLES::BeginFrame() {
framebufferManager_->BeginFrame(); framebufferManager_->BeginFrame();
fragmentTestCache_.Decimate(); 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() { void GPU_GLES::FinishDeferred() {

View File

@ -54,8 +54,6 @@ protected:
private: private:
void BuildReportingInfo() override; void BuildReportingInfo() override;
void BeginFrame() override;
FramebufferManagerGLES *framebufferManagerGL_; FramebufferManagerGLES *framebufferManagerGL_;
TextureCacheGLES *textureCacheGL_; TextureCacheGLES *textureCacheGL_;
DrawEngineGLES drawEngine_; DrawEngineGLES drawEngine_;

View File

@ -709,7 +709,7 @@ bool GPUCommon::InterpretList(DisplayList &list) {
return gpuState == GPUSTATE_DONE || gpuState == GPUSTATE_ERROR; return gpuState == GPUSTATE_DONE || gpuState == GPUSTATE_ERROR;
} }
void GPUCommon::BeginFrame() { void GPUCommon::PSPFrame() {
immCount_ = 0; immCount_ = 0;
if (dumpNextFrame_) { if (dumpNextFrame_) {
NOTICE_LOG(G3D, "DUMPING THIS FRAME"); NOTICE_LOG(G3D, "DUMPING THIS FRAME");

View File

@ -248,7 +248,7 @@ protected:
} }
} }
void BeginFrame() override; void PSPFrame() override;
virtual void CheckDepthUsage(VirtualFramebuffer *vfb) {} virtual void CheckDepthUsage(VirtualFramebuffer *vfb) {}
virtual void FastRunLoop(DisplayList &list) = 0; virtual void FastRunLoop(DisplayList &list) = 0;

View File

@ -501,8 +501,8 @@ void GPUCommonHW::UpdateCmdInfo() {
} }
} }
void GPUCommonHW::BeginFrame() { void GPUCommonHW::BeginHostFrame() {
GPUCommon::BeginFrame(); GPUCommon::BeginHostFrame();
if (drawEngineCommon_->EverUsedExactEqualDepth() && !sawExactEqualDepth_) { if (drawEngineCommon_->EverUsedExactEqualDepth() && !sawExactEqualDepth_) {
sawExactEqualDepth_ = true; sawExactEqualDepth_ = true;
gstate_c.SetUseFlags(CheckGPUFeatures()); gstate_c.SetUseFlags(CheckGPUFeatures());

View File

@ -14,7 +14,7 @@ public:
void DeviceLost() override; void DeviceLost() override;
void DeviceRestore(Draw::DrawContext *draw) override; void DeviceRestore(Draw::DrawContext *draw) override;
void BeginFrame() override; void BeginHostFrame() override;
u32 CheckGPUFeatures() const override; u32 CheckGPUFeatures() const override;

View File

@ -214,7 +214,7 @@ public:
// Framebuffer management // Framebuffer management
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) = 0; 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; virtual void CopyDisplayToOutput(bool reallyDirty) = 0;
// Tells the GPU to update the gpuStats structure. // Tells the GPU to update the gpuStats structure.