mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-15 11:25:13 +00:00
renderer_vulkan: Add debug names to pipelines. (#2069)
This commit is contained in:
parent
8879380427
commit
7cdeb51670
|
@ -18,6 +18,7 @@ ComputePipeline::ComputePipeline(const Instance& instance_, Scheduler& scheduler
|
||||||
: Pipeline{instance_, scheduler_, desc_heap_, pipeline_cache, true}, compute_key{compute_key_} {
|
: Pipeline{instance_, scheduler_, desc_heap_, pipeline_cache, true}, compute_key{compute_key_} {
|
||||||
auto& info = stages[int(Shader::LogicalStage::Compute)];
|
auto& info = stages[int(Shader::LogicalStage::Compute)];
|
||||||
info = &info_;
|
info = &info_;
|
||||||
|
const auto debug_str = GetDebugString();
|
||||||
|
|
||||||
const vk::PipelineShaderStageCreateInfo shader_ci = {
|
const vk::PipelineShaderStageCreateInfo shader_ci = {
|
||||||
.stage = vk::ShaderStageFlagBits::eCompute,
|
.stage = vk::ShaderStageFlagBits::eCompute,
|
||||||
|
@ -89,8 +90,9 @@ ComputePipeline::ComputePipeline(const Instance& instance_, Scheduler& scheduler
|
||||||
.bindingCount = static_cast<u32>(bindings.size()),
|
.bindingCount = static_cast<u32>(bindings.size()),
|
||||||
.pBindings = bindings.data(),
|
.pBindings = bindings.data(),
|
||||||
};
|
};
|
||||||
|
const auto device = instance.GetDevice();
|
||||||
auto [descriptor_set_result, descriptor_set] =
|
auto [descriptor_set_result, descriptor_set] =
|
||||||
instance.GetDevice().createDescriptorSetLayoutUnique(desc_layout_ci);
|
device.createDescriptorSetLayoutUnique(desc_layout_ci);
|
||||||
ASSERT_MSG(descriptor_set_result == vk::Result::eSuccess,
|
ASSERT_MSG(descriptor_set_result == vk::Result::eSuccess,
|
||||||
"Failed to create compute descriptor set layout: {}",
|
"Failed to create compute descriptor set layout: {}",
|
||||||
vk::to_string(descriptor_set_result));
|
vk::to_string(descriptor_set_result));
|
||||||
|
@ -107,6 +109,7 @@ ComputePipeline::ComputePipeline(const Instance& instance_, Scheduler& scheduler
|
||||||
ASSERT_MSG(layout_result == vk::Result::eSuccess,
|
ASSERT_MSG(layout_result == vk::Result::eSuccess,
|
||||||
"Failed to create compute pipeline layout: {}", vk::to_string(layout_result));
|
"Failed to create compute pipeline layout: {}", vk::to_string(layout_result));
|
||||||
pipeline_layout = std::move(layout);
|
pipeline_layout = std::move(layout);
|
||||||
|
SetObjectName(device, *pipeline_layout, "Compute PipelineLayout {}", debug_str);
|
||||||
|
|
||||||
const vk::ComputePipelineCreateInfo compute_pipeline_ci = {
|
const vk::ComputePipelineCreateInfo compute_pipeline_ci = {
|
||||||
.stage = shader_ci,
|
.stage = shader_ci,
|
||||||
|
@ -117,6 +120,7 @@ ComputePipeline::ComputePipeline(const Instance& instance_, Scheduler& scheduler
|
||||||
ASSERT_MSG(pipeline_result == vk::Result::eSuccess, "Failed to create compute pipeline: {}",
|
ASSERT_MSG(pipeline_result == vk::Result::eSuccess, "Failed to create compute pipeline: {}",
|
||||||
vk::to_string(pipeline_result));
|
vk::to_string(pipeline_result));
|
||||||
pipeline = std::move(pipe);
|
pipeline = std::move(pipe);
|
||||||
|
SetObjectName(device, *pipeline, "Compute Pipeline {}", debug_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
ComputePipeline::~ComputePipeline() = default;
|
ComputePipeline::~ComputePipeline() = default;
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/io_file.h"
|
#include "common/io_file.h"
|
||||||
#include "common/scope_exit.h"
|
|
||||||
#include "shader_recompiler/backend/spirv/emit_spirv_quad_rect.h"
|
#include "shader_recompiler/backend/spirv/emit_spirv_quad_rect.h"
|
||||||
#include "shader_recompiler/frontend/fetch_shader.h"
|
#include "shader_recompiler/frontend/fetch_shader.h"
|
||||||
#include "shader_recompiler/runtime_info.h"
|
#include "shader_recompiler/runtime_info.h"
|
||||||
|
@ -16,6 +15,7 @@
|
||||||
#include "video_core/buffer_cache/buffer_cache.h"
|
#include "video_core/buffer_cache/buffer_cache.h"
|
||||||
#include "video_core/renderer_vulkan/vk_graphics_pipeline.h"
|
#include "video_core/renderer_vulkan/vk_graphics_pipeline.h"
|
||||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||||
|
#include "video_core/renderer_vulkan/vk_pipeline_cache.h"
|
||||||
#include "video_core/renderer_vulkan/vk_scheduler.h"
|
#include "video_core/renderer_vulkan/vk_scheduler.h"
|
||||||
#include "video_core/renderer_vulkan/vk_shader_util.h"
|
#include "video_core/renderer_vulkan/vk_shader_util.h"
|
||||||
#include "video_core/texture_cache/texture_cache.h"
|
#include "video_core/texture_cache/texture_cache.h"
|
||||||
|
@ -36,6 +36,7 @@ GraphicsPipeline::GraphicsPipeline(
|
||||||
const vk::Device device = instance.GetDevice();
|
const vk::Device device = instance.GetDevice();
|
||||||
std::ranges::copy(infos, stages.begin());
|
std::ranges::copy(infos, stages.begin());
|
||||||
BuildDescSetLayout();
|
BuildDescSetLayout();
|
||||||
|
const auto debug_str = GetDebugString();
|
||||||
|
|
||||||
const vk::PushConstantRange push_constants = {
|
const vk::PushConstantRange push_constants = {
|
||||||
.stageFlags = gp_stage_flags,
|
.stageFlags = gp_stage_flags,
|
||||||
|
@ -54,6 +55,7 @@ GraphicsPipeline::GraphicsPipeline(
|
||||||
ASSERT_MSG(layout_result == vk::Result::eSuccess,
|
ASSERT_MSG(layout_result == vk::Result::eSuccess,
|
||||||
"Failed to create graphics pipeline layout: {}", vk::to_string(layout_result));
|
"Failed to create graphics pipeline layout: {}", vk::to_string(layout_result));
|
||||||
pipeline_layout = std::move(layout);
|
pipeline_layout = std::move(layout);
|
||||||
|
SetObjectName(device, *pipeline_layout, "Graphics PipelineLayout {}", debug_str);
|
||||||
|
|
||||||
boost::container::static_vector<vk::VertexInputBindingDescription, 32> vertex_bindings;
|
boost::container::static_vector<vk::VertexInputBindingDescription, 32> vertex_bindings;
|
||||||
boost::container::static_vector<vk::VertexInputAttributeDescription, 32> vertex_attributes;
|
boost::container::static_vector<vk::VertexInputAttributeDescription, 32> vertex_attributes;
|
||||||
|
@ -322,6 +324,7 @@ GraphicsPipeline::GraphicsPipeline(
|
||||||
ASSERT_MSG(pipeline_result == vk::Result::eSuccess, "Failed to create graphics pipeline: {}",
|
ASSERT_MSG(pipeline_result == vk::Result::eSuccess, "Failed to create graphics pipeline: {}",
|
||||||
vk::to_string(pipeline_result));
|
vk::to_string(pipeline_result));
|
||||||
pipeline = std::move(pipe);
|
pipeline = std::move(pipe);
|
||||||
|
SetObjectName(device, *pipeline, "Graphics Pipeline {}", debug_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
GraphicsPipeline::~GraphicsPipeline() = default;
|
GraphicsPipeline::~GraphicsPipeline() = default;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "shader_recompiler/info.h"
|
#include "shader_recompiler/info.h"
|
||||||
#include "video_core/buffer_cache/buffer_cache.h"
|
#include "video_core/buffer_cache/buffer_cache.h"
|
||||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||||
|
#include "video_core/renderer_vulkan/vk_pipeline_cache.h"
|
||||||
#include "video_core/renderer_vulkan/vk_pipeline_common.h"
|
#include "video_core/renderer_vulkan/vk_pipeline_common.h"
|
||||||
#include "video_core/renderer_vulkan/vk_scheduler.h"
|
#include "video_core/renderer_vulkan/vk_scheduler.h"
|
||||||
#include "video_core/texture_cache/texture_cache.h"
|
#include "video_core/texture_cache/texture_cache.h"
|
||||||
|
@ -55,4 +56,19 @@ void Pipeline::BindResources(DescriptorWrites& set_writes, const BufferBarriers&
|
||||||
cmdbuf.bindDescriptorSets(bind_point, *pipeline_layout, 0, desc_set, {});
|
cmdbuf.bindDescriptorSets(bind_point, *pipeline_layout, 0, desc_set, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string Pipeline::GetDebugString() const {
|
||||||
|
std::string stage_desc;
|
||||||
|
for (const auto& stage : stages) {
|
||||||
|
if (stage) {
|
||||||
|
const auto shader_name = PipelineCache::GetShaderName(stage->stage, stage->pgm_hash);
|
||||||
|
if (stage_desc.empty()) {
|
||||||
|
stage_desc = shader_name;
|
||||||
|
} else {
|
||||||
|
stage_desc = fmt::format("{},{}", stage_desc, shader_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stage_desc;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Vulkan
|
} // namespace Vulkan
|
||||||
|
|
|
@ -61,6 +61,8 @@ public:
|
||||||
const Shader::PushData& push_data) const;
|
const Shader::PushData& push_data) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
[[nodiscard]] std::string GetDebugString() const;
|
||||||
|
|
||||||
const Instance& instance;
|
const Instance& instance;
|
||||||
Scheduler& scheduler;
|
Scheduler& scheduler;
|
||||||
DescriptorHeap& desc_heap;
|
DescriptorHeap& desc_heap;
|
||||||
|
|
Loading…
Reference in a new issue