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);
|
const auto [it, is_new] = graphics_pipelines.try_emplace(graphics_key);
|
||||||
if (is_new) {
|
if (is_new) {
|
||||||
it.value() = std::make_unique<GraphicsPipeline>(
|
it.value() = graphics_pipeline_pool.Create(instance, scheduler, desc_heap, graphics_key,
|
||||||
instance, scheduler, desc_heap, graphics_key, *pipeline_cache, infos, modules);
|
*pipeline_cache, infos, modules);
|
||||||
}
|
}
|
||||||
const GraphicsPipeline* pipeline = it->second.get();
|
return it->second;
|
||||||
return pipeline;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const ComputePipeline* PipelineCache::GetComputePipeline() {
|
const ComputePipeline* PipelineCache::GetComputePipeline() {
|
||||||
@ -180,11 +179,10 @@ const ComputePipeline* PipelineCache::GetComputePipeline() {
|
|||||||
}
|
}
|
||||||
const auto [it, is_new] = compute_pipelines.try_emplace(compute_key);
|
const auto [it, is_new] = compute_pipelines.try_emplace(compute_key);
|
||||||
if (is_new) {
|
if (is_new) {
|
||||||
it.value() = std::make_unique<ComputePipeline>(
|
it.value() = compute_pipeline_pool.Create(instance, scheduler, desc_heap, *pipeline_cache,
|
||||||
instance, scheduler, desc_heap, *pipeline_cache, compute_key, *infos[0], modules[0]);
|
compute_key, *infos[0], modules[0]);
|
||||||
}
|
}
|
||||||
const ComputePipeline* pipeline = it->second.get();
|
return it->second;
|
||||||
return pipeline;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShouldSkipShader(u64 shader_hash, const char* shader_type) {
|
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.depth_stencil.depth_enable.Assign(key.depth_format != vk::Format::eUndefined);
|
||||||
}
|
}
|
||||||
key.stencil = regs.stencil_control;
|
key.stencil = regs.stencil_control;
|
||||||
key.stencil.raw &= Liverpool::StencilControl::Mask();
|
|
||||||
|
|
||||||
if (db.stencil_info.format != AmdGpu::Liverpool::DepthBuffer::StencilFormat::Invalid) {
|
if (db.stencil_info.format != AmdGpu::Liverpool::DepthBuffer::StencilFormat::Invalid) {
|
||||||
key.stencil_format = key.depth_format;
|
key.stencil_format = key.depth_format;
|
||||||
|
@ -74,8 +74,10 @@ private:
|
|||||||
Shader::Pools pools;
|
Shader::Pools pools;
|
||||||
tsl::robin_map<size_t, Program*> program_cache;
|
tsl::robin_map<size_t, Program*> program_cache;
|
||||||
Common::ObjectPool<Program> program_pool;
|
Common::ObjectPool<Program> program_pool;
|
||||||
tsl::robin_map<size_t, std::unique_ptr<ComputePipeline>> compute_pipelines;
|
Common::ObjectPool<GraphicsPipeline> graphics_pipeline_pool;
|
||||||
tsl::robin_map<GraphicsPipelineKey, std::unique_ptr<GraphicsPipeline>> graphics_pipelines;
|
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<const Shader::Info*, MaxShaderStages> infos{};
|
||||||
std::array<vk::ShaderModule, MaxShaderStages> modules{};
|
std::array<vk::ShaderModule, MaxShaderStages> modules{};
|
||||||
GraphicsPipelineKey graphics_key{};
|
GraphicsPipelineKey graphics_key{};
|
||||||
|
Loading…
Reference in New Issue
Block a user