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

@ -83,6 +83,7 @@ namespace Nz
struct TextureData struct TextureData
{ {
std::string name;
std::shared_ptr<Texture> texture; std::shared_ptr<Texture> texture;
PixelFormat format; PixelFormat format;
TextureUsageFlags usage; TextureUsageFlags usage;

View File

@ -86,6 +86,7 @@ namespace Nz
struct TextureData struct TextureData
{ {
std::string name;
PixelFormat format; PixelFormat format;
TextureUsageFlags usage; TextureUsageFlags usage;
unsigned int width; unsigned int width;

View File

@ -32,6 +32,8 @@ namespace Nz
void* Map(UInt64 offset, UInt64 size) override; void* Map(UInt64 offset, UInt64 size) override;
bool Unmap() override; bool Unmap() override;
void UpdateDebugName(std::string_view name) override;
OpenGLBuffer& operator=(const OpenGLBuffer&) = delete; OpenGLBuffer& operator=(const OpenGLBuffer&) = delete;
OpenGLBuffer& operator=(OpenGLBuffer&&) = delete; OpenGLBuffer& operator=(OpenGLBuffer&&) = delete;

View File

@ -62,6 +62,8 @@ namespace Nz
inline void SetScissor(const Recti& scissorRegion); inline void SetScissor(const Recti& scissorRegion);
inline void SetViewport(const Recti& viewportRegion); inline void SetViewport(const Recti& viewportRegion);
void UpdateDebugName(std::string_view name) override;
OpenGLCommandBuffer& operator=(const OpenGLCommandBuffer&) = delete; OpenGLCommandBuffer& operator=(const OpenGLCommandBuffer&) = delete;
OpenGLCommandBuffer& operator=(OpenGLCommandBuffer&&) = delete; OpenGLCommandBuffer& operator=(OpenGLCommandBuffer&&) = delete;

View File

@ -27,6 +27,8 @@ namespace Nz
CommandBufferPtr BuildCommandBuffer(const std::function<void(CommandBufferBuilder& builder)>& callback) override; CommandBufferPtr BuildCommandBuffer(const std::function<void(CommandBufferBuilder& builder)>& callback) override;
void UpdateDebugName(std::string_view name) override;
OpenGLCommandPool& operator=(const OpenGLCommandPool&) = delete; OpenGLCommandPool& operator=(const OpenGLCommandPool&) = delete;
OpenGLCommandPool& operator=(OpenGLCommandPool&&) = delete; OpenGLCommandPool& operator=(OpenGLCommandPool&&) = delete;

View File

@ -35,6 +35,8 @@ namespace Nz
const Vector2ui& GetSize() const override; const Vector2ui& GetSize() const override;
void UpdateDebugName(std::string_view name) override;
OpenGLFboFramebuffer& operator=(const OpenGLFboFramebuffer&) = delete; OpenGLFboFramebuffer& operator=(const OpenGLFboFramebuffer&) = delete;
OpenGLFboFramebuffer& operator=(OpenGLFboFramebuffer&&) = delete; OpenGLFboFramebuffer& operator=(OpenGLFboFramebuffer&&) = delete;

View File

@ -22,6 +22,8 @@ namespace Nz
OpenGLRenderPass(OpenGLRenderPass&&) noexcept = default; OpenGLRenderPass(OpenGLRenderPass&&) noexcept = default;
~OpenGLRenderPass() = default; ~OpenGLRenderPass() = default;
void UpdateDebugName(std::string_view name) override;
OpenGLRenderPass& operator=(const OpenGLRenderPass&) = delete; OpenGLRenderPass& operator=(const OpenGLRenderPass&) = delete;
OpenGLRenderPass& operator=(OpenGLRenderPass&&) noexcept = default; OpenGLRenderPass& operator=(OpenGLRenderPass&&) noexcept = default;
}; };

View File

@ -26,6 +26,8 @@ namespace Nz
inline const RenderPipelineInfo& GetPipelineInfo() const override; inline const RenderPipelineInfo& GetPipelineInfo() const override;
void UpdateDebugName(std::string_view name) override;
private: private:
RenderPipelineInfo m_pipelineInfo; RenderPipelineInfo m_pipelineInfo;
GL::Program m_program; GL::Program m_program;

View File

@ -36,6 +36,8 @@ namespace Nz
inline const nzsl::GlslWriter::BindingMapping& GetBindingMapping() const; inline const nzsl::GlslWriter::BindingMapping& GetBindingMapping() const;
inline const RenderPipelineLayoutInfo& GetLayoutInfo() const; inline const RenderPipelineLayoutInfo& GetLayoutInfo() const;
void UpdateDebugName(std::string_view name) override;
OpenGLRenderPipelineLayout& operator=(const OpenGLRenderPipelineLayout&) = delete; OpenGLRenderPipelineLayout& operator=(const OpenGLRenderPipelineLayout&) = delete;
OpenGLRenderPipelineLayout& operator=(OpenGLRenderPipelineLayout&&) = delete; OpenGLRenderPipelineLayout& operator=(OpenGLRenderPipelineLayout&&) = delete;

View File

@ -32,6 +32,8 @@ namespace Nz
void Update(const Binding* bindings, std::size_t bindingCount) override; void Update(const Binding* bindings, std::size_t bindingCount) override;
void UpdateDebugName(std::string_view name) override;
OpenGLShaderBinding& operator=(const OpenGLShaderBinding&) = delete; OpenGLShaderBinding& operator=(const OpenGLShaderBinding&) = delete;
OpenGLShaderBinding& operator=(OpenGLShaderBinding&&) = delete; OpenGLShaderBinding& operator=(OpenGLShaderBinding&&) = delete;

View File

@ -15,6 +15,7 @@
#include <Nazara/Renderer/ShaderModule.hpp> #include <Nazara/Renderer/ShaderModule.hpp>
#include <NZSL/GlslWriter.hpp> #include <NZSL/GlslWriter.hpp>
#include <NZSL/Ast/Module.hpp> #include <NZSL/Ast/Module.hpp>
#include <string>
#include <vector> #include <vector>
namespace Nz namespace Nz
@ -31,6 +32,8 @@ namespace Nz
inline const std::vector<ExplicitBinding>& GetExplicitBindings() const; inline const std::vector<ExplicitBinding>& GetExplicitBindings() const;
void UpdateDebugName(std::string_view name) override;
struct ExplicitBinding struct ExplicitBinding
{ {
std::string name; std::string name;
@ -61,6 +64,7 @@ namespace Nz
OpenGLDevice& m_device; OpenGLDevice& m_device;
nzsl::ShaderWriter::States m_states; nzsl::ShaderWriter::States m_states;
std::string m_debugName;
std::vector<ExplicitBinding> m_explicitBindings; std::vector<ExplicitBinding> m_explicitBindings;
std::vector<Shader> m_shaders; std::vector<Shader> m_shaders;
}; };

View File

@ -34,6 +34,8 @@ namespace Nz
using Texture::Update; using Texture::Update;
bool Update(const void* ptr, const Boxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override; bool Update(const void* ptr, const Boxui& box, unsigned int srcWidth = 0, unsigned int srcHeight = 0, UInt8 level = 0) override;
void UpdateDebugName(std::string_view name) override;
OpenGLTexture& operator=(const OpenGLTexture&) = delete; OpenGLTexture& operator=(const OpenGLTexture&) = delete;
OpenGLTexture& operator=(OpenGLTexture&&) = delete; OpenGLTexture& operator=(OpenGLTexture&&) = delete;

View File

@ -24,6 +24,8 @@ namespace Nz
inline const GL::Sampler& GetSampler(bool mipmaps) const; inline const GL::Sampler& GetSampler(bool mipmaps) const;
void UpdateDebugName(std::string_view name) override;
OpenGLTextureSampler& operator=(const OpenGLTextureSampler&) = delete; OpenGLTextureSampler& operator=(const OpenGLTextureSampler&) = delete;
OpenGLTextureSampler& operator=(OpenGLTextureSampler&&) = delete; OpenGLTextureSampler& operator=(OpenGLTextureSampler&&) = delete;

View File

@ -28,6 +28,8 @@ namespace Nz
const Vector2ui& GetSize() const override; const Vector2ui& GetSize() const override;
void UpdateDebugName(std::string_view name) override;
OpenGLWindowFramebuffer& operator=(const OpenGLWindowFramebuffer&) = delete; OpenGLWindowFramebuffer& operator=(const OpenGLWindowFramebuffer&) = delete;
OpenGLWindowFramebuffer& operator=(OpenGLWindowFramebuffer&&) = delete; OpenGLWindowFramebuffer& operator=(OpenGLWindowFramebuffer&&) = delete;

View File

@ -10,6 +10,7 @@
#include <Nazara/Prerequisites.hpp> #include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Config.hpp> #include <Nazara/Renderer/Config.hpp>
#include <memory> #include <memory>
#include <string_view>
namespace Nz namespace Nz
{ {
@ -28,6 +29,8 @@ namespace Nz
CommandBuffer(CommandBuffer&&) = delete; CommandBuffer(CommandBuffer&&) = delete;
virtual ~CommandBuffer(); virtual ~CommandBuffer();
virtual void UpdateDebugName(std::string_view name) = 0;
CommandBuffer& operator=(const CommandBuffer&) = delete; CommandBuffer& operator=(const CommandBuffer&) = delete;
CommandBuffer& operator=(CommandBuffer&&) = delete; CommandBuffer& operator=(CommandBuffer&&) = delete;

View File

@ -26,6 +26,8 @@ namespace Nz
virtual CommandBufferPtr BuildCommandBuffer(const std::function<void(CommandBufferBuilder& builder)>& callback) = 0; virtual CommandBufferPtr BuildCommandBuffer(const std::function<void(CommandBufferBuilder& builder)>& callback) = 0;
virtual void UpdateDebugName(std::string_view name) = 0;
CommandPool& operator=(const CommandPool&) = delete; CommandPool& operator=(const CommandPool&) = delete;
CommandPool& operator=(CommandPool&&) = default; CommandPool& operator=(CommandPool&&) = default;
}; };

View File

@ -23,6 +23,8 @@ namespace Nz
inline FramebufferType GetType() const; inline FramebufferType GetType() const;
virtual void UpdateDebugName(std::string_view name) = 0;
Framebuffer& operator=(const Framebuffer&) = delete; Framebuffer& operator=(const Framebuffer&) = delete;
Framebuffer& operator=(Framebuffer&&) noexcept = default; Framebuffer& operator=(Framebuffer&&) noexcept = default;

View File

@ -27,6 +27,8 @@ namespace Nz
inline RenderDevice& GetRenderDevice(); inline RenderDevice& GetRenderDevice();
inline const RenderDevice& GetRenderDevice() const; inline const RenderDevice& GetRenderDevice() const;
virtual void UpdateDebugName(std::string_view name) = 0;
RenderBuffer& operator=(const RenderBuffer&) = delete; RenderBuffer& operator=(const RenderBuffer&) = delete;
RenderBuffer& operator=(RenderBuffer&&) = delete; RenderBuffer& operator=(RenderBuffer&&) = delete;

View File

@ -35,6 +35,8 @@ namespace Nz
inline const std::vector<SubpassDescription>& GetSubpassDescriptions() const; inline const std::vector<SubpassDescription>& GetSubpassDescriptions() const;
inline const std::vector<SubpassDependency>& GetSubpassDependencies() const; inline const std::vector<SubpassDependency>& GetSubpassDependencies() const;
virtual void UpdateDebugName(std::string_view name) = 0;
RenderPass& operator=(const RenderPass&) = delete; RenderPass& operator=(const RenderPass&) = delete;
RenderPass& operator=(RenderPass&&) noexcept = default; RenderPass& operator=(RenderPass&&) noexcept = default;

View File

@ -36,6 +36,8 @@ namespace Nz
virtual const RenderPipelineInfo& GetPipelineInfo() const = 0; virtual const RenderPipelineInfo& GetPipelineInfo() const = 0;
virtual void UpdateDebugName(std::string_view name) = 0;
protected: protected:
static void ValidatePipelineInfo(const RenderDevice& device, RenderPipelineInfo& pipelineInfo); static void ValidatePipelineInfo(const RenderDevice& device, RenderPipelineInfo& pipelineInfo);
}; };

View File

@ -37,6 +37,8 @@ namespace Nz
virtual ~RenderPipelineLayout(); virtual ~RenderPipelineLayout();
virtual ShaderBindingPtr AllocateShaderBinding(UInt32 setIndex) = 0; virtual ShaderBindingPtr AllocateShaderBinding(UInt32 setIndex) = 0;
virtual void UpdateDebugName(std::string_view name) = 0;
}; };
} }

