diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a0858b970dead0233261c4f3c126a0bf64732f7..5f82b94af2a98dfb6700fb098a6b2a84adf7b9a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,9 @@ endif() # configure everything to use the required dependencies include(${vkcv_config}/Libraries.cmake) +# set macro to enable vulkan debug labels +list(APPEND vkcv_definitions VULKAN_DEBUG_LABELS) + # set the compile definitions aka preprocessor variables add_compile_definitions(${vkcv_definitions}) diff --git a/src/vkcv/Core.cpp b/src/vkcv/Core.cpp index 00ea4a9fec2bbc49ef078074ca7e13927d146b9d..88fc479473e9fe09a8547c21e322017bd73dc61a 100644 --- a/src/vkcv/Core.cpp +++ b/src/vkcv/Core.cpp @@ -443,7 +443,7 @@ namespace vkcv void Core::recordBeginDebugLabel(const CommandStreamHandle &cmdStream, const std::string& label, const std::array<float, 4>& color) { -#ifndef NDEBUG + #ifdef VULKAN_DEBUG_LABELS static PFN_vkCmdBeginDebugUtilsLabelEXT beginDebugLabel = reinterpret_cast<PFN_vkCmdBeginDebugUtilsLabelEXT>( m_Context.getDevice().getProcAddr("vkCmdBeginDebugUtilsLabelEXT") ); @@ -462,11 +462,11 @@ namespace vkcv }; recordCommandsToStream(cmdStream, submitFunction, nullptr); -#endif + #endif } void Core::recordEndDebugLabel(const CommandStreamHandle &cmdStream) { -#ifndef NDEBUG + #ifdef VULKAN_DEBUG_LABELS static PFN_vkCmdEndDebugUtilsLabelEXT endDebugLabel = reinterpret_cast<PFN_vkCmdEndDebugUtilsLabelEXT>( m_Context.getDevice().getProcAddr("vkCmdEndDebugUtilsLabelEXT") ); @@ -480,7 +480,7 @@ namespace vkcv }; recordCommandsToStream(cmdStream, submitFunction, nullptr); -#endif + #endif } void Core::recordComputeIndirectDispatchToCmdStream( @@ -864,7 +864,7 @@ namespace vkcv static void setDebugObjectLabel(const vk::Device& device, const vk::ObjectType& type, uint64_t handle, const std::string& label) { -#ifndef NDEBUG +#ifndef VULKAN_DEBUG_LABELS static PFN_vkSetDebugUtilsObjectNameEXT setDebugLabel = reinterpret_cast<PFN_vkSetDebugUtilsObjectNameEXT>( device.getProcAddr("vkSetDebugUtilsObjectNameEXT") );