From 364659b8af9fd68fb86b3478a5fb4048c780b387 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 6 Sep 2017 13:46:52 +1000 Subject: [PATCH] except: prefer fun references to func pointers --- fence.cpp | 6 +++--- object.cpp | 6 +++--- object.hpp | 3 ++- tools/hello.cpp | 6 +++--- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/fence.cpp b/fence.cpp index 8db0cb4..3b8259d 100644 --- a/fence.cpp +++ b/fence.cpp @@ -42,7 +42,7 @@ fence::reset (const device &dev, fence *first, fence *last) CHECK_LE (first, last); cruft::vk::error::try_func ( - &vkResetFences, dev.id (), trunc_cast (last - first), &first->id () + vkResetFences, dev.id (), trunc_cast (last - first), &first->id () ); } @@ -54,7 +54,7 @@ fence::wait (const device &d, fence *first, fence *last, uint64_t timeout) CHECK_LE (first, last); cruft::vk::error::try_func ( - &vkWaitForFences, d.id (), trunc_cast (last - first), &first->id (), VK_FALSE, timeout + vkWaitForFences, d.id (), trunc_cast (last - first), &first->id (), VK_FALSE, timeout ); } @@ -66,6 +66,6 @@ fence::wait_all (const device &d, fence *first, fence *last, uint64_t timeout) CHECK_LE (first, last); cruft::vk::error::try_func ( - &vkWaitForFences, d.id (), trunc_cast (last - first), &first->id (), VK_TRUE, timeout + vkWaitForFences, d.id (), trunc_cast (last - first), &first->id (), VK_TRUE, timeout ); } diff --git a/object.cpp b/object.cpp index 36a9520..60de879 100644 --- a/object.cpp +++ b/object.cpp @@ -76,15 +76,15 @@ VK_DESCENDANT_TYPE_MAP (DESCENDANT) /////////////////////////////////////////////////////////////////////////////// template std::vector -cruft::vk::enumerated::find (const instance &inst) { +cruft::vk::enumerated::find (const instance &parent) { // find the total number of objects uint32_t expected = 0; - error::try_code (enum_traits::enumerate (inst.id (), &expected, nullptr)); + error::try_code (enum_traits::enumerate (parent.id (), &expected, nullptr)); // allocate an array of handles and fetch them uint32_t found = expected; typename T::id_t handles[expected]; - error::try_code (enum_traits::enumerate (inst.id (), &found, handles)); + error::try_code (enum_traits::enumerate (parent.id (), &found, handles)); // return an collection of objects from the handles return std::vector (handles, handles + found); diff --git a/object.hpp b/object.hpp index 0fc65c7..2f128a5 100644 --- a/object.hpp +++ b/object.hpp @@ -105,7 +105,8 @@ namespace cruft::vk { struct enumerated : public object { using object::object; - static std::vector find (const instance&); + static std::vector + find (const instance &parent); }; diff --git a/tools/hello.cpp b/tools/hello.cpp index 8810895..70f4166 100644 --- a/tools/hello.cpp +++ b/tools/hello.cpp @@ -105,7 +105,7 @@ main (void) auto func = (decltype(&vkCreateDebugReportCallbackEXT))vkGetInstanceProcAddr (instance.id (),"vkCreateDebugReportCallbackEXT"); cruft::vk::error::try_func ( - func, instance.id (), &debug_info, nullptr, &callback + *func, instance.id (), &debug_info, nullptr, &callback ); } @@ -584,14 +584,14 @@ main (void) present_info.pImageIndices = &image_index; present_info.pResults = nullptr; - cruft::vk::error::try_func (&vkQueuePresentKHR, present_queue.id (), &present_info); + cruft::vk::error::try_func (vkQueuePresentKHR, present_queue.id (), &present_info); LOG_INFO ("entering runloop"); while (!glfwWindowShouldClose (window)) { glfwPollEvents (); } - cruft::vk::error::try_func (&vkDeviceWaitIdle, ldevice.id ()); + cruft::vk::error::try_func (vkDeviceWaitIdle, ldevice.id ()); LOG_INFO ("terminating glfw"); glfwDestroyWindow (window);