build: silence type shortening warnings under clang

This commit is contained in:
Danny Robson 2018-01-18 11:57:08 +11:00
parent 3d2e7e647c
commit 41fb2a0284
2 changed files with 11 additions and 11 deletions

View File

@ -51,16 +51,17 @@ namespace cruft::vk {
static auto
try_func (FuncT &&func, Args &&...args)
{
if constexpr (std::is_same_v<
typename func_traits<FuncT>::return_type,
VkResult
>)
{
constexpr bool returns_vkresult = std::is_same_v<
typename func_traits<FuncT>::return_type,
VkResult
>;
if constexpr (returns_vkresult) {
try_code (func (maybe_native (args)...));
return;
}
else
} else {
return func (maybe_native (args)...);
}
}

View File

@ -19,6 +19,7 @@
#include <GLFW/glfw3.h>
#include <GLFW/glfw3native.h>
#include <cruft/util/cast.hpp>
#include <cruft/util/extent.hpp>
#include <cruft/util/io.hpp>
#include <cruft/util/log.hpp>
@ -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<int> (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<uint32_t> (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<cruft::vk::framebuffer>;
std::vector<framebuffer_ptr> swapchain_framebuffers;
@ -880,6 +880,5 @@ main (void)
}
cruft::vk::error::try_func (vkDeviceWaitIdle, ldevice.native ());
LOG_INFO ("terminating");
}