View File

@ -10,6 +10,7 @@
#include <Nazara/Prerequisites.hpp> #include <Nazara/Prerequisites.hpp>
#include <Nazara/Renderer/Config.hpp> #include <Nazara/Renderer/Config.hpp>
#include <memory> #include <memory>
#include <string_view>
#include <variant> #include <variant>
namespace Nz namespace Nz
@ -37,6 +38,8 @@ namespace Nz
virtual void Update(const Binding* bindings, std::size_t bindingCount) = 0; virtual void Update(const Binding* bindings, std::size_t bindingCount) = 0;
inline void Update(std::initializer_list<Binding> bindings); inline void Update(std::initializer_list<Binding> bindings);
virtual void UpdateDebugName(std::string_view name) = 0;
ShaderBinding& operator=(const ShaderBinding&) = delete; ShaderBinding& operator=(const ShaderBinding&) = delete;
ShaderBinding& operator=(ShaderBinding&&) = delete; ShaderBinding& operator=(ShaderBinding&&) = delete;

View File

@ -18,6 +18,8 @@ namespace Nz
public: public:
ShaderModule() = default; ShaderModule() = default;
virtual ~ShaderModule(); virtual ~ShaderModule();
virtual void UpdateDebugName(std::string_view name) = 0;
}; };
} }

