Skip to content

Commit e448d0c

Browse files
committed
Fixing the debug directives
1 parent 65c5ac2 commit e448d0c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

vulkan-cpp/instance.cppm

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ export namespace vk {
6464
static_cast<uint32_t>(p_config.extensions.size());
6565
instance_ci.ppEnabledExtensionNames = p_config.extensions.data();
6666

67-
#if defined(__APPLE__)
67+
#if defined(__APPLE__)
6868
instance_ci.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR;
69-
#endif
69+
#endif
7070

71-
// Only run validation layers if we are running vulkan-cpp in debug mode
72-
#if !defined(NDEBUG) || defined(_DEBUG) || defined(DEBUG)
71+
// Only execute this if we are in the debug build
72+
#if !defined(NDEBUG) || defined(_DEBUG) || defined(DEBUG)
7373
// Setting up validation layers
7474
instance_ci.enabledLayerCount =
7575
static_cast<uint32_t>(p_config.validations.size());
@@ -91,15 +91,16 @@ export namespace vk {
9191
else {
9292
instance_ci.pNext = nullptr;
9393
}
94-
#else
94+
#else
9595
instance_ci.enabledLayerCount = 0;
9696
instance_ci.ppEnabledLayerNames = nullptr;
9797
instance_ci.pNext = nullptr;
98-
#endif
98+
#endif
9999
vk_check(vkCreateInstance(&instance_ci, nullptr, &m_instance),
100100
"vkCreateInstance");
101-
102-
#if _DEBUG
101+
102+
// Set the debug utility function pointer if we are in the debug build.
103+
#if !defined(NDEBUG) || defined(_DEBUG) || defined(DEBUG)
103104
// This needs to be created after the VkInstance is or else it wont be applied the debug information during validation layer error message execution
104105
m_vk_set_debug_utils_object_name_ext = reinterpret_cast<PFN_vkSetDebugUtilsObjectNameEXT>(vkGetInstanceProcAddr(m_instance, "vkSetDebugUtilsObjectNameEXT"));
105106
#endif

0 commit comments

Comments
 (0)