diff --git a/except.hpp b/except.hpp index e479d72..7bfe437 100644 --- a/except.hpp +++ b/except.hpp @@ -51,16 +51,17 @@ namespace cruft::vk { static auto try_func (FuncT &&func, Args &&...args) { - if constexpr (std::is_same_v< - typename func_traits::return_type, - VkResult - >) - { + constexpr bool returns_vkresult = std::is_same_v< + typename func_traits::return_type, + VkResult + >; + + if constexpr (returns_vkresult) { try_code (func (maybe_native (args)...)); return; - } - else + } else { return func (maybe_native (args)...); + } } diff --git a/tools/hello.cpp b/tools/hello.cpp index 3012d94..060d23f 100644 --- a/tools/hello.cpp +++ b/tools/hello.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -355,13 +356,13 @@ main (void) auto queues = pdevice.queue_families (); int graphics_queue_id = -1, present_queue_id = -1; - for (size_t i = 0, last = queues.size (); i != last; ++i) + for (int i = 0, last = util::cast::lossless (queues.size ()); i != last; ++i) if (queues[i].queueCount > 0 && queues[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) { graphics_queue_id = i; break; } - for (size_t i = 0, last = queues.size (); i != last; ++i) { + for (uint32_t i = 0, last = util::cast::narrow (queues.size ()); i != last; ++i) { if (cruft::vk::error::try_query (vkGetPhysicalDeviceSurfaceSupportKHR, pdevice.native (), i, surface)) { present_queue_id = i; @@ -732,7 +733,6 @@ main (void) ldevice, VK_NULL_HANDLE, 1, &pipeline_info, nullptr ); - //------------------------------------------------------------------------- using framebuffer_ptr = cruft::vk::owned_ptr; std::vector swapchain_framebuffers; @@ -880,6 +880,5 @@ main (void) } cruft::vk::error::try_func (vkDeviceWaitIdle, ldevice.native ()); - LOG_INFO ("terminating"); } \ No newline at end of file