View File

@ -61,6 +61,11 @@ namespace Nz
virtual Vector3ui GetSize(UInt8 level = 0) const = 0; virtual Vector3ui GetSize(UInt8 level = 0) const = 0;
virtual ImageType GetType() const = 0; virtual ImageType GetType() const = 0;
virtual void UpdateDebugName(std::string_view name) = 0;
Texture& operator=(const Texture&) = delete;
Texture& operator=(Texture&&) = delete;
static inline unsigned int GetLevelSize(unsigned int size, unsigned int level); static inline unsigned int GetLevelSize(unsigned int size, unsigned int level);
static std::shared_ptr<Texture> CreateFromImage(const Image& image, const TextureParams& params); static std::shared_ptr<Texture> CreateFromImage(const Image& image, const TextureParams& params);
@ -79,9 +84,6 @@ namespace Nz
static std::shared_ptr<Texture> LoadCubemapFromFile(const std::filesystem::path& filePath, const TextureParams& textureParams, const CubemapParams& cubemapParams = CubemapParams()); static std::shared_ptr<Texture> LoadCubemapFromFile(const std::filesystem::path& filePath, const TextureParams& textureParams, const CubemapParams& cubemapParams = CubemapParams());
static std::shared_ptr<Texture> LoadCubemapFromMemory(const void* data, std::size_t size, const TextureParams& textureParams, const CubemapParams& cubemapParams = CubemapParams()); static std::shared_ptr<Texture> LoadCubemapFromMemory(const void* data, std::size_t size, const TextureParams& textureParams, const CubemapParams& cubemapParams = CubemapParams());
static std::shared_ptr<Texture> LoadCubemapFromStream(Stream& stream, const TextureParams& textureParams, const CubemapParams& cubemapParams = CubemapParams()); static std::shared_ptr<Texture> LoadCubemapFromStream(Stream& stream, const TextureParams& textureParams, const CubemapParams& cubemapParams = CubemapParams());
Texture& operator=(const Texture&) = delete;
Texture& operator=(Texture&&) = delete;
}; };
} }

View File

@ -38,6 +38,8 @@ namespace Nz
TextureSampler(TextureSampler&&) = delete; TextureSampler(TextureSampler&&) = delete;
virtual ~TextureSampler(); virtual ~TextureSampler();
virtual void UpdateDebugName(std::string_view name) = 0;
TextureSampler& operator=(const TextureSampler&) = delete; TextureSampler& operator=(const TextureSampler&) = delete;
TextureSampler& operator=(TextureSampler&&) = delete; TextureSampler& operator=(TextureSampler&&) = delete;

View File

@ -33,6 +33,8 @@ namespace Nz
void* Map(UInt64 offset, UInt64 size) override; void* Map(UInt64 offset, UInt64 size) override;
bool Unmap() override; bool Unmap() override;
void UpdateDebugName(std::string_view name) override;
VulkanBuffer& operator=(const VulkanBuffer&) = delete; VulkanBuffer& operator=(const VulkanBuffer&) = delete;
VulkanBuffer& operator=(VulkanBuffer&&) = delete; ///TODO VulkanBuffer& operator=(VulkanBuffer&&) = delete; ///TODO

