adding debug vulkan resources names

This commit is contained in:
2024-09-21 12:18:42 +02:00
parent 2e08c37624
commit 904b6d31ac
27 changed files with 306 additions and 104 deletions

View File

@@ -9,6 +9,7 @@ namespace mlx
{
void GraphicPipeline::Init(const GraphicPipelineDescriptor& descriptor)
{
MLX_PROFILE_FUNCTION();
if(!descriptor.vertex_shader || !descriptor.fragment_shader)
FatalError("Vulkan : invalid shaders");
@@ -62,6 +63,7 @@ namespace mlx
bool GraphicPipeline::BindPipeline(VkCommandBuffer command_buffer, std::size_t framebuffer_index, std::array<float, 4> clear) noexcept
{
MLX_PROFILE_FUNCTION();
TransitionAttachments(command_buffer);
VkFramebuffer fb = m_framebuffers[framebuffer_index];
VkExtent2D fb_extent = kvfGetFramebufferSize(fb);
@@ -98,11 +100,13 @@ namespace mlx
void GraphicPipeline::EndPipeline(VkCommandBuffer command_buffer) noexcept
{
MLX_PROFILE_FUNCTION();
RenderCore::Get().vkCmdEndRenderPass(command_buffer);
}
void GraphicPipeline::Destroy() noexcept
{
MLX_PROFILE_FUNCTION();
p_vertex_shader.reset();
p_fragment_shader.reset();
for(auto& fb : m_framebuffers)
@@ -124,6 +128,7 @@ namespace mlx
void GraphicPipeline::CreateFramebuffers(const std::vector<NonOwningPtr<Texture>>& render_targets, bool clear_attachments)
{
MLX_PROFILE_FUNCTION();
std::vector<VkAttachmentDescription> attachments;
std::vector<VkImageView> attachment_views;
if(p_renderer)
@@ -167,6 +172,7 @@ namespace mlx
void GraphicPipeline::TransitionAttachments(VkCommandBuffer cmd)
{
MLX_PROFILE_FUNCTION();
if(p_depth)
p_depth->TransitionLayout(VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL, cmd);

View File

@@ -6,6 +6,7 @@ namespace mlx
{
Shader::Shader(const std::vector<std::uint8_t>& bytecode, ShaderType type, ShaderLayout layout) : m_layout(std::move(layout)), m_bytecode(bytecode)
{
MLX_PROFILE_FUNCTION();
switch(type)
{
case ShaderType::Vertex : m_stage = VK_SHADER_STAGE_VERTEX_BIT; break;
@@ -22,6 +23,7 @@ namespace mlx
void Shader::GeneratePipelineLayout(ShaderLayout layout)
{
MLX_PROFILE_FUNCTION();
for(auto& [n, set] : layout.set_layouts)
{
std::vector<VkDescriptorSetLayoutBinding> bindings(set.binds.size());
@@ -55,6 +57,7 @@ namespace mlx
Shader::~Shader()
{
MLX_PROFILE_FUNCTION();
kvfDestroyShaderModule(RenderCore::Get().GetDevice(), m_module);
DebugLog("Vulkan : shader module destroyed");
for(auto& layout : m_set_layouts)