mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 19:07:01 +02:00
graphics: serialize pipeline cache through its renderer owner
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/profiler.h"
|
#include "common/profiler.h"
|
||||||
|
#include "common/threads.h"
|
||||||
#include "graphics/guest_gpu/hardwareContext.h"
|
#include "graphics/guest_gpu/hardwareContext.h"
|
||||||
#include "graphics/host_gpu/renderer/colorRenderTarget.h"
|
#include "graphics/host_gpu/renderer/colorRenderTarget.h"
|
||||||
#include "graphics/host_gpu/renderer/debug.h"
|
#include "graphics/host_gpu/renderer/debug.h"
|
||||||
@@ -518,7 +519,6 @@ void PipelineCache::InitializeDriverCache() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PipelineCache::Save() {
|
void PipelineCache::Save() {
|
||||||
Common::LockGuard lock(m_mutex);
|
|
||||||
if (m_driver_cache == nullptr) {
|
if (m_driver_cache == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -640,7 +640,6 @@ PipelineCache::GraphicsPrograms PipelineCache::GetGraphicsPrograms(
|
|||||||
static_cast<float>(std::min(limits.maxViewportDimensions[1], 16384u)) * 0.5f;
|
static_cast<float>(std::min(limits.maxViewportDimensions[1], 16384u)) * 0.5f;
|
||||||
clip.enabled = true;
|
clip.enabled = true;
|
||||||
}
|
}
|
||||||
Common::LockGuard lock(m_mutex);
|
|
||||||
uint32_t push_data_cursor =
|
uint32_t push_data_cursor =
|
||||||
mesh_active ? ShaderRecompiler::IR::PushData::MeshDrawDwordCount : 0;
|
mesh_active ? ShaderRecompiler::IR::PushData::MeshDrawDwordCount : 0;
|
||||||
GraphicsPrograms result;
|
GraphicsPrograms result;
|
||||||
@@ -658,7 +657,6 @@ ShaderProgram PipelineCache::GetComputeProgram(const HW::ComputeShaderInfo& regs
|
|||||||
ShaderComputeInputInfo& input_info) {
|
ShaderComputeInputInfo& input_info) {
|
||||||
input_info.host_subgroup_size = m_graphics.SupportsComputeWave64() ? 64u : 32u;
|
input_info.host_subgroup_size = m_graphics.SupportsComputeWave64() ? 64u : 32u;
|
||||||
const auto params = PrepareProgram(regs, sh, input_info);
|
const auto params = PrepareProgram(regs, sh, input_info);
|
||||||
Common::LockGuard lock(m_mutex);
|
|
||||||
uint32_t push_data_cursor = 0;
|
uint32_t push_data_cursor = 0;
|
||||||
return m_program_cache->Get(params, input_info, push_data_cursor);
|
return m_program_cache->Get(params, input_info, push_data_cursor);
|
||||||
}
|
}
|
||||||
@@ -683,7 +681,6 @@ PipelineCache::Pipeline& PipelineCache::GetGraphicsPipeline(
|
|||||||
EXIT_IF(ps_active && !pixel_program);
|
EXIT_IF(ps_active && !pixel_program);
|
||||||
const auto color_count = static_cast<uint32_t>(colors.size());
|
const auto color_count = static_cast<uint32_t>(colors.size());
|
||||||
|
|
||||||
Common::LockGuard lock(m_mutex);
|
|
||||||
auto& ctx = command.GetRegisters();
|
auto& ctx = command.GetRegisters();
|
||||||
|
|
||||||
const HW::ModeControl& mc = ctx.GetModeControl();
|
const HW::ModeControl& mc = ctx.GetModeControl();
|
||||||
@@ -839,8 +836,6 @@ PipelineCache::GetComputePipeline(const ShaderComputeInputInfo& input_info,
|
|||||||
|
|
||||||
EXIT_IF(!compute_program);
|
EXIT_IF(!compute_program);
|
||||||
|
|
||||||
Common::LockGuard lock(m_mutex);
|
|
||||||
|
|
||||||
if (auto iter = m_compute_pipelines.find(compute_program.id);
|
if (auto iter = m_compute_pipelines.find(compute_program.id);
|
||||||
iter != m_compute_pipelines.end()) {
|
iter != m_compute_pipelines.end()) {
|
||||||
return *iter->second;
|
return *iter->second;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
#include "common/abi.h"
|
#include "common/abi.h"
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/common.h"
|
#include "common/common.h"
|
||||||
#include "common/threads.h"
|
|
||||||
#include "graphics/host_gpu/renderer/renderTarget.h"
|
#include "graphics/host_gpu/renderer/renderTarget.h"
|
||||||
#include "graphics/host_gpu/vulkanCommon.h"
|
#include "graphics/host_gpu/vulkanCommon.h"
|
||||||
#include "graphics/shader/shader.h"
|
#include "graphics/shader/shader.h"
|
||||||
@@ -103,6 +102,7 @@ struct ShaderProgram {
|
|||||||
explicit operator bool() const { return id != 0 && module != nullptr; }
|
explicit operator bool() const { return id != 0 && module != nullptr; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// The owning renderer serializes access, including saves while the GPU is running.
|
||||||
class PipelineCache {
|
class PipelineCache {
|
||||||
public:
|
public:
|
||||||
explicit PipelineCache(GraphicContext& graphics);
|
explicit PipelineCache(GraphicContext& graphics);
|
||||||
@@ -179,7 +179,6 @@ private:
|
|||||||
std::unordered_map<GraphicsPipelineKey, std::unique_ptr<Pipeline>, GraphicsPipelineKeyHash>
|
std::unordered_map<GraphicsPipelineKey, std::unique_ptr<Pipeline>, GraphicsPipelineKeyHash>
|
||||||
m_graphics_pipelines;
|
m_graphics_pipelines;
|
||||||
std::unordered_map<uint64_t, std::unique_ptr<Pipeline>> m_compute_pipelines;
|
std::unordered_map<uint64_t, std::unique_ptr<Pipeline>> m_compute_pipelines;
|
||||||
Common::Mutex m_mutex;
|
|
||||||
|
|
||||||
void InitializeDriverCache();
|
void InitializeDriverCache();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -817,6 +817,7 @@ void WindowRun() {
|
|||||||
EXIT_IF(g_window == nullptr);
|
EXIT_IF(g_window == nullptr);
|
||||||
|
|
||||||
g_window->Run();
|
g_window->Run();
|
||||||
|
Common::LockGuard lock(g_window->render_context->GetMutex());
|
||||||
g_window->render_context->GetPipelineCache().Save();
|
g_window->render_context->GetPipelineCache().Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user