From 72169d31c7f8a8e1f0a011e45b19ea7710eef985 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Sun, 23 Dec 2018 23:20:10 -0800 Subject: Fixed multiple unused variable warnings in clang release build --- .../src/CommandQueueVkImpl.cpp | 4 +- .../src/DeviceContextVkImpl.cpp | 6 +- Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp | 4 +- .../GraphicsEngineVulkan/src/FramebufferCache.cpp | 2 +- .../GraphicsEngineVulkan/src/PipelineLayout.cpp | 2 +- .../src/RenderDeviceVkImpl.cpp | 4 +- .../src/ShaderResourceLayoutVk.cpp | 6 +- .../GraphicsEngineVulkan/src/SwapChainVkImpl.cpp | 2 +- .../GraphicsEngineVulkan/src/TextureVkImpl.cpp | 10 +- .../GraphicsEngineVulkan/src/VulkanUploadHeap.cpp | 2 +- .../VulkanUtilities/VulkanCommandBufferPool.cpp | 4 +- .../src/VulkanUtilities/VulkanDebug.cpp | 1100 ++++++++++---------- .../src/VulkanUtilities/VulkanFencePool.cpp | 2 + .../src/VulkanUtilities/VulkanLogicalDevice.cpp | 6 +- .../src/VulkanUtilities/VulkanPhysicalDevice.cpp | 6 +- 15 files changed, 583 insertions(+), 577 deletions(-) (limited to 'Graphics/GraphicsEngineVulkan') diff --git a/Graphics/GraphicsEngineVulkan/src/CommandQueueVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/CommandQueueVkImpl.cpp index 5dd6b813..1d7937a8 100644 --- a/Graphics/GraphicsEngineVulkan/src/CommandQueueVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/CommandQueueVkImpl.cpp @@ -64,7 +64,7 @@ Uint64 CommandQueueVkImpl::Submit(const VkSubmitInfo& SubmitInfo) SubmitInfo.signalSemaphoreCount != 0) ? 1 : 0; auto err = vkQueueSubmit(m_VkQueue, SubmitCount, &SubmitInfo, vkFence); - DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to submit command buffer to the command queue"); + DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to submit command buffer to the command queue"); (void)err; // We must atomically place the (value, fence) pair into the deque m_pFence->AddPendingFence(std::move(vkFence), FenceValue); @@ -116,7 +116,7 @@ void CommandQueueVkImpl::SignalFence(VkFence vkFence) { std::lock_guard Lock(m_QueueMutex); auto err = vkQueueSubmit(m_VkQueue, 0, nullptr, vkFence); - DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to submit command buffer to the command queue"); + DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to submit command buffer to the command queue"); (void)err; } VkResult CommandQueueVkImpl::Present(const VkPresentInfoKHR& PresentInfo) diff --git a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp index 67fa2840..5f045392 100644 --- a/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/DeviceContextVkImpl.cpp @@ -1676,13 +1676,13 @@ namespace Diligent auto vkCmdBuff = m_CommandBuffer.GetVkCmdBuffer(); auto err = vkEndCommandBuffer(vkCmdBuff); - DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to end command buffer"); + DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to end command buffer"); (void)err; auto* pDeviceVkImpl = m_pDevice.RawPtr(); CommandListVkImpl *pCmdListVk( NEW_RC_OBJ(m_CmdListAllocator, "CommandListVkImpl instance", CommandListVkImpl) (pDeviceVkImpl, this, vkCmdBuff) ); pCmdListVk->QueryInterface( IID_CommandList, reinterpret_cast(ppCommandList) ); - + m_CommandBuffer.Reset(); m_State = ContextState{}; m_DescrSetBindInfo.Reset(); @@ -1700,7 +1700,7 @@ namespace Diligent } Flush(); - + InvalidateState(); CommandListVkImpl* pCmdListVk = ValidatedCast(pCommandList); diff --git a/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp index 424bfb4e..a7e2f7ea 100644 --- a/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/FenceVkImpl.cpp @@ -87,11 +87,11 @@ void FenceVkImpl :: Wait() { VkFence FenceToWait = val_fence.second; auto res = LogicalDevice.WaitForFences(1, &FenceToWait, VK_TRUE, UINT64_MAX); - VERIFY_EXPR(res == VK_SUCCESS); + VERIFY_EXPR(res == VK_SUCCESS); (void)res; } auto status = LogicalDevice.GetFenceStatus(val_fence.second); - VERIFY(status == VK_SUCCESS, "All pending fences must now be complete!"); + DEV_CHECK_ERR(status == VK_SUCCESS, "All pending fences must now be complete!"); (void)status; if (val_fence.first > m_LastCompletedFenceValue) m_LastCompletedFenceValue = val_fence.first; m_FencePool.DisposeFence(std::move(val_fence.second)); diff --git a/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp b/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp index 626420cb..44175264 100644 --- a/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp +++ b/Graphics/GraphicsEngineVulkan/src/FramebufferCache.cpp @@ -90,7 +90,7 @@ VkFramebuffer FramebufferCache::GetFramebuffer(const FramebufferCacheKey& Key, u VkFramebuffer fb = Framebuffer; auto new_it = m_Cache.insert(std::make_pair(Key, std::move(Framebuffer))); - VERIFY(new_it.second, "New framebuffer must be inserted into the map"); + VERIFY(new_it.second, "New framebuffer must be inserted into the map"); (void)new_it; m_RenderPassToKeyMap.emplace(Key.Pass, Key); if (Key.DSV != VK_NULL_HANDLE) diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp index 8b973f7c..936419d6 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineLayout.cpp @@ -516,7 +516,7 @@ void PipelineLayout::BindDescriptorSetsWithDynamicOffsets(DeviceContextVkImpl* #endif auto NumOffsetsWritten = BindInfo.pResourceCache->GetDynamicBufferOffsets(pCtxVkImpl, BindInfo.DynamicOffsets); - VERIFY_EXPR(NumOffsetsWritten == BindInfo.DynamicOffsetCount); + VERIFY_EXPR(NumOffsetsWritten == BindInfo.DynamicOffsetCount); (void)NumOffsetsWritten; auto& CmdBuffer = pCtxVkImpl->GetCommandBuffer(); // vkCmdBindDescriptorSets causes the sets numbered [firstSet .. firstSet+descriptorSetCount-1] to use the diff --git a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp index 2d807d62..6aa8db27 100644 --- a/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/RenderDeviceVkImpl.cpp @@ -181,7 +181,7 @@ void RenderDeviceVkImpl::AllocateTransientCmdPool(VulkanUtilities::CommandPoolWr // and recorded again between each submission. CmdBuffBeginInfo.pInheritanceInfo = nullptr; // Ignored for a primary command buffer auto err = vkBeginCommandBuffer(vkCmdBuff, &CmdBuffBeginInfo); - DEV_CHECK_ERR(err == VK_SUCCESS, "vkBeginCommandBuffer() failed"); + DEV_CHECK_ERR(err == VK_SUCCESS, "vkBeginCommandBuffer() failed"); (void)err; } @@ -190,7 +190,7 @@ void RenderDeviceVkImpl::ExecuteAndDisposeTransientCmdBuff(Uint32 QueueIndex, Vk VERIFY_EXPR(vkCmdBuff != VK_NULL_HANDLE); auto err = vkEndCommandBuffer(vkCmdBuff); - DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to end command buffer"); + DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to end command buffer"); (void)err; VkSubmitInfo SubmitInfo = {}; SubmitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; diff --git a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp index f4a28167..48711136 100644 --- a/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp +++ b/Graphics/GraphicsEngineVulkan/src/ShaderResourceLayoutVk.cpp @@ -59,11 +59,11 @@ void ShaderResourceLayoutVk::AllocateMemory(std::shared_ptrProcessResources( AllowedVarTypes, NumAllowedTypes, diff --git a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp index d7434bae..ad9b4a27 100644 --- a/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/SwapChainVkImpl.cpp @@ -406,7 +406,7 @@ void SwapChainVkImpl::AcquireNextImage(DeviceContextVkImpl* pDeviceCtxVk) const auto& LogicalDevice = pDeviceVk->GetLogicalDevice(); auto res = vkAcquireNextImageKHR(LogicalDevice.GetVkDevice(), m_VkSwapChain, UINT64_MAX, m_ImageAcquiredSemaphores[m_SemaphoreIndex], (VkFence)nullptr, &m_BackBufferIndex); - VERIFY(res == VK_SUCCESS, "Failed to acquire next swap chain image"); + VERIFY(res == VK_SUCCESS, "Failed to acquire next swap chain image"); (void)res; // Next command in the device context must wait for the next image to be acquired // Unlike fences or events, the act of waiting for a semaphore also unsignals that semaphore (6.4.2) diff --git a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp index 7f04d036..97b9c63b 100644 --- a/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/TextureVkImpl.cpp @@ -208,13 +208,13 @@ TextureVkImpl :: TextureVkImpl(IReferenceCounters* pRefCounters, { for(Uint32 mip = 0; mip < ImageCI.mipLevels; ++mip) { - const auto &SubResData = InitData.pSubResources[subres]; - auto &CopyRegion = Regions[subres]; + const auto& SubResData = InitData.pSubResources[subres]; (void)SubResData; + auto& CopyRegion = Regions[subres]; auto MipWidth = std::max(m_Desc.Width >> mip, 1u); auto MipHeight = std::max(m_Desc.Height >> mip, 1u); auto MipDepth = (m_Desc.Type == RESOURCE_DIM_TEX_3D) ? std::max(m_Desc.Depth >> mip, 1u) : 1u; - + CopyRegion.bufferOffset = uploadBufferSize; // offset in bytes from the start of the buffer object // bufferRowLength and bufferImageHeight specify the data in buffer memory as a subregion // of a larger two- or three-dimensional image, and control the addressing calculations of @@ -225,7 +225,7 @@ TextureVkImpl :: TextureVkImpl(IReferenceCounters* pRefCounters, // For block-compression formats, all parameters are still specified in texels rather than compressed texel blocks (18.4.1) CopyRegion.imageOffset = VkOffset3D{0, 0, 0}; CopyRegion.imageExtent = VkExtent3D{MipWidth, MipHeight, MipDepth}; - + CopyRegion.imageSubresource.aspectMask = aspectMask; CopyRegion.imageSubresource.mipLevel = mip; CopyRegion.imageSubresource.baseArrayLayer = layer; @@ -246,7 +246,7 @@ TextureVkImpl :: TextureVkImpl(IReferenceCounters* pRefCounters, auto MipSize = RowSize * MipHeight * MipDepth; VERIFY(SubResData.Stride == 0 || SubResData.Stride >= RowSize, "Stride is too small"); VERIFY(SubResData.DepthStride == 0 || SubResData.DepthStride >= RowSize * MipHeight, "Depth stride is too small"); - + // bufferOffset must be a multiple of 4 (18.4) // If the calling command's VkImage parameter is a compressed image, bufferOffset // must be a multiple of the compressed texel block size in bytes (18.4). This diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUploadHeap.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUploadHeap.cpp index 90c0c16d..c7f32e16 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUploadHeap.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUploadHeap.cpp @@ -75,7 +75,7 @@ VulkanUploadHeap::UploadPageInfo VulkanUploadHeap::CreateNewPage(VkDeviceSize Si auto AlignedOffset = (MemAllocation.UnalignedOffset + (MemReqs.alignment-1)) & ~(MemReqs.alignment-1); auto err = LogicalDevice.BindBufferMemory(NewBuffer, MemAllocation.Page->GetVkMemory(), AlignedOffset); - DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to bind buffer memory"); + DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to bind buffer memory"); (void)err; auto CPUAddress = reinterpret_cast(MemAllocation.Page->GetCPUMemory()) + AlignedOffset; return UploadPageInfo{std::move(MemAllocation), std::move(NewBuffer), CPUAddress}; diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp index 692fbcfd..240fc871 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanCommandBufferPool.cpp @@ -67,7 +67,7 @@ namespace VulkanUtilities 0 // VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT - specifies that most or all memory resources currently // owned by the command buffer should be returned to the parent command pool. ); - DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to reset command buffer"); + DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to reset command buffer"); (void)err; m_CmdBuffers.pop_front(); } } @@ -94,7 +94,7 @@ namespace VulkanUtilities // and recorded again between each submission. CmdBuffBeginInfo.pInheritanceInfo = nullptr; // Ignored for a primary command buffer auto err = vkBeginCommandBuffer(CmdBuffer, &CmdBuffBeginInfo); - DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to begin command buffer"); + DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to begin command buffer"); (void)err; #ifdef DEVELOPMENT ++m_BuffCounter; #endif diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp index bd72879f..b4861590 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanDebug.cpp @@ -1,264 +1,266 @@ -/* -* Vulkan examples debug wrapper -* -* Appendix for VK_EXT_Debug_Report can be found at https://github.com/KhronosGroup/Vulkan-Docs/blob/1.0-VK_EXT_debug_report/doc/specs/vulkan/appendices/debug_report.txt -* -* Copyright (C) 2016 by Sascha Willems - www.saschawillems.de -* -* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) -*/ - -#include - -#include "VulkanUtilities/VulkanDebug.h" -#include "Errors.h" -#include "DebugUtilities.h" - -namespace VulkanUtilities -{ - static PFN_vkCreateDebugUtilsMessengerEXT CreateDebugUtilsMessengerEXT = nullptr; - static PFN_vkDestroyDebugUtilsMessengerEXT DestroyDebugUtilsMessengerEXT = nullptr; - static PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT = nullptr; - static PFN_vkSetDebugUtilsObjectTagEXT SetDebugUtilsObjectTagEXT = nullptr; - static PFN_vkQueueBeginDebugUtilsLabelEXT QueueBeginDebugUtilsLabelEXT = nullptr; - static PFN_vkQueueEndDebugUtilsLabelEXT QueueEndDebugUtilsLabelEXT = nullptr; - static PFN_vkQueueInsertDebugUtilsLabelEXT QueueInsertDebugUtilsLabelEXT = nullptr; - static PFN_vkCmdBeginDebugUtilsLabelEXT CmdBeginDebugUtilsLabelEXT = nullptr; - static PFN_vkCmdEndDebugUtilsLabelEXT CmdEndDebugUtilsLabelEXT = nullptr; - static PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT = nullptr; - - static VkDebugUtilsMessengerEXT DbgMessenger = VK_NULL_HANDLE; - - VKAPI_ATTR VkBool32 VKAPI_CALL DebugMessengerCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, - VkDebugUtilsMessageTypeFlagsEXT messageType, - const VkDebugUtilsMessengerCallbackDataEXT* callbackData, - void* userData) - { - std::stringstream debugMessage; - - // Ignore the following performance warnings: - // 64: vkCmdClearAttachments() issued on command buffer object 0x... prior to any Draw Cmds. It is recommended you use RenderPass LOAD_OP_CLEAR on Attachments prior to any Draw. - // 26: Vertex buffers are bound to command buffer (0x...) but no vertex buffers are attached to this Pipeline State Object (0x...). - if ((messageType & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) && - (callbackData->messageIdNumber == 64 || callbackData->messageIdNumber == 26)) - return VK_FALSE; - - debugMessage << "Vulkan debug message ("; - - Diligent::DebugMessageSeverity MsgSeverity = Diligent::DebugMessageSeverity::Info; - if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT) - { - debugMessage << "verbose"; - MsgSeverity = Diligent::DebugMessageSeverity::Info; - } - else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT) - { - debugMessage << "info"; - MsgSeverity = Diligent::DebugMessageSeverity::Info; - } - else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) - { - debugMessage << "WARNING"; - MsgSeverity = Diligent::DebugMessageSeverity::Warning; - } - else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) - { - debugMessage << "ERROR"; - MsgSeverity = Diligent::DebugMessageSeverity::Error; - } - else - { - debugMessage << "unknown severity"; - MsgSeverity = Diligent::DebugMessageSeverity::Info; - } - - if (messageType & VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT) - debugMessage << ", general"; - if (messageType & VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT) - debugMessage << ", validation"; - if (messageType & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) - debugMessage << ", perf"; - - debugMessage << "): " << "Message Id: " << callbackData->messageIdNumber; - if (callbackData->pMessageIdName != nullptr) - { - debugMessage << " | Message Name: " << callbackData->pMessageIdName; - } - if (callbackData->pMessage != nullptr) - { - debugMessage << std::endl << " " << callbackData->pMessage; - } - - if (callbackData->objectCount > 0) - { - for (uint32_t obj = 0; obj < callbackData->objectCount; ++obj) - { - const auto& Object = callbackData->pObjects[obj]; - debugMessage << std::endl << " Object[" << obj << "] (" << VkObjectTypeToString(Object.objectType) - << "): Handle " << std::hex << "0x" << Object.objectHandle; - if (Object.pObjectName != nullptr) - { - debugMessage << ", Name: '" << Object.pObjectName << '\''; - } - } - } - - if (callbackData->cmdBufLabelCount > 0) - { - for (uint32_t l = 0; l < callbackData->cmdBufLabelCount; ++l) - { - const auto& Label = callbackData->pCmdBufLabels[l]; - debugMessage << std::endl << " Label[" << l << "]"; - if (Label.pLabelName != nullptr) - { - debugMessage << " - " << Label.pLabelName; - } - debugMessage << " {"; - debugMessage << std::fixed << std::setw(4) << Label.color[0] << ", " - << std::fixed << std::setw(4) << Label.color[1] << ", " - << std::fixed << std::setw(4) << Label.color[2] << ", " - << std::fixed << std::setw(4) << Label.color[3] << "}"; - } - } - - LOG_DEBUG_MESSAGE(MsgSeverity, debugMessage.str().c_str()); - - // The return value of this callback controls wether the Vulkan call that caused - // the validation message will be aborted or not - // We return VK_FALSE as we DON'T want Vulkan calls that cause a validation message - // (and return a VkResult) to abort - return VK_FALSE; - } - void SetupDebugging(VkInstance instance, +/* +* Vulkan examples debug wrapper +* +* Appendix for VK_EXT_Debug_Report can be found at https://github.com/KhronosGroup/Vulkan-Docs/blob/1.0-VK_EXT_debug_report/doc/specs/vulkan/appendices/debug_report.txt +* +* Copyright (C) 2016 by Sascha Willems - www.saschawillems.de +* +* This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT) +*/ + +#include + +#include "VulkanUtilities/VulkanDebug.h" +#include "Errors.h" +#include "DebugUtilities.h" + +namespace VulkanUtilities +{ + static PFN_vkCreateDebugUtilsMessengerEXT CreateDebugUtilsMessengerEXT = nullptr; + static PFN_vkDestroyDebugUtilsMessengerEXT DestroyDebugUtilsMessengerEXT = nullptr; + static PFN_vkSetDebugUtilsObjectNameEXT SetDebugUtilsObjectNameEXT = nullptr; + static PFN_vkSetDebugUtilsObjectTagEXT SetDebugUtilsObjectTagEXT = nullptr; + static PFN_vkQueueBeginDebugUtilsLabelEXT QueueBeginDebugUtilsLabelEXT = nullptr; + static PFN_vkQueueEndDebugUtilsLabelEXT QueueEndDebugUtilsLabelEXT = nullptr; + static PFN_vkQueueInsertDebugUtilsLabelEXT QueueInsertDebugUtilsLabelEXT = nullptr; + static PFN_vkCmdBeginDebugUtilsLabelEXT CmdBeginDebugUtilsLabelEXT = nullptr; + static PFN_vkCmdEndDebugUtilsLabelEXT CmdEndDebugUtilsLabelEXT = nullptr; + static PFN_vkCmdInsertDebugUtilsLabelEXT CmdInsertDebugUtilsLabelEXT = nullptr; + + static VkDebugUtilsMessengerEXT DbgMessenger = VK_NULL_HANDLE; + + VKAPI_ATTR VkBool32 VKAPI_CALL DebugMessengerCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, + VkDebugUtilsMessageTypeFlagsEXT messageType, + const VkDebugUtilsMessengerCallbackDataEXT* callbackData, + void* userData) + { + std::stringstream debugMessage; + + // Ignore the following performance warnings: + // 64: vkCmdClearAttachments() issued on command buffer object 0x... prior to any Draw Cmds. It is recommended you use RenderPass LOAD_OP_CLEAR on Attachments prior to any Draw. + // 26: Vertex buffers are bound to command buffer (0x...) but no vertex buffers are attached to this Pipeline State Object (0x...). + if ((messageType & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) && + (callbackData->messageIdNumber == 64 || callbackData->messageIdNumber == 26)) + return VK_FALSE; + + debugMessage << "Vulkan debug message ("; + + Diligent::DebugMessageSeverity MsgSeverity = Diligent::DebugMessageSeverity::Info; + if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT) + { + debugMessage << "verbose"; + MsgSeverity = Diligent::DebugMessageSeverity::Info; + } + else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT) + { + debugMessage << "info"; + MsgSeverity = Diligent::DebugMessageSeverity::Info; + } + else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT) + { + debugMessage << "WARNING"; + MsgSeverity = Diligent::DebugMessageSeverity::Warning; + } + else if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) + { + debugMessage << "ERROR"; + MsgSeverity = Diligent::DebugMessageSeverity::Error; + } + else + { + debugMessage << "unknown severity"; + MsgSeverity = Diligent::DebugMessageSeverity::Info; + } + + if (messageType & VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT) + debugMessage << ", general"; + if (messageType & VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT) + debugMessage << ", validation"; + if (messageType & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT) + debugMessage << ", perf"; + + debugMessage << "): " << "Message Id: " << callbackData->messageIdNumber; + if (callbackData->pMessageIdName != nullptr) + { + debugMessage << " | Message Name: " << callbackData->pMessageIdName; + } + if (callbackData->pMessage != nullptr) + { + debugMessage << std::endl << " " << callbackData->pMessage; + } + + if (callbackData->objectCount > 0) + { + for (uint32_t obj = 0; obj < callbackData->objectCount; ++obj) + { + const auto& Object = callbackData->pObjects[obj]; + debugMessage << std::endl << " Object[" << obj << "] (" << VkObjectTypeToString(Object.objectType) + << "): Handle " << std::hex << "0x" << Object.objectHandle; + if (Object.pObjectName != nullptr) + { + debugMessage << ", Name: '" << Object.pObjectName << '\''; + } + } + } + + if (callbackData->cmdBufLabelCount > 0) + { + for (uint32_t l = 0; l < callbackData->cmdBufLabelCount; ++l) + { + const auto& Label = callbackData->pCmdBufLabels[l]; + debugMessage << std::endl << " Label[" << l << "]"; + if (Label.pLabelName != nullptr) + { + debugMessage << " - " << Label.pLabelName; + } + debugMessage << " {"; + debugMessage << std::fixed << std::setw(4) << Label.color[0] << ", " + << std::fixed << std::setw(4) << Label.color[1] << ", " + << std::fixed << std::setw(4) << Label.color[2] << ", " + << std::fixed << std::setw(4) << Label.color[3] << "}"; + } + } + + LOG_DEBUG_MESSAGE(MsgSeverity, debugMessage.str().c_str()); + + // The return value of this callback controls wether the Vulkan call that caused + // the validation message will be aborted or not + // We return VK_FALSE as we DON'T want Vulkan calls that cause a validation message + // (and return a VkResult) to abort + return VK_FALSE; + } + + + void SetupDebugging(VkInstance instance, VkDebugUtilsMessageSeverityFlagsEXT messageSeverity, - VkDebugUtilsMessageTypeFlagsEXT messageType, - void* pUserData) - { - CreateDebugUtilsMessengerEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkCreateDebugUtilsMessengerEXT")); - DestroyDebugUtilsMessengerEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkDestroyDebugUtilsMessengerEXT")); - VERIFY_EXPR(CreateDebugUtilsMessengerEXT != nullptr && DestroyDebugUtilsMessengerEXT != nullptr); - - VkDebugUtilsMessengerCreateInfoEXT DbgMessenger_CI = {}; - DbgMessenger_CI.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; - DbgMessenger_CI.pNext = NULL; - DbgMessenger_CI.flags = 0; - DbgMessenger_CI.messageSeverity = messageSeverity; - DbgMessenger_CI.messageType = messageType; - DbgMessenger_CI.pfnUserCallback = DebugMessengerCallback; - DbgMessenger_CI.pUserData = pUserData; - VkResult err = CreateDebugUtilsMessengerEXT(instance, &DbgMessenger_CI, nullptr, &DbgMessenger); - VERIFY(err == VK_SUCCESS, "Failed to create debug utils messenger"); - - // Load function pointers - SetDebugUtilsObjectNameEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkSetDebugUtilsObjectNameEXT")); - VERIFY_EXPR(SetDebugUtilsObjectNameEXT != nullptr); - SetDebugUtilsObjectTagEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkSetDebugUtilsObjectTagEXT")); - VERIFY_EXPR(SetDebugUtilsObjectTagEXT != nullptr); - - QueueBeginDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkQueueBeginDebugUtilsLabelEXT")); - VERIFY_EXPR(QueueBeginDebugUtilsLabelEXT != nullptr); - QueueEndDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkQueueEndDebugUtilsLabelEXT")); - VERIFY_EXPR(QueueEndDebugUtilsLabelEXT != nullptr); - QueueInsertDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkQueueInsertDebugUtilsLabelEXT")); - VERIFY_EXPR(QueueInsertDebugUtilsLabelEXT != nullptr); - - CmdBeginDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkCmdBeginDebugUtilsLabelEXT")); - VERIFY_EXPR(CmdBeginDebugUtilsLabelEXT != nullptr); - CmdEndDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkCmdEndDebugUtilsLabelEXT")); - VERIFY_EXPR(CmdEndDebugUtilsLabelEXT != nullptr); - CmdInsertDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkCmdInsertDebugUtilsLabelEXT")); - VERIFY_EXPR(CmdInsertDebugUtilsLabelEXT != nullptr); - } - - void FreeDebugging(VkInstance instance) - { - if (DbgMessenger != VK_NULL_HANDLE) - { - DestroyDebugUtilsMessengerEXT(instance, DbgMessenger, nullptr); - } - } - - void BeginCmdQueueLabelRegion(VkQueue cmdQueue, const char* pLabelName, const float* color) - { - VkDebugUtilsLabelEXT Label = {}; + VkDebugUtilsMessageTypeFlagsEXT messageType, + void* pUserData) + { + CreateDebugUtilsMessengerEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkCreateDebugUtilsMessengerEXT")); + DestroyDebugUtilsMessengerEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkDestroyDebugUtilsMessengerEXT")); + VERIFY_EXPR(CreateDebugUtilsMessengerEXT != nullptr && DestroyDebugUtilsMessengerEXT != nullptr); + + VkDebugUtilsMessengerCreateInfoEXT DbgMessenger_CI = {}; + DbgMessenger_CI.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT; + DbgMessenger_CI.pNext = NULL; + DbgMessenger_CI.flags = 0; + DbgMessenger_CI.messageSeverity = messageSeverity; + DbgMessenger_CI.messageType = messageType; + DbgMessenger_CI.pfnUserCallback = DebugMessengerCallback; + DbgMessenger_CI.pUserData = pUserData; + VkResult err = CreateDebugUtilsMessengerEXT(instance, &DbgMessenger_CI, nullptr, &DbgMessenger); + VERIFY(err == VK_SUCCESS, "Failed to create debug utils messenger"); (void)err; + + // Load function pointers + SetDebugUtilsObjectNameEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkSetDebugUtilsObjectNameEXT")); + VERIFY_EXPR(SetDebugUtilsObjectNameEXT != nullptr); + SetDebugUtilsObjectTagEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkSetDebugUtilsObjectTagEXT")); + VERIFY_EXPR(SetDebugUtilsObjectTagEXT != nullptr); + + QueueBeginDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkQueueBeginDebugUtilsLabelEXT")); + VERIFY_EXPR(QueueBeginDebugUtilsLabelEXT != nullptr); + QueueEndDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkQueueEndDebugUtilsLabelEXT")); + VERIFY_EXPR(QueueEndDebugUtilsLabelEXT != nullptr); + QueueInsertDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkQueueInsertDebugUtilsLabelEXT")); + VERIFY_EXPR(QueueInsertDebugUtilsLabelEXT != nullptr); + + CmdBeginDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkCmdBeginDebugUtilsLabelEXT")); + VERIFY_EXPR(CmdBeginDebugUtilsLabelEXT != nullptr); + CmdEndDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkCmdEndDebugUtilsLabelEXT")); + VERIFY_EXPR(CmdEndDebugUtilsLabelEXT != nullptr); + CmdInsertDebugUtilsLabelEXT = reinterpret_cast(vkGetInstanceProcAddr(instance, "vkCmdInsertDebugUtilsLabelEXT")); + VERIFY_EXPR(CmdInsertDebugUtilsLabelEXT != nullptr); + } + + void FreeDebugging(VkInstance instance) + { + if (DbgMessenger != VK_NULL_HANDLE) + { + DestroyDebugUtilsMessengerEXT(instance, DbgMessenger, nullptr); + } + } + + void BeginCmdQueueLabelRegion(VkQueue cmdQueue, const char* pLabelName, const float* color) + { + VkDebugUtilsLabelEXT Label = {}; Label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; Label.pNext = nullptr; Label.pLabelName = pLabelName; for(int i=0; i < 4; ++i) Label.color[i] = color[i]; QueueBeginDebugUtilsLabelEXT(cmdQueue, &Label); - } - - void InsertCmdQueueLabel(VkQueue cmdQueue, const char* pLabelName, const float* color) - { - VkDebugUtilsLabelEXT Label = {}; + } + + void InsertCmdQueueLabel(VkQueue cmdQueue, const char* pLabelName, const float* color) + { + VkDebugUtilsLabelEXT Label = {}; Label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; Label.pNext = nullptr; Label.pLabelName = pLabelName; for(int i=0; i < 4; ++i) Label.color[i] = color[i]; QueueInsertDebugUtilsLabelEXT(cmdQueue, &Label); - } - - void EndCmdQueueLabelRegion(VkQueue cmdQueue) - { - QueueEndDebugUtilsLabelEXT(cmdQueue); - } - - - // Start a new label region - void BeginCmdBufferLabelRegion(VkCommandBuffer cmdBuffer, const char* pLabelName, const float* color) - { - VkDebugUtilsLabelEXT Label = {}; + } + + void EndCmdQueueLabelRegion(VkQueue cmdQueue) + { + QueueEndDebugUtilsLabelEXT(cmdQueue); + } + + + // Start a new label region + void BeginCmdBufferLabelRegion(VkCommandBuffer cmdBuffer, const char* pLabelName, const float* color) + { + VkDebugUtilsLabelEXT Label = {}; Label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; Label.pNext = nullptr; Label.pLabelName = pLabelName; for(int i=0; i < 4; ++i) Label.color[i] = color[i]; - CmdBeginDebugUtilsLabelEXT(cmdBuffer, &Label); - } - - // End the label region - void EndCmdBufferLabelRegion(VkCommandBuffer cmdBuffer) - { - CmdEndDebugUtilsLabelEXT(cmdBuffer); - } - - // Start a single label - void InsertCmdBufferLabel(VkCommandBuffer cmdBuffer, const char* pLabelName, const float* color) - { - VkDebugUtilsLabelEXT Label = {}; + CmdBeginDebugUtilsLabelEXT(cmdBuffer, &Label); + } + + // End the label region + void EndCmdBufferLabelRegion(VkCommandBuffer cmdBuffer) + { + CmdEndDebugUtilsLabelEXT(cmdBuffer); + } + + // Start a single label + void InsertCmdBufferLabel(VkCommandBuffer cmdBuffer, const char* pLabelName, const float* color) + { + VkDebugUtilsLabelEXT Label = {}; Label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; Label.pNext = nullptr; Label.pLabelName = pLabelName; for(int i=0; i < 4; ++i) Label.color[i] = color[i]; - CmdInsertDebugUtilsLabelEXT(cmdBuffer, &Label); - } - - - void SetObjectName(VkDevice device, uint64_t objectHandle, VkObjectType objectType, const char *name) - { - // Check for valid function pointer (may not be present if not running in a debugging application) - if (SetDebugUtilsObjectNameEXT != nullptr && name != nullptr && *name != 0) - { - VkDebugUtilsObjectNameInfoEXT ObjectNameInfo = {}; + CmdInsertDebugUtilsLabelEXT(cmdBuffer, &Label); + } + + + void SetObjectName(VkDevice device, uint64_t objectHandle, VkObjectType objectType, const char *name) + { + // Check for valid function pointer (may not be present if not running in a debugging application) + if (SetDebugUtilsObjectNameEXT != nullptr && name != nullptr && *name != 0) + { + VkDebugUtilsObjectNameInfoEXT ObjectNameInfo = {}; ObjectNameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT; ObjectNameInfo.pNext = nullptr; ObjectNameInfo.objectType = objectType; ObjectNameInfo.objectHandle = objectHandle; ObjectNameInfo.pObjectName = name; - VkResult res = SetDebugUtilsObjectNameEXT(device, &ObjectNameInfo); - VERIFY_EXPR(res == VK_SUCCESS); - } - } - - void SetObjectTag(VkDevice device, uint64_t objectHandle, VkObjectType objectType, uint64_t name, size_t tagSize, const void* tag) - { - // Check for valid function pointer (may not be present if not running in a debugging application) - if (SetDebugUtilsObjectTagEXT) - { - VkDebugUtilsObjectTagInfoEXT tagInfo = {}; + VkResult res = SetDebugUtilsObjectNameEXT(device, &ObjectNameInfo); + VERIFY_EXPR(res == VK_SUCCESS); (void)res; + } + } + + void SetObjectTag(VkDevice device, uint64_t objectHandle, VkObjectType objectType, uint64_t name, size_t tagSize, const void* tag) + { + // Check for valid function pointer (may not be present if not running in a debugging application) + if (SetDebugUtilsObjectTagEXT) + { + VkDebugUtilsObjectTagInfoEXT tagInfo = {}; tagInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT; tagInfo.pNext = nullptr; tagInfo.objectType = objectType; @@ -266,318 +268,318 @@ namespace VulkanUtilities tagInfo.tagName = name; tagInfo.tagSize = tagSize; tagInfo.pTag = tag; - SetDebugUtilsObjectTagEXT(device, &tagInfo); - } - } - - void SetCommandPoolName(VkDevice device, VkCommandPool cmdPool, const char * name) - { - SetObjectName(device, (uint64_t)cmdPool, VK_OBJECT_TYPE_COMMAND_POOL, name); - } - - void SetCommandBufferName(VkDevice device, VkCommandBuffer cmdBuffer, const char * name) - { - SetObjectName(device, (uint64_t)cmdBuffer, VK_OBJECT_TYPE_COMMAND_BUFFER, name); - } - - void SetQueueName(VkDevice device, VkQueue queue, const char * name) - { - SetObjectName(device, (uint64_t)queue, VK_OBJECT_TYPE_QUEUE, name); - } - - void SetImageName(VkDevice device, VkImage image, const char * name) - { - SetObjectName(device, (uint64_t)image, VK_OBJECT_TYPE_IMAGE, name); - } - - void SetImageViewName(VkDevice device, VkImageView imageView, const char * name) - { - SetObjectName(device, (uint64_t)imageView, VK_OBJECT_TYPE_IMAGE_VIEW, name); - } - - void SetSamplerName(VkDevice device, VkSampler sampler, const char * name) - { - SetObjectName(device, (uint64_t)sampler, VK_OBJECT_TYPE_SAMPLER, name); - } - - void SetBufferName(VkDevice device, VkBuffer buffer, const char * name) - { - SetObjectName(device, (uint64_t)buffer, VK_OBJECT_TYPE_BUFFER, name); - } - - void SetBufferViewName(VkDevice device, VkBufferView bufferView, const char * name) - { - SetObjectName(device, (uint64_t)bufferView, VK_OBJECT_TYPE_BUFFER_VIEW, name); - } - - void SetDeviceMemoryName(VkDevice device, VkDeviceMemory memory, const char * name) - { - SetObjectName(device, (uint64_t)memory, VK_OBJECT_TYPE_DEVICE_MEMORY, name); - } - - void SetShaderModuleName(VkDevice device, VkShaderModule shaderModule, const char * name) - { - SetObjectName(device, (uint64_t)shaderModule, VK_OBJECT_TYPE_SHADER_MODULE, name); - } - - void SetPipelineName(VkDevice device, VkPipeline pipeline, const char * name) - { - SetObjectName(device, (uint64_t)pipeline, VK_OBJECT_TYPE_PIPELINE, name); - } - - void SetPipelineLayoutName(VkDevice device, VkPipelineLayout pipelineLayout, const char * name) - { - SetObjectName(device, (uint64_t)pipelineLayout, VK_OBJECT_TYPE_PIPELINE_LAYOUT, name); - } - - void SetRenderPassName(VkDevice device, VkRenderPass renderPass, const char * name) - { - SetObjectName(device, (uint64_t)renderPass, VK_OBJECT_TYPE_RENDER_PASS, name); - } - - void SetFramebufferName(VkDevice device, VkFramebuffer framebuffer, const char * name) - { - SetObjectName(device, (uint64_t)framebuffer, VK_OBJECT_TYPE_FRAMEBUFFER, name); - } - - void SetDescriptorSetLayoutName(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const char * name) - { - SetObjectName(device, (uint64_t)descriptorSetLayout, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT, name); - } - - void SetDescriptorSetName(VkDevice device, VkDescriptorSet descriptorSet, const char * name) - { - SetObjectName(device, (uint64_t)descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET, name); - } - - void SetDescriptorPoolName(VkDevice device, VkDescriptorPool descriptorPool, const char * name) - { - SetObjectName(device, (uint64_t)descriptorPool, VK_OBJECT_TYPE_DESCRIPTOR_POOL, name); - } - - void SetSemaphoreName(VkDevice device, VkSemaphore semaphore, const char * name) - { - SetObjectName(device, (uint64_t)semaphore, VK_OBJECT_TYPE_SEMAPHORE, name); - } - - void SetFenceName(VkDevice device, VkFence fence, const char * name) - { - SetObjectName(device, (uint64_t)fence, VK_OBJECT_TYPE_FENCE, name); - } - - void SetEventName(VkDevice device, VkEvent _event, const char * name) - { - SetObjectName(device, (uint64_t)_event, VK_OBJECT_TYPE_EVENT, name); - } - - - - - void SetVulkanObjectName(VkDevice device, VkCommandPool cmdPool, const char * name) - { - SetCommandPoolName(device, cmdPool, name); - } - - void SetVulkanObjectName(VkDevice device, VkCommandBuffer cmdBuffer, const char * name) - { - SetCommandBufferName(device, cmdBuffer, name); - } - - void SetVulkanObjectName(VkDevice device, VkQueue queue, const char * name) - { - SetQueueName(device, queue, name); - } - - void SetVulkanObjectName(VkDevice device, VkImage image, const char * name) - { - SetImageName(device, image, name); - } - - void SetVulkanObjectName(VkDevice device, VkImageView imageView, const char * name) - { - SetImageViewName(device, imageView, name); - } - - void SetVulkanObjectName(VkDevice device, VkSampler sampler, const char * name) - { - SetSamplerName(device, sampler, name); - } - - void SetVulkanObjectName(VkDevice device, VkBuffer buffer, const char * name) - { - SetBufferName(device, buffer, name); - } - - void SetVulkanObjectName(VkDevice device, VkBufferView bufferView, const char * name) - { - SetBufferViewName(device, bufferView, name); - } - - void SetVulkanObjectName(VkDevice device, VkDeviceMemory memory, const char * name) - { - SetDeviceMemoryName(device, memory, name); - } - - void SetVulkanObjectName(VkDevice device, VkShaderModule shaderModule, const char * name) - { - SetShaderModuleName(device, shaderModule, name); - } - - void SetVulkanObjectName(VkDevice device, VkPipeline pipeline, const char * name) - { - SetPipelineName(device, pipeline, name); - } - - void SetVulkanObjectName(VkDevice device, VkPipelineLayout pipelineLayout, const char * name) - { - SetPipelineLayoutName(device, pipelineLayout, name); - } - - void SetVulkanObjectName(VkDevice device, VkRenderPass renderPass, const char * name) - { - SetRenderPassName(device, renderPass, name); - } - - void SetVulkanObjectName(VkDevice device, VkFramebuffer framebuffer, const char * name) - { - SetFramebufferName(device, framebuffer, name); - } - - void SetVulkanObjectName(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const char * name) - { - SetDescriptorSetLayoutName(device, descriptorSetLayout, name); - } - - void SetVulkanObjectName(VkDevice device, VkDescriptorSet descriptorSet, const char * name) - { - SetDescriptorSetName(device, descriptorSet, name); - } - - void SetVulkanObjectName(VkDevice device, VkDescriptorPool descriptorPool, const char * name) - { - SetDescriptorPoolName(device, descriptorPool, name); - } - - void SetVulkanObjectName(VkDevice device, VkSemaphore semaphore, const char * name) - { - SetSemaphoreName(device, semaphore, name); - } - - void SetVulkanObjectName(VkDevice device, VkFence fence, const char * name) - { - SetFenceName(device, fence, name); - } - - void SetVulkanObjectName(VkDevice device, VkEvent _event, const char * name) - { - SetEventName(device, _event, name); - } - - - - const char* VkResultToString(VkResult errorCode) - { - switch (errorCode) - { -#define STR(r) case VK_ ##r: return #r - STR(NOT_READY); - STR(TIMEOUT); - STR(EVENT_SET); - STR(EVENT_RESET); - STR(INCOMPLETE); - STR(ERROR_OUT_OF_HOST_MEMORY); - STR(ERROR_OUT_OF_DEVICE_MEMORY); - STR(ERROR_INITIALIZATION_FAILED); - STR(ERROR_DEVICE_LOST); - STR(ERROR_MEMORY_MAP_FAILED); - STR(ERROR_LAYER_NOT_PRESENT); - STR(ERROR_EXTENSION_NOT_PRESENT); - STR(ERROR_FEATURE_NOT_PRESENT); - STR(ERROR_INCOMPATIBLE_DRIVER); - STR(ERROR_TOO_MANY_OBJECTS); - STR(ERROR_FORMAT_NOT_SUPPORTED); - STR(ERROR_SURFACE_LOST_KHR); - STR(ERROR_NATIVE_WINDOW_IN_USE_KHR); - STR(SUBOPTIMAL_KHR); - STR(ERROR_OUT_OF_DATE_KHR); - STR(ERROR_INCOMPATIBLE_DISPLAY_KHR); - STR(ERROR_VALIDATION_FAILED_EXT); - STR(ERROR_INVALID_SHADER_NV); -#undef STR - default: - return "UNKNOWN_ERROR"; - } - } - - const char* VkAccessFlagBitToString(VkAccessFlagBits Bit) - { - VERIFY(Bit != 0 && (Bit & (Bit-1)) == 0, "Single bit is expected"); - switch(Bit) - { -#define ACCESS_FLAG_BIT_TO_STRING(ACCESS_FLAG_BIT)case ACCESS_FLAG_BIT: return #ACCESS_FLAG_BIT; - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_INDIRECT_COMMAND_READ_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_INDEX_READ_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_UNIFORM_READ_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_INPUT_ATTACHMENT_READ_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_SHADER_READ_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_SHADER_WRITE_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_COLOR_ATTACHMENT_READ_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_TRANSFER_READ_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_TRANSFER_WRITE_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_HOST_READ_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_HOST_WRITE_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_MEMORY_READ_BIT) - ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_MEMORY_WRITE_BIT) -#undef ACCESS_FLAG_BIT_TO_STRING - default: UNEXPECTED("Unexpected bit"); return ""; - } - } - - const char* VkImageLayoutToString(VkImageLayout Layout) - { - switch(Layout) - { -#define IMAGE_LAYOUT_TO_STRING(LAYOUT)case LAYOUT: return #LAYOUT; - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_UNDEFINED) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_GENERAL) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_PREINITIALIZED) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) - IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR) -#undef IMAGE_LAYOUT_TO_STRING - default: UNEXPECTED("Unknown layout"); return ""; - } - } - - std::string VkAccessFlagsToString(VkAccessFlags Flags) - { - std::string FlagsString; - while(Flags != 0) - { - auto Bit = Flags & ~(Flags - 1); - if (!FlagsString.empty()) - FlagsString += ", "; - FlagsString += VkAccessFlagBitToString( static_cast(Bit) ); - Flags = Flags & (Flags - 1); - } - return std::move(FlagsString); - } - - const char* VkObjectTypeToString(VkObjectType ObjectType) - { - switch(ObjectType) - { + SetDebugUtilsObjectTagEXT(device, &tagInfo); + } + } + + void SetCommandPoolName(VkDevice device, VkCommandPool cmdPool, const char * name) + { + SetObjectName(device, (uint64_t)cmdPool, VK_OBJECT_TYPE_COMMAND_POOL, name); + } + + void SetCommandBufferName(VkDevice device, VkCommandBuffer cmdBuffer, const char * name) + { + SetObjectName(device, (uint64_t)cmdBuffer, VK_OBJECT_TYPE_COMMAND_BUFFER, name); + } + + void SetQueueName(VkDevice device, VkQueue queue, const char * name) + { + SetObjectName(device, (uint64_t)queue, VK_OBJECT_TYPE_QUEUE, name); + } + + void SetImageName(VkDevice device, VkImage image, const char * name) + { + SetObjectName(device, (uint64_t)image, VK_OBJECT_TYPE_IMAGE, name); + } + + void SetImageViewName(VkDevice device, VkImageView imageView, const char * name) + { + SetObjectName(device, (uint64_t)imageView, VK_OBJECT_TYPE_IMAGE_VIEW, name); + } + + void SetSamplerName(VkDevice device, VkSampler sampler, const char * name) + { + SetObjectName(device, (uint64_t)sampler, VK_OBJECT_TYPE_SAMPLER, name); + } + + void SetBufferName(VkDevice device, VkBuffer buffer, const char * name) + { + SetObjectName(device, (uint64_t)buffer, VK_OBJECT_TYPE_BUFFER, name); + } + + void SetBufferViewName(VkDevice device, VkBufferView bufferView, const char * name) + { + SetObjectName(device, (uint64_t)bufferView, VK_OBJECT_TYPE_BUFFER_VIEW, name); + } + + void SetDeviceMemoryName(VkDevice device, VkDeviceMemory memory, const char * name) + { + SetObjectName(device, (uint64_t)memory, VK_OBJECT_TYPE_DEVICE_MEMORY, name); + } + + void SetShaderModuleName(VkDevice device, VkShaderModule shaderModule, const char * name) + { + SetObjectName(device, (uint64_t)shaderModule, VK_OBJECT_TYPE_SHADER_MODULE, name); + } + + void SetPipelineName(VkDevice device, VkPipeline pipeline, const char * name) + { + SetObjectName(device, (uint64_t)pipeline, VK_OBJECT_TYPE_PIPELINE, name); + } + + void SetPipelineLayoutName(VkDevice device, VkPipelineLayout pipelineLayout, const char * name) + { + SetObjectName(device, (uint64_t)pipelineLayout, VK_OBJECT_TYPE_PIPELINE_LAYOUT, name); + } + + void SetRenderPassName(VkDevice device, VkRenderPass renderPass, const char * name) + { + SetObjectName(device, (uint64_t)renderPass, VK_OBJECT_TYPE_RENDER_PASS, name); + } + + void SetFramebufferName(VkDevice device, VkFramebuffer framebuffer, const char * name) + { + SetObjectName(device, (uint64_t)framebuffer, VK_OBJECT_TYPE_FRAMEBUFFER, name); + } + + void SetDescriptorSetLayoutName(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const char * name) + { + SetObjectName(device, (uint64_t)descriptorSetLayout, VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT, name); + } + + void SetDescriptorSetName(VkDevice device, VkDescriptorSet descriptorSet, const char * name) + { + SetObjectName(device, (uint64_t)descriptorSet, VK_OBJECT_TYPE_DESCRIPTOR_SET, name); + } + + void SetDescriptorPoolName(VkDevice device, VkDescriptorPool descriptorPool, const char * name) + { + SetObjectName(device, (uint64_t)descriptorPool, VK_OBJECT_TYPE_DESCRIPTOR_POOL, name); + } + + void SetSemaphoreName(VkDevice device, VkSemaphore semaphore, const char * name) + { + SetObjectName(device, (uint64_t)semaphore, VK_OBJECT_TYPE_SEMAPHORE, name); + } + + void SetFenceName(VkDevice device, VkFence fence, const char * name) + { + SetObjectName(device, (uint64_t)fence, VK_OBJECT_TYPE_FENCE, name); + } + + void SetEventName(VkDevice device, VkEvent _event, const char * name) + { + SetObjectName(device, (uint64_t)_event, VK_OBJECT_TYPE_EVENT, name); + } + + + + + void SetVulkanObjectName(VkDevice device, VkCommandPool cmdPool, const char * name) + { + SetCommandPoolName(device, cmdPool, name); + } + + void SetVulkanObjectName(VkDevice device, VkCommandBuffer cmdBuffer, const char * name) + { + SetCommandBufferName(device, cmdBuffer, name); + } + + void SetVulkanObjectName(VkDevice device, VkQueue queue, const char * name) + { + SetQueueName(device, queue, name); + } + + void SetVulkanObjectName(VkDevice device, VkImage image, const char * name) + { + SetImageName(device, image, name); + } + + void SetVulkanObjectName(VkDevice device, VkImageView imageView, const char * name) + { + SetImageViewName(device, imageView, name); + } + + void SetVulkanObjectName(VkDevice device, VkSampler sampler, const char * name) + { + SetSamplerName(device, sampler, name); + } + + void SetVulkanObjectName(VkDevice device, VkBuffer buffer, const char * name) + { + SetBufferName(device, buffer, name); + } + + void SetVulkanObjectName(VkDevice device, VkBufferView bufferView, const char * name) + { + SetBufferViewName(device, bufferView, name); + } + + void SetVulkanObjectName(VkDevice device, VkDeviceMemory memory, const char * name) + { + SetDeviceMemoryName(device, memory, name); + } + + void SetVulkanObjectName(VkDevice device, VkShaderModule shaderModule, const char * name) + { + SetShaderModuleName(device, shaderModule, name); + } + + void SetVulkanObjectName(VkDevice device, VkPipeline pipeline, const char * name) + { + SetPipelineName(device, pipeline, name); + } + + void SetVulkanObjectName(VkDevice device, VkPipelineLayout pipelineLayout, const char * name) + { + SetPipelineLayoutName(device, pipelineLayout, name); + } + + void SetVulkanObjectName(VkDevice device, VkRenderPass renderPass, const char * name) + { + SetRenderPassName(device, renderPass, name); + } + + void SetVulkanObjectName(VkDevice device, VkFramebuffer framebuffer, const char * name) + { + SetFramebufferName(device, framebuffer, name); + } + + void SetVulkanObjectName(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const char * name) + { + SetDescriptorSetLayoutName(device, descriptorSetLayout, name); + } + + void SetVulkanObjectName(VkDevice device, VkDescriptorSet descriptorSet, const char * name) + { + SetDescriptorSetName(device, descriptorSet, name); + } + + void SetVulkanObjectName(VkDevice device, VkDescriptorPool descriptorPool, const char * name) + { + SetDescriptorPoolName(device, descriptorPool, name); + } + + void SetVulkanObjectName(VkDevice device, VkSemaphore semaphore, const char * name) + { + SetSemaphoreName(device, semaphore, name); + } + + void SetVulkanObjectName(VkDevice device, VkFence fence, const char * name) + { + SetFenceName(device, fence, name); + } + + void SetVulkanObjectName(VkDevice device, VkEvent _event, const char * name) + { + SetEventName(device, _event, name); + } + + + + const char* VkResultToString(VkResult errorCode) + { + switch (errorCode) + { +#define STR(r) case VK_ ##r: return #r + STR(NOT_READY); + STR(TIMEOUT); + STR(EVENT_SET); + STR(EVENT_RESET); + STR(INCOMPLETE); + STR(ERROR_OUT_OF_HOST_MEMORY); + STR(ERROR_OUT_OF_DEVICE_MEMORY); + STR(ERROR_INITIALIZATION_FAILED); + STR(ERROR_DEVICE_LOST); + STR(ERROR_MEMORY_MAP_FAILED); + STR(ERROR_LAYER_NOT_PRESENT); + STR(ERROR_EXTENSION_NOT_PRESENT); + STR(ERROR_FEATURE_NOT_PRESENT); + STR(ERROR_INCOMPATIBLE_DRIVER); + STR(ERROR_TOO_MANY_OBJECTS); + STR(ERROR_FORMAT_NOT_SUPPORTED); + STR(ERROR_SURFACE_LOST_KHR); + STR(ERROR_NATIVE_WINDOW_IN_USE_KHR); + STR(SUBOPTIMAL_KHR); + STR(ERROR_OUT_OF_DATE_KHR); + STR(ERROR_INCOMPATIBLE_DISPLAY_KHR); + STR(ERROR_VALIDATION_FAILED_EXT); + STR(ERROR_INVALID_SHADER_NV); +#undef STR + default: + return "UNKNOWN_ERROR"; + } + } + + const char* VkAccessFlagBitToString(VkAccessFlagBits Bit) + { + VERIFY(Bit != 0 && (Bit & (Bit-1)) == 0, "Single bit is expected"); + switch(Bit) + { +#define ACCESS_FLAG_BIT_TO_STRING(ACCESS_FLAG_BIT)case ACCESS_FLAG_BIT: return #ACCESS_FLAG_BIT; + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_INDIRECT_COMMAND_READ_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_INDEX_READ_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_UNIFORM_READ_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_INPUT_ATTACHMENT_READ_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_SHADER_READ_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_SHADER_WRITE_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_COLOR_ATTACHMENT_READ_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_TRANSFER_READ_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_TRANSFER_WRITE_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_HOST_READ_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_HOST_WRITE_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_MEMORY_READ_BIT) + ACCESS_FLAG_BIT_TO_STRING(VK_ACCESS_MEMORY_WRITE_BIT) +#undef ACCESS_FLAG_BIT_TO_STRING + default: UNEXPECTED("Unexpected bit"); return ""; + } + } + + const char* VkImageLayoutToString(VkImageLayout Layout) + { + switch(Layout) + { +#define IMAGE_LAYOUT_TO_STRING(LAYOUT)case LAYOUT: return #LAYOUT; + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_UNDEFINED) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_GENERAL) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_PREINITIALIZED) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_PRESENT_SRC_KHR) + IMAGE_LAYOUT_TO_STRING(VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR) +#undef IMAGE_LAYOUT_TO_STRING + default: UNEXPECTED("Unknown layout"); return ""; + } + } + + std::string VkAccessFlagsToString(VkAccessFlags Flags) + { + std::string FlagsString; + while(Flags != 0) + { + auto Bit = Flags & ~(Flags - 1); + if (!FlagsString.empty()) + FlagsString += ", "; + FlagsString += VkAccessFlagBitToString( static_cast(Bit) ); + Flags = Flags & (Flags - 1); + } + return std::move(FlagsString); + } + + const char* VkObjectTypeToString(VkObjectType ObjectType) + { + switch(ObjectType) + { case VK_OBJECT_TYPE_UNKNOWN: return "unknown"; case VK_OBJECT_TYPE_INSTANCE: return "instance"; case VK_OBJECT_TYPE_PHYSICAL_DEVICE: return "physical device"; @@ -616,7 +618,7 @@ namespace VulkanUtilities case VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT: return "debug utils messenger"; case VK_OBJECT_TYPE_VALIDATION_CACHE_EXT: return "validation cache"; case VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NVX: return "acceleration structure NVX"; - default: return "unknown"; - } - } -} + default: return "unknown"; + } + } +} diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp index 1467a1db..7b3662b8 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanFencePool.cpp @@ -34,10 +34,12 @@ namespace VulkanUtilities VulkanFencePool::~VulkanFencePool() { +#ifdef DEVELOPMENT for (const auto& fence : m_Fences) { DEV_CHECK_ERR(m_LogicalDevice->GetFenceStatus(fence) == VK_SUCCESS, "Destroying a fence that has not been signaled"); } +#endif m_Fences.clear(); } diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp index 5a1e9c47..a2d28bd7 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanLogicalDevice.cpp @@ -65,7 +65,7 @@ namespace VulkanUtilities void VulkanLogicalDevice::WaitIdle()const { auto err = vkDeviceWaitIdle(m_VkDevice); - DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to idle device"); + DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to idle device"); (void)err; } template @@ -80,7 +80,7 @@ namespace VulkanUtilities VkObjectType VkObject = VK_NULL_HANDLE; auto err = VkCreateObject(m_VkDevice, &CreateInfo, m_VkAllocator, &VkObject); CHECK_VK_ERROR_AND_THROW(err, "Failed to create Vulkan ", ObjectType, " '", DebugName, '\''); - + if (DebugName != nullptr && *DebugName != 0) SetVulkanObjectName(m_VkDevice, VkObject, DebugName); @@ -242,7 +242,7 @@ namespace VulkanUtilities VkCommandBuffer CmdBuff = VK_NULL_HANDLE; auto err = vkAllocateCommandBuffers(m_VkDevice, &AllocInfo, &CmdBuff); - DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to allocate command buffer '", DebugName, '\''); + DEV_CHECK_ERR(err == VK_SUCCESS, "Failed to allocate command buffer '", DebugName, '\''); (void)err; if (DebugName != nullptr && *DebugName != 0) SetCommandBufferName(m_VkDevice, CmdBuff, DebugName); diff --git a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp index cad556aa..c368fb2e 100644 --- a/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp +++ b/Graphics/GraphicsEngineVulkan/src/VulkanUtilities/VulkanPhysicalDevice.cpp @@ -56,7 +56,7 @@ namespace VulkanUtilities { m_SupportedExtensions.resize(ExtensionCount); auto res = vkEnumerateDeviceExtensionProperties(m_VkDevice, nullptr, &ExtensionCount, m_SupportedExtensions.data()); - VERIFY_EXPR(res == VK_SUCCESS); + VERIFY_EXPR(res == VK_SUCCESS); (void)res; VERIFY_EXPR(ExtensionCount == m_SupportedExtensions.size()); } } @@ -110,13 +110,15 @@ namespace VulkanUtilities { if (QueueFlags & (VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT)) { - const auto &Props = m_QueueFamilyProperties[FamilyInd]; +#ifdef _DEBUG + const auto& Props = m_QueueFamilyProperties[FamilyInd]; // Queues supporting graphics and/or compute operations must report (1,1,1) // in minImageTransferGranularity, meaning that there are no additional restrictions // on the granularity of image transfer operations for these queues (4.1). VERIFY_EXPR(Props.minImageTransferGranularity.width == 1 && Props.minImageTransferGranularity.height == 1 && Props.minImageTransferGranularity.depth == 1); +#endif } } else -- cgit v1.2.3