diff --git a/tools/hello.cpp b/tools/hello.cpp index f280ac1..0ea1394 100644 --- a/tools/hello.cpp +++ b/tools/hello.cpp @@ -14,7 +14,6 @@ /////////////////////////////////////////////////////////////////////////////// -#if 0 static VkBool32 vk_debug_callback (VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, @@ -38,7 +37,6 @@ vk_debug_callback (VkDebugReportFlagsEXT flags, return VK_FALSE; } -#endif VkShaderModule @@ -93,6 +91,20 @@ main (void) util::make_view (extensions.data (), extensions.data () + extensions.size ()) ); + { + VkDebugReportCallbackEXT callback; + VkDebugReportCallbackCreateInfoEXT debug_info {}; + debug_info.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT; + debug_info.flags = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT; + debug_info.pfnCallback = vk_debug_callback; + + auto func = (decltype(&vkCreateDebugReportCallbackEXT))vkGetInstanceProcAddr (instance.id (),"vkCreateDebugReportCallbackEXT"); + + cruft::vk::error::try_code ( + func (instance.id (), &debug_info, nullptr, &callback) + ); + } + auto pdevices = cruft::vk::physical_device::find (instance); auto &pdevice = pdevices[0]; @@ -438,7 +450,7 @@ main (void) std::vector swapchain_framebuffers (swap_image_views.size ()); - for (int i = 0; i < swap_image_views.size (); ++i) { + for (size_t i = 0; i < swap_image_views.size (); ++i) { VkImageView attachments[] = { swap_image_views[i] }; @@ -476,7 +488,7 @@ main (void) vkAllocateCommandBuffers (ldevice.id (), &alloc_info, command_buffers.data ()) ); - for (int i = 0; i < command_buffers.size (); ++i) { + for (size_t i = 0; i < command_buffers.size (); ++i) { VkCommandBufferBeginInfo command_begin {}; command_begin.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; command_begin.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT;