except: prefer fun references to func pointers
This commit is contained in:
parent
9a07fc2496
commit
364659b8af
@ -42,7 +42,7 @@ fence::reset (const device &dev, fence *first, fence *last)
|
|||||||
CHECK_LE (first, last);
|
CHECK_LE (first, last);
|
||||||
|
|
||||||
cruft::vk::error::try_func (
|
cruft::vk::error::try_func (
|
||||||
&vkResetFences, dev.id (), trunc_cast<uint32_t> (last - first), &first->id ()
|
vkResetFences, dev.id (), trunc_cast<uint32_t> (last - first), &first->id ()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ fence::wait (const device &d, fence *first, fence *last, uint64_t timeout)
|
|||||||
CHECK_LE (first, last);
|
CHECK_LE (first, last);
|
||||||
|
|
||||||
cruft::vk::error::try_func (
|
cruft::vk::error::try_func (
|
||||||
&vkWaitForFences, d.id (), trunc_cast<uint32_t> (last - first), &first->id (), VK_FALSE, timeout
|
vkWaitForFences, d.id (), trunc_cast<uint32_t> (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);
|
CHECK_LE (first, last);
|
||||||
|
|
||||||
cruft::vk::error::try_func (
|
cruft::vk::error::try_func (
|
||||||
&vkWaitForFences, d.id (), trunc_cast<uint32_t> (last - first), &first->id (), VK_TRUE, timeout
|
vkWaitForFences, d.id (), trunc_cast<uint32_t> (last - first), &first->id (), VK_TRUE, timeout
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -76,15 +76,15 @@ VK_DESCENDANT_TYPE_MAP (DESCENDANT)
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::vector<T>
|
std::vector<T>
|
||||||
cruft::vk::enumerated<T>::find (const instance &inst) {
|
cruft::vk::enumerated<T>::find (const instance &parent) {
|
||||||
// find the total number of objects
|
// find the total number of objects
|
||||||
uint32_t expected = 0;
|
uint32_t expected = 0;
|
||||||
error::try_code (enum_traits<T>::enumerate (inst.id (), &expected, nullptr));
|
error::try_code (enum_traits<T>::enumerate (parent.id (), &expected, nullptr));
|
||||||
|
|
||||||
// allocate an array of handles and fetch them
|
// allocate an array of handles and fetch them
|
||||||
uint32_t found = expected;
|
uint32_t found = expected;
|
||||||
typename T::id_t handles[expected];
|
typename T::id_t handles[expected];
|
||||||
error::try_code (enum_traits<T>::enumerate (inst.id (), &found, handles));
|
error::try_code (enum_traits<T>::enumerate (parent.id (), &found, handles));
|
||||||
|
|
||||||
// return an collection of objects from the handles
|
// return an collection of objects from the handles
|
||||||
return std::vector<T> (handles, handles + found);
|
return std::vector<T> (handles, handles + found);
|
||||||
|
@ -105,7 +105,8 @@ namespace cruft::vk {
|
|||||||
struct enumerated : public object<T> {
|
struct enumerated : public object<T> {
|
||||||
using object<T>::object;
|
using object<T>::object;
|
||||||
|
|
||||||
static std::vector<T> find (const instance&);
|
static std::vector<T>
|
||||||
|
find (const instance &parent);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ main (void)
|
|||||||
auto func = (decltype(&vkCreateDebugReportCallbackEXT))vkGetInstanceProcAddr (instance.id (),"vkCreateDebugReportCallbackEXT");
|
auto func = (decltype(&vkCreateDebugReportCallbackEXT))vkGetInstanceProcAddr (instance.id (),"vkCreateDebugReportCallbackEXT");
|
||||||
|
|
||||||
cruft::vk::error::try_func (
|
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.pImageIndices = &image_index;
|
||||||
present_info.pResults = nullptr;
|
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");
|
LOG_INFO ("entering runloop");
|
||||||
while (!glfwWindowShouldClose (window)) {
|
while (!glfwWindowShouldClose (window)) {
|
||||||
glfwPollEvents ();
|
glfwPollEvents ();
|
||||||
}
|
}
|
||||||
|
|
||||||
cruft::vk::error::try_func (&vkDeviceWaitIdle, ldevice.id ());
|
cruft::vk::error::try_func (vkDeviceWaitIdle, ldevice.id ());
|
||||||
|
|
||||||
LOG_INFO ("terminating glfw");
|
LOG_INFO ("terminating glfw");
|
||||||
glfwDestroyWindow (window);
|
glfwDestroyWindow (window);
|
||||||
|
Loading…
Reference in New Issue
Block a user