From 7a8310ae5e0a5dfc31d21157a9707b9979ad0af7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 13 Mar 2018 13:35:44 +0100 Subject: [PATCH] Tiny unification of code. Save the GL shader cache a bit less often. --- GPU/D3D11/GPU_D3D11.h | 8 -------- GPU/Directx9/GPU_DX9.h | 9 --------- GPU/GLES/GPU_GLES.cpp | 3 +-- GPU/GLES/GPU_GLES.h | 11 ++--------- GPU/GPUCommon.h | 8 ++++++++ GPU/Vulkan/GPU_Vulkan.h | 8 -------- 6 files changed, 11 insertions(+), 36 deletions(-) diff --git a/GPU/D3D11/GPU_D3D11.h b/GPU/D3D11/GPU_D3D11.h index e716906f83..acb4dd3e07 100644 --- a/GPU/D3D11/GPU_D3D11.h +++ b/GPU/D3D11/GPU_D3D11.h @@ -51,11 +51,6 @@ public: void ClearShaderCache() override; - void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) override { - primaryInfo = reportingPrimaryInfo_; - fullInfo = reportingFullInfo_; - } - // Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend. std::vector DebugGetShaderIDs(DebugShaderType shader) override; std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override; @@ -89,7 +84,4 @@ private: int lastVsync_; int vertexCost_ = 0; - - std::string reportingPrimaryInfo_; - std::string reportingFullInfo_; }; diff --git a/GPU/Directx9/GPU_DX9.h b/GPU/Directx9/GPU_DX9.h index d72e2c4321..3fb4be032d 100644 --- a/GPU/Directx9/GPU_DX9.h +++ b/GPU/Directx9/GPU_DX9.h @@ -52,11 +52,6 @@ public: void ClearShaderCache() override; - void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) override { - primaryInfo = reportingPrimaryInfo_; - fullInfo = reportingFullInfo_; - } - // Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend. std::vector DebugGetShaderIDs(DebugShaderType shader) override; std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override; @@ -70,7 +65,6 @@ private: void Flush() { drawEngine_.Flush(); } - // void ApplyDrawState(int prim); void CheckFlushOp(int cmd, u32 diff); void BuildReportingInfo(); @@ -89,9 +83,6 @@ private: int lastVsync_; int vertexCost_ = 0; - - std::string reportingPrimaryInfo_; - std::string reportingFullInfo_; }; } // namespace DX9 diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 5b2e6445ac..41d03a3304 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -301,7 +301,6 @@ bool GPU_GLES::IsReady() { return shaderManagerGL_->ContinuePrecompile(); } -// Needs to be called on GPU thread, not reporting thread. void GPU_GLES::BuildReportingInfo() { GLRenderManager *render = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); @@ -421,7 +420,7 @@ void GPU_GLES::BeginFrame() { GPUCommon::BeginFrame(); // Save the cache from time to time. TODO: How often? - if (!shaderCachePath_.empty() && (gpuStats.numFlips & 1023) == 0) { + if (!shaderCachePath_.empty() && (gpuStats.numFlips & 4095) == 0) { shaderManagerGL_->Save(shaderCachePath_); } diff --git a/GPU/GLES/GPU_GLES.h b/GPU/GLES/GPU_GLES.h index 4ea7a62064..6789491090 100644 --- a/GPU/GLES/GPU_GLES.h +++ b/GPU/GLES/GPU_GLES.h @@ -56,11 +56,6 @@ public: void ClearShaderCache() override; void CleanupBeforeUI() override; - void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) override { - primaryInfo = reportingPrimaryInfo_; - fullInfo = reportingFullInfo_; - } - // Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend. std::vector DebugGetShaderIDs(DebugShaderType shader) override; std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override; @@ -92,12 +87,10 @@ private: FragmentTestCacheGLES fragmentTestCache_; ShaderManagerGLES *shaderManagerGL_; + std::string shaderCachePath_; + #ifdef _WIN32 int lastVsync_; #endif int vertexCost_ = 0; - - std::string reportingPrimaryInfo_; - std::string reportingFullInfo_; - std::string shaderCachePath_; }; diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index 52bcec023f..afd0add47b 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -247,6 +247,11 @@ public: typedef void (GPUCommon::*CmdFunc)(u32 op, u32 diff); + void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) override { + primaryInfo = reportingPrimaryInfo_; + fullInfo = reportingFullInfo_; + } + protected: void SetDrawType(DrawType type, GEPrimitiveType prim) { if (type != lastDraw_) { @@ -341,6 +346,9 @@ protected: int immCount_ = 0; GEPrimitiveType immPrim_; + std::string reportingPrimaryInfo_; + std::string reportingFullInfo_; + private: void FlushImm(); // Debug stats. diff --git a/GPU/Vulkan/GPU_Vulkan.h b/GPU/Vulkan/GPU_Vulkan.h index 266fe01485..4357f854db 100644 --- a/GPU/Vulkan/GPU_Vulkan.h +++ b/GPU/Vulkan/GPU_Vulkan.h @@ -55,11 +55,6 @@ public: void ClearShaderCache() override; - void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) override { - primaryInfo = reportingPrimaryInfo_; - fullInfo = reportingFullInfo_; - } - // Using string because it's generic - makes no assumptions on the size of the shader IDs of this backend. std::vector DebugGetShaderIDs(DebugShaderType shader) override; std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override; @@ -97,9 +92,6 @@ private: // Manages state and pipeline objects PipelineManagerVulkan *pipelineManager_; - std::string reportingPrimaryInfo_; - std::string reportingFullInfo_; - // Simple 2D drawing engine. Vulkan2D vulkan2D_;