build: reduce type conversion warnings

This commit is contained in:
Danny Robson 2016-06-29 18:03:11 +10:00
parent 2969214138
commit f480668996
3 changed files with 27 additions and 9 deletions

View File

@ -20,6 +20,8 @@
#include "./event.hpp" #include "./event.hpp"
#include "./pipeline.hpp" #include "./pipeline.hpp"
#include <cruft/util/cast.hpp>
using vk::command_buffer; using vk::command_buffer;
@ -117,9 +119,9 @@ command_buffer::wait (util::view<const event*> events,
util::view<const VkImageMemoryBarrier*> VkImageMemoryBarriers) util::view<const VkImageMemoryBarrier*> VkImageMemoryBarriers)
{ {
vkCmdWaitEvents (id (), vkCmdWaitEvents (id (),
events.size (), &events.cbegin ()->id (), trunc_cast<uint32_t> (events.size ()), &events.cbegin ()->id (),
src_mask, dst_mask, src_mask, dst_mask,
VkMemoryBarriers.size (), VkMemoryBarriers.cbegin (), trunc_cast<uint32_t> (VkMemoryBarriers.size ()), VkMemoryBarriers.cbegin (),
VkBufferMemoryBarriers.size (), VkBufferMemoryBarriers.cbegin (), trunc_cast<uint32_t> (VkBufferMemoryBarriers.size ()), VkBufferMemoryBarriers.cbegin (),
VkImageMemoryBarriers.size (), VkImageMemoryBarriers.cbegin ()); trunc_cast<uint32_t> (VkImageMemoryBarriers.size ()), VkImageMemoryBarriers.cbegin ());
} }

View File

@ -19,6 +19,9 @@
#include "./physical_device.hpp" #include "./physical_device.hpp"
#include <cruft/util/cast.hpp>
#include <cruft/util/debug.hpp>
using vk::device; using vk::device;
@ -44,7 +47,9 @@ void
device::flush (const VkMappedMemoryRange *first, device::flush (const VkMappedMemoryRange *first,
const VkMappedMemoryRange *last) const VkMappedMemoryRange *last)
{ {
auto err = vkFlushMappedMemoryRanges (id (), last - first, first); CHECK_LE (first, last);
auto err = vkFlushMappedMemoryRanges (id (), trunc_cast<uint32_t> (last - first), first);
error::try_code (err); error::try_code (err);
} }
@ -54,7 +59,9 @@ void
device::invalidate (const VkMappedMemoryRange *first, device::invalidate (const VkMappedMemoryRange *first,
const VkMappedMemoryRange *last) const VkMappedMemoryRange *last)
{ {
auto err = vkInvalidateMappedMemoryRanges (id (), last - first, first); CHECK_LE (first, last);
auto err = vkInvalidateMappedMemoryRanges (id (), trunc_cast<uint32_t> (last - first), first);
error::try_code (err); error::try_code (err);
} }

View File

@ -19,6 +19,9 @@
#include "./device.hpp" #include "./device.hpp"
#include <cruft/util/cast.hpp>
#include <cruft/util/debug.hpp>
using vk::fence; using vk::fence;
@ -36,7 +39,9 @@ fence::is_ready (const device &dev)
void void
fence::reset (const device &dev, fence *first, fence *last) 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<uint32_t> (last - first), &first->id ());
} }
@ -44,7 +49,9 @@ fence::reset (const device &dev, fence *first, fence *last)
void void
fence::wait (const device &d, fence *first, fence *last, uint64_t timeout) 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<uint32_t> (last - first), &first->id (), VK_FALSE, timeout);
} }
@ -52,5 +59,7 @@ fence::wait (const device &d, fence *first, fence *last, uint64_t timeout)
void void
fence::wait_all (const device &d, fence *first, fence *last, uint64_t timeout) 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<uint32_t> (last - first), &first->id (), VK_TRUE, timeout);
} }