From f4806689966b7273cead1fb4ccc5d532d3f16958 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 29 Jun 2016 18:03:11 +1000 Subject: [PATCH] build: reduce type conversion warnings --- command_buffer.cpp | 10 ++++++---- device.cpp | 11 +++++++++-- fence.cpp | 15 ++++++++++++--- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/command_buffer.cpp b/command_buffer.cpp index ae21a5f..60bed16 100644 --- a/command_buffer.cpp +++ b/command_buffer.cpp @@ -20,6 +20,8 @@ #include "./event.hpp" #include "./pipeline.hpp" +#include + using vk::command_buffer; @@ -117,9 +119,9 @@ command_buffer::wait (util::view events, util::view VkImageMemoryBarriers) { vkCmdWaitEvents (id (), - events.size (), &events.cbegin ()->id (), + trunc_cast (events.size ()), &events.cbegin ()->id (), src_mask, dst_mask, - VkMemoryBarriers.size (), VkMemoryBarriers.cbegin (), - VkBufferMemoryBarriers.size (), VkBufferMemoryBarriers.cbegin (), - VkImageMemoryBarriers.size (), VkImageMemoryBarriers.cbegin ()); + trunc_cast (VkMemoryBarriers.size ()), VkMemoryBarriers.cbegin (), + trunc_cast (VkBufferMemoryBarriers.size ()), VkBufferMemoryBarriers.cbegin (), + trunc_cast (VkImageMemoryBarriers.size ()), VkImageMemoryBarriers.cbegin ()); } diff --git a/device.cpp b/device.cpp index 3911ef9..6e7e331 100644 --- a/device.cpp +++ b/device.cpp @@ -19,6 +19,9 @@ #include "./physical_device.hpp" +#include +#include + using vk::device; @@ -44,7 +47,9 @@ void device::flush (const VkMappedMemoryRange *first, const VkMappedMemoryRange *last) { - auto err = vkFlushMappedMemoryRanges (id (), last - first, first); + CHECK_LE (first, last); + + auto err = vkFlushMappedMemoryRanges (id (), trunc_cast (last - first), first); error::try_code (err); } @@ -54,7 +59,9 @@ void device::invalidate (const VkMappedMemoryRange *first, const VkMappedMemoryRange *last) { - auto err = vkInvalidateMappedMemoryRanges (id (), last - first, first); + CHECK_LE (first, last); + + auto err = vkInvalidateMappedMemoryRanges (id (), trunc_cast (last - first), first); error::try_code (err); } diff --git a/fence.cpp b/fence.cpp index 152a4a6..23d60ed 100644 --- a/fence.cpp +++ b/fence.cpp @@ -19,6 +19,9 @@ #include "./device.hpp" +#include +#include + using vk::fence; @@ -36,7 +39,9 @@ fence::is_ready (const device &dev) void fence::reset (const device &dev, fence *first, fence *last) { - vkResetFences (dev.id (), last - first, &first->id ()); + CHECK_LE (first, last); + + vkResetFences (dev.id (), trunc_cast (last - first), &first->id ()); } @@ -44,7 +49,9 @@ fence::reset (const device &dev, fence *first, fence *last) void fence::wait (const device &d, fence *first, fence *last, uint64_t timeout) { - vkWaitForFences (d.id (), last - first, &first->id (), VK_FALSE, timeout); + CHECK_LE (first, last); + + vkWaitForFences (d.id (), trunc_cast (last - first), &first->id (), VK_FALSE, timeout); } @@ -52,5 +59,7 @@ fence::wait (const device &d, fence *first, fence *last, uint64_t timeout) void fence::wait_all (const device &d, fence *first, fence *last, uint64_t timeout) { - vkWaitForFences (d.id (), last - first, &first->id (), VK_TRUE, timeout); + CHECK_LE (first, last); + + vkWaitForFences (d.id (), trunc_cast (last - first), &first->id (), VK_TRUE, timeout); }