fixing release compilation issue

This commit is contained in:
2024-09-21 12:56:21 +02:00
parent 904b6d31ac
commit ad35eee0b6
8 changed files with 36 additions and 39 deletions

View File

@@ -13,7 +13,7 @@ namespace mlx
#ifdef DEBUG
auto res = m_textures.try_emplace(z, CPUBuffer{}, swapchain_extent.width, swapchain_extent.height, VK_FORMAT_R8G8B8A8_SRGB, false, "mlx_put_pixel_layer_" + std::to_string(z));
#else
auto res = m_textures.try_emplace(z, CPUBuffer{}, swapchain_extent.width, swapchain_extent.height, VK_FORMAT_R8G8B8A8_SRGB, false, {});
auto res = m_textures.try_emplace(z, CPUBuffer{}, swapchain_extent.width, swapchain_extent.height, VK_FORMAT_R8G8B8A8_SRGB, false, std::string_view{});
#endif
res.first->second.SetPixel(x, y, color);
return (res.second ? &res.first->second : nullptr);

View File

@@ -4,7 +4,7 @@
namespace mlx
{
void GPUBuffer::Init(BufferType type, VkDeviceSize size, VkBufferUsageFlags usage, CPUBuffer data, std::string_view debug_name)
void GPUBuffer::Init(BufferType type, VkDeviceSize size, VkBufferUsageFlags usage, CPUBuffer data, [[maybe_unused]] std::string_view debug_name)
{
MLX_PROFILE_FUNCTION();
VmaAllocationCreateInfo alloc_info{};
@@ -36,7 +36,7 @@ namespace mlx
PushToGPU();
}
void GPUBuffer::CreateBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VmaAllocationCreateInfo alloc_info, std::string_view debug_name)
void GPUBuffer::CreateBuffer(VkDeviceSize size, VkBufferUsageFlags usage, VmaAllocationCreateInfo alloc_info, [[maybe_unused]] std::string_view debug_name)
{
MLX_PROFILE_FUNCTION();
VkBufferCreateInfo bufferInfo{};
@@ -183,7 +183,7 @@ namespace mlx
staging.Destroy();
}
void UniformBuffer::Init(std::uint32_t size, std::string_view debug_name)
void UniformBuffer::Init(std::uint32_t size, [[maybe_unused]] std::string_view debug_name)
{
MLX_PROFILE_FUNCTION();
for(int i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)

View File

@@ -15,7 +15,7 @@
namespace mlx
{
void Image::Init(ImageType type, std::uint32_t width, std::uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, bool is_multisampled, std::string_view debug_name)
void Image::Init(ImageType type, std::uint32_t width, std::uint32_t height, VkFormat format, VkImageTiling tiling, VkImageUsageFlags usage, bool is_multisampled, [[maybe_unused]] std::string_view debug_name)
{
MLX_PROFILE_FUNCTION();
m_type = type;
@@ -56,16 +56,13 @@ namespace mlx
{
MLX_PROFILE_FUNCTION();
m_image_view = kvfCreateImageView(RenderCore::Get().GetDevice(), m_image, m_format, type, aspect_flags, layer_count);
#ifdef DEBUG
if constexpr(RenderCore::HAS_DEBUG_UTILS_FUNCTIONS)
{
VkDebugUtilsObjectNameInfoEXT name_info{};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
name_info.objectType = VK_OBJECT_TYPE_IMAGE_VIEW;
name_info.objectHandle = reinterpret_cast<std::uint64_t>(m_image_view);
name_info.pObjectName = m_debug_name.c_str();
RenderCore::Get().vkSetDebugUtilsObjectNameEXT(RenderCore::Get().GetDevice(), &name_info);
}
#ifdef MLX_HAS_DEBUG_UTILS_FUNCTIONS
VkDebugUtilsObjectNameInfoEXT name_info{};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
name_info.objectType = VK_OBJECT_TYPE_IMAGE_VIEW;
name_info.objectHandle = reinterpret_cast<std::uint64_t>(m_image_view);
name_info.pObjectName = m_debug_name.c_str();
RenderCore::Get().vkSetDebugUtilsObjectNameEXT(RenderCore::Get().GetDevice(), &name_info);
#endif
}
@@ -154,7 +151,7 @@ namespace mlx
m_image = VK_NULL_HANDLE;
}
void Texture::Init(CPUBuffer pixels, std::uint32_t width, std::uint32_t height, VkFormat format, bool is_multisampled, std::string_view debug_name)
void Texture::Init(CPUBuffer pixels, std::uint32_t width, std::uint32_t height, VkFormat format, bool is_multisampled, [[maybe_unused]] std::string_view debug_name)
{
MLX_PROFILE_FUNCTION();
Image::Init(ImageType::Color, width, height, format, VK_IMAGE_TILING_OPTIMAL, VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, is_multisampled, std::move(debug_name));
@@ -229,7 +226,11 @@ namespace mlx
#endif
m_staging_buffer.emplace();
std::size_t size = m_width * m_height * kvfFormatSize(m_format);
m_staging_buffer->Init(BufferType::Staging, size, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, {}, m_debug_name);
#ifdef DEBUG
m_staging_buffer->Init(BufferType::Staging, size, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, {}, m_debug_name);
#else
m_staging_buffer->Init(BufferType::Staging, size, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, {}, {});
#endif
VkImageLayout old_layout = m_layout;
VkCommandBuffer cmd = kvfCreateCommandBuffer(RenderCore::Get().GetDevice());

View File

@@ -64,15 +64,14 @@ namespace mlx
kvfCheckVk(vmaCreateBuffer(m_allocator, binfo, vinfo, &buffer, &allocation, nullptr));
if(name != nullptr)
{
if constexpr(RenderCore::HAS_DEBUG_UTILS_FUNCTIONS)
{
#ifdef MLX_HAS_DEBUG_UTILS_FUNCTIONS
VkDebugUtilsObjectNameInfoEXT name_info{};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
name_info.objectType = VK_OBJECT_TYPE_BUFFER;
name_info.objectHandle = reinterpret_cast<std::uint64_t>(buffer);
name_info.pObjectName = name;
RenderCore::Get().vkSetDebugUtilsObjectNameEXT(RenderCore::Get().GetDevice(), &name_info);
}
#endif
vmaSetAllocationName(m_allocator, allocation, name);
}
DebugLog("Graphics Allocator : created new buffer '%'", name);
@@ -99,15 +98,14 @@ namespace mlx
kvfCheckVk(vmaCreateImage(m_allocator, iminfo, vinfo, &image, &allocation, nullptr));
if(name != nullptr)
{
if constexpr(RenderCore::HAS_DEBUG_UTILS_FUNCTIONS)
{
#ifdef MLX_HAS_DEBUG_UTILS_FUNCTIONS
VkDebugUtilsObjectNameInfoEXT name_info{};
name_info.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
name_info.objectType = VK_OBJECT_TYPE_IMAGE;
name_info.objectHandle = reinterpret_cast<std::uint64_t>(image);
name_info.pObjectName = name;
RenderCore::Get().vkSetDebugUtilsObjectNameEXT(RenderCore::Get().GetDevice(), &name_info);
}
#endif
vmaSetAllocationName(m_allocator, allocation, name);
}
DebugLog("Graphics Allocator : created new image '%'", name);