View File

@ -30,6 +30,8 @@ namespace Nz
inline std::size_t GetPoolIndex() const; inline std::size_t GetPoolIndex() const;
inline const VulkanCommandPool& GetOwner() const; inline const VulkanCommandPool& GetOwner() const;
void UpdateDebugName(std::string_view name) override;
VulkanCommandBuffer& operator=(const VulkanCommandBuffer&) = delete; VulkanCommandBuffer& operator=(const VulkanCommandBuffer&) = delete;
VulkanCommandBuffer& operator=(VulkanCommandBuffer&&) = delete; VulkanCommandBuffer& operator=(VulkanCommandBuffer&&) = delete;

View File

@ -30,6 +30,8 @@ namespace Nz
CommandBufferPtr BuildCommandBuffer(const std::function<void(CommandBufferBuilder& builder)>& callback) override; CommandBufferPtr BuildCommandBuffer(const std::function<void(CommandBufferBuilder& builder)>& callback) override;
void UpdateDebugName(std::string_view name) override;
VulkanCommandPool& operator=(const VulkanCommandPool&) = delete; VulkanCommandPool& operator=(const VulkanCommandPool&) = delete;
VulkanCommandPool& operator=(VulkanCommandPool&&) = delete; VulkanCommandPool& operator=(VulkanCommandPool&&) = delete;

View File

@ -19,7 +19,10 @@ namespace Nz
public: public:
using Framebuffer::Framebuffer; using Framebuffer::Framebuffer;
virtual Vk::Framebuffer& GetFramebuffer() = 0;
virtual const Vk::Framebuffer& GetFramebuffer() const = 0; virtual const Vk::Framebuffer& GetFramebuffer() const = 0;
void UpdateDebugName(std::string_view name) override;
}; };
} }

View File

@ -27,6 +27,8 @@ namespace Nz
inline Vk::RenderPass& GetRenderPass(); inline Vk::RenderPass& GetRenderPass();
inline const Vk::RenderPass& GetRenderPass() const; inline const Vk::RenderPass& GetRenderPass() const;
void UpdateDebugName(std::string_view name) override;
VulkanRenderPass& operator=(const VulkanRenderPass&) = delete; VulkanRenderPass& operator=(const VulkanRenderPass&) = delete;
VulkanRenderPass& operator=(VulkanRenderPass&&) noexcept = default; VulkanRenderPass& operator=(VulkanRenderPass&&) noexcept = default;

View File

@ -15,6 +15,7 @@
#include <Nazara/VulkanRenderer/Wrapper/Device.hpp> #include <Nazara/VulkanRenderer/Wrapper/Device.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Pipeline.hpp> #include <Nazara/VulkanRenderer/Wrapper/Pipeline.hpp>
#include <Nazara/Utils/MovablePtr.hpp> #include <Nazara/Utils/MovablePtr.hpp>
#include <string>
#include <vector> #include <vector>
namespace Nz namespace Nz
@ -35,6 +36,8 @@ namespace Nz
inline const RenderPipelineInfo& GetPipelineInfo() const override; inline const RenderPipelineInfo& GetPipelineInfo() const override;
void UpdateDebugName(std::string_view name) override;
VulkanRenderPipeline& operator=(const VulkanRenderPipeline&) = delete; VulkanRenderPipeline& operator=(const VulkanRenderPipeline&) = delete;
VulkanRenderPipeline& operator=(VulkanRenderPipeline&&) = delete; VulkanRenderPipeline& operator=(VulkanRenderPipeline&&) = delete;
@ -93,6 +96,7 @@ namespace Nz
Vk::Pipeline pipeline; Vk::Pipeline pipeline;
}; };
std::string m_debugName;
mutable std::unordered_map<std::pair<VkRenderPass, std::size_t>, PipelineData, PipelineHasher> m_pipelines; mutable std::unordered_map<std::pair<VkRenderPass, std::size_t>, PipelineData, PipelineHasher> m_pipelines;
MovablePtr<Vk::Device> m_device; MovablePtr<Vk::Device> m_device;
mutable CreateInfo m_pipelineCreateInfo; mutable CreateInfo m_pipelineCreateInfo;

View File

@ -39,6 +39,8 @@ namespace Nz
inline const Vk::PipelineLayout& GetPipelineLayout() const; inline const Vk::PipelineLayout& GetPipelineLayout() const;
void UpdateDebugName(std::string_view name) override;
private: private:
struct DescriptorPool; struct DescriptorPool;

View File

@ -30,6 +30,8 @@ namespace Nz
void Update(const Binding* bindings, std::size_t bindingCount) override; void Update(const Binding* bindings, std::size_t bindingCount) override;
void UpdateDebugName(std::string_view name) override;
VulkanShaderBinding& operator=(const VulkanShaderBinding&) = delete; VulkanShaderBinding& operator=(const VulkanShaderBinding&) = delete;
VulkanShaderBinding& operator=(VulkanShaderBinding&&) = delete; VulkanShaderBinding& operator=(VulkanShaderBinding&&) = delete;

View File

