From e136ad795a9fa769d2508041d3c8fedbcebfa582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 25 Feb 2023 15:07:00 +0100 Subject: [PATCH] Some slight unification --- GPU/D3D11/GPU_D3D11.cpp | 8 -------- GPU/D3D11/GPU_D3D11.h | 2 -- GPU/Directx9/GPU_DX9.cpp | 7 ------- GPU/Directx9/GPU_DX9.h | 2 -- GPU/GPUCommon.cpp | 4 ---- GPU/GPUCommon.h | 4 +++- GPU/GPUCommonHW.cpp | 13 +++++++++++++ GPU/GPUCommonHW.h | 3 +++ GPU/Software/SoftGpu.h | 1 - 9 files changed, 19 insertions(+), 25 deletions(-) diff --git a/GPU/D3D11/GPU_D3D11.cpp b/GPU/D3D11/GPU_D3D11.cpp index e11d1c8156..d20b36edbd 100644 --- a/GPU/D3D11/GPU_D3D11.cpp +++ b/GPU/D3D11/GPU_D3D11.cpp @@ -116,14 +116,6 @@ u32 GPU_D3D11::CheckGPUFeatures() const { return CheckGPUFeaturesLate(features); } -// Needs to be called on GPU thread, not reporting thread. -void GPU_D3D11::BuildReportingInfo() { - using namespace Draw; - - reportingPrimaryInfo_ = draw_->GetInfoString(InfoField::VENDORSTRING); - reportingFullInfo_ = reportingPrimaryInfo_ + " - " + System_GetProperty(SYSPROP_GPUDRIVER_VERSION) + " - " + draw_->GetInfoString(InfoField::SHADELANGVERSION); -} - void GPU_D3D11::DeviceLost() { draw_->Invalidate(InvalidationFlags::CACHED_RENDER_STATE); // Simply drop all caches and textures. diff --git a/GPU/D3D11/GPU_D3D11.h b/GPU/D3D11/GPU_D3D11.h index 42a2ea0c24..3112c1b437 100644 --- a/GPU/D3D11/GPU_D3D11.h +++ b/GPU/D3D11/GPU_D3D11.h @@ -48,8 +48,6 @@ protected: void FinishDeferred() override; private: - void BuildReportingInfo() override; - void InitClear() override; void BeginFrame() override; diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index 8569a6639e..96ea5ae435 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -113,13 +113,6 @@ GPU_DX9::~GPU_DX9() { delete shaderManagerDX9_; } -// Needs to be called on GPU thread, not reporting thread. -void GPU_DX9::BuildReportingInfo() { - using namespace Draw; - reportingPrimaryInfo_ = draw_->GetInfoString(InfoField::VENDORSTRING); - reportingFullInfo_ = reportingPrimaryInfo_ + " - " + System_GetProperty(SYSPROP_GPUDRIVER_VERSION) + " - " + draw_->GetInfoString(InfoField::SHADELANGVERSION); -} - void GPU_DX9::DeviceLost() { // Simply drop all caches and textures. shaderManagerDX9_->ClearCache(false); diff --git a/GPU/Directx9/GPU_DX9.h b/GPU/Directx9/GPU_DX9.h index d89a2bf546..6d1001d90c 100644 --- a/GPU/Directx9/GPU_DX9.h +++ b/GPU/Directx9/GPU_DX9.h @@ -50,8 +50,6 @@ protected: void FinishDeferred() override; private: - void BuildReportingInfo() override; - void InitClear() override; void BeginFrame() override; diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index af0d7d7a3d..6d650e3d26 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -633,10 +633,6 @@ void GPUCommon::NotifyDisplayResized() { displayResized_ = true; } -void GPUCommon::ClearCacheNextFrame() { - textureCache_->ClearNextFrame(); -} - // Called once per frame. Might also get called during the pause screen // if "transparent". void GPUCommon::CheckConfigChanged() { diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index fd17ebc6e3..98905a4f0b 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -272,7 +272,7 @@ protected: void DeviceLost() override; void DeviceRestore() override; - void ClearCacheNextFrame() override; + void ClearCacheNextFrame() override {} virtual void CheckRenderResized(); @@ -332,9 +332,11 @@ protected: DrawEngineCommon *drawEngineCommon_ = nullptr; + // TODO: These should live in GPUCommonHW. FramebufferManagerCommon *framebufferManager_ = nullptr; TextureCacheCommon *textureCache_ = nullptr; ShaderManagerCommon *shaderManager_ = nullptr; + bool flushOnParams_ = true; GraphicsContext *gfxCtx_; diff --git a/GPU/GPUCommonHW.cpp b/GPU/GPUCommonHW.cpp index 27dc1981b7..6c98d9f44c 100644 --- a/GPU/GPUCommonHW.cpp +++ b/GPU/GPUCommonHW.cpp @@ -1,5 +1,6 @@ #include "Common/GPU/thin3d.h" #include "Common/Serialize/Serializer.h" +#include "Common/System/System.h" #include "Core/System.h" @@ -39,3 +40,15 @@ void GPUCommonHW::DoState(PointerWrap &p) { framebufferManager_->DestroyAllFBOs(); } } + +void GPUCommonHW::ClearCacheNextFrame() { + textureCache_->ClearNextFrame(); +} + +// Needs to be called on GPU thread, not reporting thread. +void GPUCommonHW::BuildReportingInfo() { + using namespace Draw; + + reportingPrimaryInfo_ = draw_->GetInfoString(InfoField::VENDORSTRING); + reportingFullInfo_ = reportingPrimaryInfo_ + " - " + System_GetProperty(SYSPROP_GPUDRIVER_VERSION) + " - " + draw_->GetInfoString(InfoField::SHADELANGVERSION); +} diff --git a/GPU/GPUCommonHW.h b/GPU/GPUCommonHW.h index aa0a189564..924a60c5f4 100644 --- a/GPU/GPUCommonHW.h +++ b/GPU/GPUCommonHW.h @@ -14,6 +14,9 @@ public: protected: void PreExecuteOp(u32 op, u32 diff); + void ClearCacheNextFrame() override; + // Needs to be called on GPU thread, not reporting thread. + void BuildReportingInfo() override; }; diff --git a/GPU/Software/SoftGpu.h b/GPU/Software/SoftGpu.h index 2496c7b474..ef61d59663 100644 --- a/GPU/Software/SoftGpu.h +++ b/GPU/Software/SoftGpu.h @@ -145,7 +145,6 @@ public: bool PerformReadbackToMemory(u32 dest, int size) override; bool PerformWriteColorFromMemory(u32 dest, int size) override; bool PerformWriteStencilFromMemory(u32 dest, int size, WriteStencil flags) override; - void ClearCacheNextFrame() override {} void DeviceLost() override; void DeviceRestore() override;