mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-03 16:02:26 +00:00
pipeline_cache: Allocate pipelines from pools
This commit is contained in:
parent
e88d1bfd0d
commit
3b074f07e6
@ -167,11 +167,10 @@ const GraphicsPipeline* PipelineCache::GetGraphicsPipeline() {
|
||||
}
|
||||
const auto [it, is_new] = graphics_pipelines.try_emplace(graphics_key);
|
||||
if (is_new) {
|
||||
it.value() = std::make_unique<GraphicsPipeline>(
|
||||
instance, scheduler, desc_heap, graphics_key, *pipeline_cache, infos, modules);
|
||||
it.value() = graphics_pipeline_pool.Create(instance, scheduler, desc_heap, graphics_key,
|
||||
*pipeline_cache, infos, modules);
|
||||
}
|
||||
const GraphicsPipeline* pipeline = it->second.get();
|
||||
return pipeline;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
const ComputePipeline* PipelineCache::GetComputePipeline() {
|
||||
@ -180,11 +179,10 @@ const ComputePipeline* PipelineCache::GetComputePipeline() {
|
||||
}
|
||||
const auto [it, is_new] = compute_pipelines.try_emplace(compute_key);
|
||||
if (is_new) {
|
||||
it.value() = std::make_unique<ComputePipeline>(
|
||||
instance, scheduler, desc_heap, *pipeline_cache, compute_key, *infos[0], modules[0]);
|
||||
it.value() = compute_pipeline_pool.Create(instance, scheduler, desc_heap, *pipeline_cache,
|
||||
compute_key, *infos[0], modules[0]);
|
||||
}
|
||||
const ComputePipeline* pipeline = it->second.get();
|
||||
return pipeline;
|
||||
return it->second;
|
||||
}
|
||||
|
||||
bool ShouldSkipShader(u64 shader_hash, const char* shader_type) {
|
||||
@ -218,7 +216,6 @@ bool PipelineCache::RefreshGraphicsKey() {
|
||||
key.depth_stencil.depth_enable.Assign(key.depth_format != vk::Format::eUndefined);
|
||||
}
|
||||
key.stencil = regs.stencil_control;
|
||||
key.stencil.raw &= Liverpool::StencilControl::Mask();
|
||||
|
||||
if (db.stencil_info.format != AmdGpu::Liverpool::DepthBuffer::StencilFormat::Invalid) {
|
||||
key.stencil_format = key.depth_format;
|
||||
|
@ -74,8 +74,10 @@ private:
|
||||
Shader::Pools pools;
|
||||
tsl::robin_map<size_t, Program*> program_cache;
|
||||
Common::ObjectPool<Program> program_pool;
|
||||
tsl::robin_map<size_t, std::unique_ptr<ComputePipeline>> compute_pipelines;
|
||||
tsl::robin_map<GraphicsPipelineKey, std::unique_ptr<GraphicsPipeline>> graphics_pipelines;
|
||||
Common::ObjectPool<GraphicsPipeline> graphics_pipeline_pool;
|
||||
Common::ObjectPool<ComputePipeline> compute_pipeline_pool;
|
||||
tsl::robin_map<size_t, ComputePipeline*> compute_pipelines;
|
||||
tsl::robin_map<GraphicsPipelineKey, GraphicsPipeline*> graphics_pipelines;
|
||||
std::array<const Shader::Info*, MaxShaderStages> infos{};
|
||||
std::array<vk::ShaderModule, MaxShaderStages> modules{};
|
||||
GraphicsPipelineKey graphics_key{};
|
||||
|
Loading…
Reference in New Issue
Block a user