@ -28,6 +28,8 @@ namespace Nz
inline const Vk::ShaderModule& GetHandle() const; inline const Vk::ShaderModule& GetHandle() const;
inline const std::vector<Stage>& GetStages() const; inline const std::vector<Stage>& GetStages() const;
void UpdateDebugName(std::string_view name) override;
struct Stage struct Stage
{ {
nzsl::ShaderStageType stage; nzsl::ShaderStageType stage;

View File

@ -35,6 +35,8 @@ namespace Nz
using Texture::Update; using Texture::Update;
bool Update(const void* ptr, const Boxui& box, unsigned int srcWidth, unsigned int srcHeight, UInt8 level) override; bool Update(const void* ptr, const Boxui& box, unsigned int srcWidth, unsigned int srcHeight, UInt8 level) override;
void UpdateDebugName(std::string_view name) override;
VulkanTexture& operator=(const VulkanTexture&) = delete; VulkanTexture& operator=(const VulkanTexture&) = delete;
VulkanTexture& operator=(VulkanTexture&&) = delete; VulkanTexture& operator=(VulkanTexture&&) = delete;

View File

@ -23,6 +23,7 @@ namespace Nz
VulkanTextureFramebuffer(VulkanTextureFramebuffer&&) = delete; VulkanTextureFramebuffer(VulkanTextureFramebuffer&&) = delete;
~VulkanTextureFramebuffer() = default; ~VulkanTextureFramebuffer() = default;
inline Vk::Framebuffer& GetFramebuffer() override;
inline const Vk::Framebuffer& GetFramebuffer() const override; inline const Vk::Framebuffer& GetFramebuffer() const override;
VulkanTextureFramebuffer& operator=(const VulkanTextureFramebuffer&) = delete; VulkanTextureFramebuffer& operator=(const VulkanTextureFramebuffer&) = delete;

View File

@ -7,6 +7,11 @@
namespace Nz namespace Nz
{ {
inline Vk::Framebuffer& VulkanTextureFramebuffer::GetFramebuffer()
{
return m_framebuffer;
}
inline const Vk::Framebuffer& VulkanTextureFramebuffer::GetFramebuffer() const inline const Vk::Framebuffer& VulkanTextureFramebuffer::GetFramebuffer() const
{ {
return m_framebuffer; return m_framebuffer;

View File

@ -25,6 +25,8 @@ namespace Nz
inline VkSampler GetSampler() const; inline VkSampler GetSampler() const;
void UpdateDebugName(std::string_view name) override;
VulkanTextureSampler& operator=(const VulkanTextureSampler&) = delete; VulkanTextureSampler& operator=(const VulkanTextureSampler&) = delete;
VulkanTextureSampler& operator=(VulkanTextureSampler&&) = delete; VulkanTextureSampler& operator=(VulkanTextureSampler&&) = delete;

View File

@ -20,6 +20,7 @@ namespace Nz
VulkanWindowFramebuffer(VulkanWindowFramebuffer&&) noexcept = default; VulkanWindowFramebuffer(VulkanWindowFramebuffer&&) noexcept = default;
~VulkanWindowFramebuffer() = default; ~VulkanWindowFramebuffer() = default;
inline Vk::Framebuffer& GetFramebuffer() override;
inline const Vk::Framebuffer& GetFramebuffer() const override; inline const Vk::Framebuffer& GetFramebuffer() const override;
VulkanWindowFramebuffer& operator=(const VulkanWindowFramebuffer&) = delete; VulkanWindowFramebuffer& operator=(const VulkanWindowFramebuffer&) = delete;

View File

@ -13,7 +13,12 @@ namespace Nz
{ {
} }
inline const Vk::Framebuffer& Nz::VulkanWindowFramebuffer::GetFramebuffer() const inline Vk::Framebuffer& VulkanWindowFramebuffer::GetFramebuffer()
{
return m_framebuffer;
}
inline const Vk::Framebuffer& VulkanWindowFramebuffer::GetFramebuffer() const
{ {
return m_framebuffer; return m_framebuffer;
} }

View File

@ -77,6 +77,7 @@ namespace Nz
inline void Free(); inline void Free();
inline VkResult GetLastErrorCode() const;
inline CommandPool& GetPool(); inline CommandPool& GetPool();
inline void ImageBarrier(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkImageLayout oldLayout, VkImageLayout newLayout, VkImage image, VkImageAspectFlags aspectFlags); inline void ImageBarrier(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, VkAccessFlags srcAccessMask, VkAccessFlags dstAccessMask, VkImageLayout oldLayout, VkImageLayout newLayout, VkImage image, VkImageAspectFlags aspectFlags);
@ -104,8 +105,6 @@ namespace Nz
inline void SetImageLayout(VkImage image, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkImageLayout oldImageLayout, VkImageLayout newImageLayout); inline void SetImageLayout(VkImage image, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkImageLayout oldImageLayout, VkImageLayout newImageLayout);
inline void SetImageLayout(VkImage image, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkImageLayout oldImageLayout, VkImageLayout newImageLayout, const VkImageSubresourceRange& subresourceRange); inline void SetImageLayout(VkImage image, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkImageLayout oldImageLayout, VkImageLayout newImageLayout, const VkImageSubresourceRange& subresourceRange);
inline VkResult GetLastErrorCode() const;
CommandBuffer& operator=(const CommandBuffer&) = delete; CommandBuffer& operator=(const CommandBuffer&) = delete;
CommandBuffer& operator=(CommandBuffer&& commandBuffer) noexcept; CommandBuffer& operator=(CommandBuffer&& commandBuffer) noexcept;

View File

@ -345,6 +345,11 @@ namespace Nz
} }
} }
inline VkResult CommandBuffer::GetLastErrorCode() const
{
return m_lastErrorCode;
}
inline CommandPool& CommandBuffer::GetPool() inline CommandPool& CommandBuffer::GetPool()
{ {
return *m_pool; return *m_pool;
@ -586,11 +591,6 @@ namespace Nz
return m_pool->GetDevice()->vkCmdSetViewport(m_handle, firstViewport, viewportCount, viewports); return m_pool->GetDevice()->vkCmdSetViewport(m_handle, firstViewport, viewportCount, viewports);
} }
inline VkResult CommandBuffer::GetLastErrorCode() const
{
return m_lastErrorCode;
}
inline CommandBuffer& CommandBuffer::operator=(CommandBuffer&& commandBuffer) noexcept inline CommandBuffer& CommandBuffer::operator=(CommandBuffer&& commandBuffer) noexcept
{ {
m_lastErrorCode = commandBuffer.m_lastErrorCode; m_lastErrorCode = commandBuffer.m_lastErrorCode;

View File

@ -64,6 +64,10 @@ namespace Nz
inline bool IsExtensionLoaded(const std::string& extensionName); inline bool IsExtensionLoaded(const std::string& extensionName);
inline bool IsLayerLoaded(const std::string& layerName); inline bool IsLayerLoaded(const std::string& layerName);
inline void SetDebugName(VkObjectType objectType, UInt64 objectHandle, const char* name);
inline void SetDebugName(VkObjectType objectType, UInt64 objectHandle, std::string_view name);
inline void SetDebugName(VkObjectType objectType, UInt64 objectHandle, const std::string& name);
inline bool WaitForIdle(); inline bool WaitForIdle();
Device& operator=(const Device&) = delete; Device& operator=(const Device&) = delete;

View File

@ -5,6 +5,7 @@
#include <Nazara/VulkanRenderer/Wrapper/Device.hpp> #include <Nazara/VulkanRenderer/Wrapper/Device.hpp>
#include <Nazara/Core/Error.hpp> #include <Nazara/Core/Error.hpp>
#include <Nazara/Core/ErrorFlags.hpp> #include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Utils/StackArray.hpp>
#include <Nazara/VulkanRenderer/Utils.hpp> #include <Nazara/VulkanRenderer/Utils.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Instance.hpp> #include <Nazara/VulkanRenderer/Wrapper/Instance.hpp>
#include <Nazara/VulkanRenderer/Debug.hpp> #include <Nazara/VulkanRenderer/Debug.hpp>
@ -87,6 +88,40 @@ namespace Nz::Vk
return m_loadedLayers.count(layerName) > 0; return m_loadedLayers.count(layerName) > 0;
} }
inline void Device::SetDebugName(VkObjectType objectType, UInt64 objectHandle, const char* name)
{
if (vkSetDebugUtilsObjectNameEXT)
{
VkDebugUtilsObjectNameInfoEXT debugName = {
VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
nullptr,
objectType,
objectHandle,
name
};
vkSetDebugUtilsObjectNameEXT(m_device, &debugName);
}
}
inline void Device::SetDebugName(VkObjectType objectType, UInt64 objectHandle, std::string_view name)
{
if (vkSetDebugUtilsObjectNameEXT)
{
// Ensure \0 at the end of string
StackArray<char> nullTerminatedName = NazaraStackArrayNoInit(char, name.size() + 1);
std::memcpy(nullTerminatedName.data(), name.data(), name.size());
nullTerminatedName[name.size()] = '\0';
return SetDebugName(objectType, objectHandle, nullTerminatedName.data());
}
}
inline void Device::SetDebugName(VkObjectType objectType, UInt64 objectHandle, const std::string& name)
{
return SetDebugName(objectType, objectHandle, name.data());
}
inline bool Device::WaitForIdle() inline bool Device::WaitForIdle()
{ {
m_lastErrorCode = vkDeviceWaitIdle(m_device); m_lastErrorCode = vkDeviceWaitIdle(m_device);

View File

@ -32,8 +32,7 @@ namespace Nz::Vk
Device* GetDevice() const; Device* GetDevice() const;
VkResult GetLastErrorCode() const; VkResult GetLastErrorCode() const;
void SetDebugName(const char* name); template<typename T> void SetDebugName(T&& name);
void SetDebugName(const std::string& name);
DeviceObject& operator=(const DeviceObject&) = delete; DeviceObject& operator=(const DeviceObject&) = delete;
DeviceObject& operator=(DeviceObject&& object) noexcept; DeviceObject& operator=(DeviceObject&& object) noexcept;

View File

@ -83,31 +83,16 @@ namespace Nz::Vk
} }
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType> template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
void DeviceObject<C, VkType, CreateInfo, ObjectType>::SetDebugName(const char* name) template<typename T>
void DeviceObject<C, VkType, CreateInfo, ObjectType>::SetDebugName(T&& name)
{ {
if (m_device->vkSetDebugUtilsObjectNameEXT) UInt64 objectHandle;
{ if constexpr (std::is_pointer_v<VkType>)
VkDebugUtilsObjectNameInfoEXT debugName = { objectHandle = static_cast<UInt64>(reinterpret_cast<std::uintptr_t>(m_handle));
VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, else
nullptr, objectHandle = static_cast<UInt64>(m_handle);
ObjectType,
0,
name
};
if constexpr (std::is_pointer_v<VkType>) return m_device->SetDebugName(ObjectType, objectHandle, std::forward<T>(name));
debugName.objectHandle = static_cast<UInt64>(reinterpret_cast<std::uintptr_t>(m_handle));
else
debugName.objectHandle = static_cast<UInt64>(m_handle);
m_device->vkSetDebugUtilsObjectNameEXT(*m_device, &debugName);
}
}
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>
void DeviceObject<C, VkType, CreateInfo, ObjectType>::SetDebugName(const std::string& name)
{
return SetDebugName(name.data());
} }
template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType> template<typename C, typename VkType, typename CreateInfo, VkObjectType ObjectType>

View File

@ -9,6 +9,7 @@
#include <Nazara/Prerequisites.hpp> #include <Nazara/Prerequisites.hpp>
#include <Nazara/VulkanRenderer/Wrapper/DeviceObject.hpp> #include <Nazara/VulkanRenderer/Wrapper/DeviceObject.hpp>
#include <string_view>
namespace Nz namespace Nz
{ {
@ -29,6 +30,8 @@ namespace Nz
inline Device& GetDevice() const; inline Device& GetDevice() const;
inline VkResult GetLastErrorCode() const; inline VkResult GetLastErrorCode() const;
inline void SetDebugName(std::string_view name);
Pipeline& operator=(const Pipeline&) = delete; Pipeline& operator=(const Pipeline&) = delete;
Pipeline& operator=(Pipeline&&) = delete; Pipeline& operator=(Pipeline&&) = delete;

View File

@ -4,6 +4,7 @@
#include <Nazara/VulkanRenderer/Wrapper/Pipeline.hpp> #include <Nazara/VulkanRenderer/Wrapper/Pipeline.hpp>
#include <Nazara/VulkanRenderer/Utils.hpp> #include <Nazara/VulkanRenderer/Utils.hpp>
#include <Nazara/Utils/StackArray.hpp>
#include <Nazara/VulkanRenderer/Debug.hpp> #include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz namespace Nz
@ -58,6 +59,11 @@ namespace Nz
return m_lastErrorCode; return m_lastErrorCode;
} }
inline void Pipeline::SetDebugName(std::string_view name)
{
return m_device->SetDebugName(VK_OBJECT_TYPE_PIPELINE, static_cast<UInt64>(reinterpret_cast<std::uintptr_t>(m_handle)), name);
}
inline Pipeline::operator VkPipeline() const inline Pipeline::operator VkPipeline() const
{ {
return m_handle; return m_handle;

View File

@ -157,6 +157,8 @@ namespace Nz
textureCreationParams.pixelFormat = textureData.format; textureCreationParams.pixelFormat = textureData.format;
textureData.texture = renderDevice->InstantiateTexture(textureCreationParams); textureData.texture = renderDevice->InstantiateTexture(textureCreationParams);
if (!textureData.name.empty())
textureData.texture->UpdateDebugName(textureData.name);
} }
std::vector<std::shared_ptr<Texture>> textures; std::vector<std::shared_ptr<Texture>> textures;
@ -181,6 +183,9 @@ namespace Nz
passData.renderRect.Set(0, 0, int(framebufferWidth), int(framebufferHeight)); passData.renderRect.Set(0, 0, int(framebufferWidth), int(framebufferHeight));
passData.framebuffer = renderDevice->InstantiateFramebuffer(framebufferWidth, framebufferHeight, passData.renderPass, textures); passData.framebuffer = renderDevice->InstantiateFramebuffer(framebufferWidth, framebufferHeight, passData.renderPass, textures);
if (!passData.name.empty())
passData.framebuffer->UpdateDebugName(passData.name);
passData.forceCommandBufferRegeneration = true; passData.forceCommandBufferRegeneration = true;
} }

