Renderer: Implement and use debug names

This commit is contained in:
SirLynix
2022-12-02 22:46:43 +01:00
parent 54aafe05a1
commit 77642cf431
74 changed files with 290 additions and 38 deletions

View File

@@ -136,6 +136,11 @@ namespace Nz
return true;
}
}
void VulkanBuffer::UpdateDebugName(std::string_view name)
{
return m_device.SetDebugName(VK_OBJECT_TYPE_BUFFER, static_cast<UInt64>(reinterpret_cast<std::uintptr_t>(m_buffer)), name);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)

View File

@@ -8,6 +8,11 @@
namespace Nz
{
void VulkanCommandBuffer::UpdateDebugName(std::string_view name)
{
return m_owner.m_device->SetDebugName(VK_OBJECT_TYPE_COMMAND_BUFFER, static_cast<UInt64>(reinterpret_cast<std::uintptr_t>(static_cast<VkCommandBuffer>(m_commandBuffer))), name);
}
void VulkanCommandBuffer::Release()
{
m_owner.Release(*this);

View File

@@ -38,7 +38,12 @@ namespace Nz
return AllocateFromPool(newPoolIndex, std::move(commandBuffer));
}
void VulkanCommandPool::UpdateDebugName(std::string_view name)
{
m_commandPool.SetDebugName(name);
}
auto VulkanCommandPool::AllocatePool() -> CommandPool&
{
constexpr UInt32 MaxSet = 128;

View File

@@ -7,6 +7,10 @@
namespace Nz
{
void VulkanFramebuffer::UpdateDebugName(std::string_view name)
{
GetFramebuffer().SetDebugName(name);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)

View File

@@ -133,6 +133,11 @@ namespace Nz
{
OnRenderPassRelease(this);
}
void VulkanRenderPass::UpdateDebugName(std::string_view name)
{
return m_renderPass.SetDebugName(name);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)

View File

@@ -51,10 +51,18 @@ namespace Nz
if (!pipelineData.pipeline.CreateGraphics(*m_device, pipelineCreateInfo))
return VK_NULL_HANDLE;
if (!m_debugName.empty())
pipelineData.pipeline.SetDebugName(m_debugName);
auto it = m_pipelines.emplace(key, std::move(pipelineData)).first;
return it->second.pipeline;
}
void VulkanRenderPipeline::UpdateDebugName(std::string_view name)
{
m_debugName = name;
}
std::vector<VkPipelineColorBlendAttachmentState> VulkanRenderPipeline::BuildColorBlendAttachmentStateList(const RenderPipelineInfo& pipelineInfo)
{
std::vector<VkPipelineColorBlendAttachmentState> colorBlendStates;

View File

@@ -87,6 +87,11 @@ namespace Nz
return true;
}
void VulkanRenderPipelineLayout::UpdateDebugName(std::string_view name)
{
m_pipelineLayout.SetDebugName(name);
}
auto VulkanRenderPipelineLayout::AllocatePool() -> DescriptorPool&
{
StackVector<VkDescriptorPoolSize> poolSizes = NazaraStackVector(VkDescriptorPoolSize, m_layoutInfo.bindings.size());

View File

@@ -81,6 +81,11 @@ namespace Nz
m_owner.GetDevice()->vkUpdateDescriptorSets(*m_owner.GetDevice(), UInt32(writeOps.size()), writeOps.data(), 0U, nullptr);
}
void VulkanShaderBinding::UpdateDebugName(std::string_view name)
{
return m_owner.m_device->SetDebugName(VK_OBJECT_TYPE_DESCRIPTOR_SET, static_cast<UInt64>(reinterpret_cast<std::uintptr_t>(static_cast<VkDescriptorSet>(m_descriptorSet))), name);
}
void VulkanShaderBinding::Release()
{
m_owner.Release(*this);

View File

@@ -146,6 +146,11 @@ namespace Nz
NazaraError("this language is not supported");
return false;
}
void VulkanShaderModule::UpdateDebugName(std::string_view name)
{
m_shaderModule.SetDebugName(name);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)

View File

@@ -339,6 +339,11 @@ namespace Nz
return true;
}
void VulkanTexture::UpdateDebugName(std::string_view name)
{
return m_device.SetDebugName(VK_OBJECT_TYPE_IMAGE, static_cast<UInt64>(reinterpret_cast<std::uintptr_t>(m_image)), name);
}
void VulkanTexture::InitForFormat(PixelFormat pixelFormat, VkImageCreateInfo& createImage, VkImageViewCreateInfo& createImageView)
{
createImageView.components = {

View File

@@ -32,6 +32,11 @@ namespace Nz
if (!m_sampler.Create(device, createInfo))
throw std::runtime_error("Failed to create sampler: " + TranslateVulkanError(m_sampler.GetLastErrorCode()));
}
void VulkanTextureSampler::UpdateDebugName(std::string_view name)
{
return m_sampler.SetDebugName(name);
}
}
#if defined(NAZARA_PLATFORM_WINDOWS)