View File

@ -113,6 +113,7 @@ namespace Nz
for (auto& texture : m_pending.textures) for (auto& texture : m_pending.textures)
{ {
auto& bakedTexture = bakedTextures.emplace_back(); auto& bakedTexture = bakedTextures.emplace_back();
bakedTexture.name = std::move(texture.name);
bakedTexture.format = texture.format; bakedTexture.format = texture.format;
bakedTexture.height = texture.height; bakedTexture.height = texture.height;
bakedTexture.usage = texture.usage; bakedTexture.usage = texture.usage;
@ -161,7 +162,7 @@ namespace Nz
if (currentPass.name.empty()) if (currentPass.name.empty())
currentPass.name = pass.GetName(); currentPass.name = pass.GetName();
else else
currentPass.name += " + " + pass.GetName(); currentPass.name += " / " + pass.GetName();
auto& subpass = currentPass.passes.emplace_back(); auto& subpass = currentPass.passes.emplace_back();
subpass.passIndex = *it; subpass.passIndex = *it;
@ -957,6 +958,9 @@ namespace Nz
m_pending.texturePool.erase(it); m_pending.texturePool.erase(it);
m_pending.attachmentToTextures.emplace(attachmentIndex, textureId); m_pending.attachmentToTextures.emplace(attachmentIndex, textureId);
if (!attachmentData.name.empty() && data.name != attachmentData.name)
data.name += " / " + attachmentData.name;
return textureId; return textureId;
} }
@ -964,6 +968,7 @@ namespace Nz
m_pending.attachmentToTextures.emplace(attachmentIndex, textureId); m_pending.attachmentToTextures.emplace(attachmentIndex, textureId);
TextureData& data = m_pending.textures.emplace_back(); TextureData& data = m_pending.textures.emplace_back();
data.name = attachmentData.name;
data.format = attachmentData.format; data.format = attachmentData.format;
data.width = attachmentData.width; data.width = attachmentData.width;
data.height = attachmentData.height; data.height = attachmentData.height;

View File

@ -62,4 +62,9 @@ namespace Nz
{ {
return m_buffer.Unmap(); return m_buffer.Unmap();
} }
void OpenGLBuffer::UpdateDebugName(std::string_view name)
{
m_buffer.SetDebugName(name);
}
} }

View File

@ -321,6 +321,11 @@ namespace Nz
} }
} }
void OpenGLCommandBuffer::UpdateDebugName(std::string_view name)
{
// No OpenGL object to name
}
void OpenGLCommandBuffer::ApplyStates(const GL::Context& context, const DrawStates& states) void OpenGLCommandBuffer::ApplyStates(const GL::Context& context, const DrawStates& states)
{ {
states.pipeline->Apply(context, states.shouldFlipY); states.pipeline->Apply(context, states.shouldFlipY);

View File

@ -36,6 +36,11 @@ namespace Nz
return commandBuffer; return commandBuffer;
} }
void OpenGLCommandPool::UpdateDebugName(std::string_view name)
{
// No OpenGL object to name
}
auto OpenGLCommandPool::AllocatePool() -> CommandPool& auto OpenGLCommandPool::AllocatePool() -> CommandPool&
{ {
constexpr UInt32 MaxSet = 128; constexpr UInt32 MaxSet = 128;

View File

@ -103,4 +103,9 @@ namespace Nz
{ {
return m_size; return m_size;
} }
void OpenGLFboFramebuffer::UpdateDebugName(std::string_view name)
{
m_framebuffer.SetDebugName(name);
}
} }

View File

@ -7,4 +7,8 @@
namespace Nz namespace Nz
{ {
void OpenGLRenderPass::UpdateDebugName(std::string_view name)
{
// No OpenGL object to name
}
} }

View File

@ -103,4 +103,9 @@ namespace Nz
m_isViewportFlipped = flipViewport; m_isViewportFlipped = flipViewport;
} }
} }
void OpenGLRenderPipeline::UpdateDebugName(std::string_view name)
{
m_program.SetDebugName(name);
}
} }

View File

@ -59,6 +59,11 @@ namespace Nz
return bindingPtr; return bindingPtr;
} }
void OpenGLRenderPipelineLayout::UpdateDebugName(std::string_view name)
{
// No OpenGL object to name
}
auto OpenGLRenderPipelineLayout::AllocatePool() -> DescriptorPool& auto OpenGLRenderPipelineLayout::AllocatePool() -> DescriptorPool&
{ {
constexpr UInt32 MaxSet = 128; constexpr UInt32 MaxSet = 128;

View File

@ -132,6 +132,11 @@ namespace Nz
} }
} }
void OpenGLShaderBinding::UpdateDebugName(std::string_view name)
{
// No OpenGL object to name
}
void OpenGLShaderBinding::Release() void OpenGLShaderBinding::Release()
{ {
m_owner.Release(*this); m_owner.Release(*this);

View File

@ -113,6 +113,9 @@ namespace Nz
if (!shader.Create(m_device, ToOpenGL(shaderEntry.stage))) if (!shader.Create(m_device, ToOpenGL(shaderEntry.stage)))
throw std::runtime_error("failed to create shader"); //< TODO: Handle error message throw std::runtime_error("failed to create shader"); //< TODO: Handle error message
if (!m_debugName.empty())
shader.SetDebugName(m_debugName);
std::visit([&](auto&& arg) std::visit([&](auto&& arg)
{ {
using T = std::decay_t<decltype(arg)>; using T = std::decay_t<decltype(arg)>;
@ -161,6 +164,11 @@ namespace Nz
return stageFlags; return stageFlags;
} }
void OpenGLShaderModule::UpdateDebugName(std::string_view name)
{
m_debugName = name;
}
void OpenGLShaderModule::Create(OpenGLDevice& /*device*/, nzsl::ShaderStageTypeFlags shaderStages, const nzsl::Ast::Module& shaderModule, const nzsl::ShaderWriter::States& states) void OpenGLShaderModule::Create(OpenGLDevice& /*device*/, nzsl::ShaderStageTypeFlags shaderStages, const nzsl::Ast::Module& shaderModule, const nzsl::ShaderWriter::States& states)
{ {
m_states = states; m_states = states;

View File

@ -145,4 +145,9 @@ namespace Nz
return true; return true;
} }
void OpenGLTexture::UpdateDebugName(std::string_view name)
{
m_texture.SetDebugName(name);
}
} }

View File

@ -37,4 +37,10 @@ namespace Nz
if (samplerInfo.anisotropyLevel > 1.f) if (samplerInfo.anisotropyLevel > 1.f)
sampler.SetParameterf(GL_TEXTURE_MAX_ANISOTROPY_EXT, samplerInfo.anisotropyLevel); sampler.SetParameterf(GL_TEXTURE_MAX_ANISOTROPY_EXT, samplerInfo.anisotropyLevel);
} }
void OpenGLTextureSampler::UpdateDebugName(std::string_view name)
{
m_samplerWithMipmaps.SetDebugName(name);
m_samplerWithoutMipmaps.SetDebugName(name);
}
} }

View File

@ -27,4 +27,9 @@ namespace Nz
{ {
return m_renderWindow.GetSize(); return m_renderWindow.GetSize();
} }
void OpenGLWindowFramebuffer::UpdateDebugName(std::string_view name)
{
// No OpenGL object to name
}
} }

View File

@ -52,6 +52,8 @@ namespace Nz
} }
texture->SetFilePath(image.GetFilePath()); texture->SetFilePath(image.GetFilePath());
if (std::string debugName = image.GetFilePath().generic_u8string(); !debugName.empty())
texture->UpdateDebugName(debugName);
return texture; return texture;
} }

View File

@ -136,6 +136,11 @@ namespace Nz
return true; 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) #if defined(NAZARA_PLATFORM_WINDOWS)

View File

@ -8,6 +8,11 @@
namespace Nz 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() void VulkanCommandBuffer::Release()
{ {
m_owner.Release(*this); m_owner.Release(*this);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -339,6 +339,11 @@ namespace Nz
return true; 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) void VulkanTexture::InitForFormat(PixelFormat pixelFormat, VkImageCreateInfo& createImage, VkImageViewCreateInfo& createImageView)
{ {
createImageView.components = { createImageView.components = {

View File

@ -32,6 +32,11 @@ namespace Nz
if (!m_sampler.Create(device, createInfo)) if (!m_sampler.Create(device, createInfo))
throw std::runtime_error("Failed to create sampler: " + TranslateVulkanError(m_sampler.GetLastErrorCode())); 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) #if defined(NAZARA_PLATFORM_WINDOWS)