util: move cast functions into util::cast
This commit is contained in:
parent
660e325e5f
commit
3d2e7e647c
@ -123,10 +123,11 @@ command_buffer::wait (util::view<const event*> events,
|
|||||||
util::view<const VkBufferMemoryBarrier*> VkBufferMemoryBarriers,
|
util::view<const VkBufferMemoryBarrier*> VkBufferMemoryBarriers,
|
||||||
util::view<const VkImageMemoryBarrier*> VkImageMemoryBarriers)
|
util::view<const VkImageMemoryBarrier*> VkImageMemoryBarriers)
|
||||||
{
|
{
|
||||||
vkCmdWaitEvents (native (),
|
vkCmdWaitEvents (
|
||||||
trunc_cast<uint32_t> (events.size ()), &events.cbegin ()->native (),
|
native (),
|
||||||
|
util::cast::lossless<uint32_t> (events.size ()), &events.cbegin ()->native (),
|
||||||
src_mask, dst_mask,
|
src_mask, dst_mask,
|
||||||
trunc_cast<uint32_t> (VkMemoryBarriers.size ()), VkMemoryBarriers.cbegin (),
|
util::cast::lossless<uint32_t> (VkMemoryBarriers.size ()), VkMemoryBarriers.cbegin (),
|
||||||
trunc_cast<uint32_t> (VkBufferMemoryBarriers.size ()), VkBufferMemoryBarriers.cbegin (),
|
util::cast::lossless<uint32_t> (VkBufferMemoryBarriers.size ()), VkBufferMemoryBarriers.cbegin (),
|
||||||
trunc_cast<uint32_t> (VkImageMemoryBarriers.size ()), VkImageMemoryBarriers.cbegin ());
|
util::cast::lossless<uint32_t> (VkImageMemoryBarriers.size ()), VkImageMemoryBarriers.cbegin ());
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ device::flush (const VkMappedMemoryRange *first,
|
|||||||
{
|
{
|
||||||
CHECK_LE (first, last);
|
CHECK_LE (first, last);
|
||||||
|
|
||||||
auto err = vkFlushMappedMemoryRanges (native (), trunc_cast<uint32_t> (last - first), first);
|
auto err = vkFlushMappedMemoryRanges (native (), util::cast::lossless<uint32_t> (last - first), first);
|
||||||
error::try_code (err);
|
error::try_code (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ device::invalidate (const VkMappedMemoryRange *first,
|
|||||||
{
|
{
|
||||||
CHECK_LE (first, last);
|
CHECK_LE (first, last);
|
||||||
|
|
||||||
auto err = vkInvalidateMappedMemoryRanges (native (), trunc_cast<uint32_t> (last - first), first);
|
auto err = vkInvalidateMappedMemoryRanges (native (), util::cast::lossless<uint32_t> (last - first), first);
|
||||||
error::try_code (err);
|
error::try_code (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,15 @@ cruft::vk::map_t::~map_t ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
cruft::vk::map_t&
|
||||||
|
cruft::vk::map_t::operator= (std::nullptr_t ptr)
|
||||||
|
{
|
||||||
|
util::view<std::byte*>::operator= (ptr);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cruft::vk::map_t::destroy (device &_device, device_memory &_memory)
|
cruft::vk::map_t::destroy (device &_device, device_memory &_memory)
|
||||||
|
@ -32,8 +32,12 @@ namespace cruft::vk {
|
|||||||
public:
|
public:
|
||||||
using view::view;
|
using view::view;
|
||||||
|
|
||||||
|
map_t (const map_t&) = delete;
|
||||||
~map_t ();
|
~map_t ();
|
||||||
|
|
||||||
|
map_t& operator= (const map_t&) = delete;
|
||||||
|
map_t& operator= (std::nullptr_t);
|
||||||
|
|
||||||
void destroy (device&, device_memory&);
|
void destroy (device&, device_memory&);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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.native (), trunc_cast<uint32_t> (last - first), &first->native ()
|
vkResetFences, dev.native (), util::cast::lossless<uint32_t> (last - first), &first->native ()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ fence::wait (const device &d, fence *first, fence *last, uint64_t timeout)
|
|||||||
|
|
||||||
cruft::vk::error::try_func (
|
cruft::vk::error::try_func (
|
||||||
vkWaitForFences,
|
vkWaitForFences,
|
||||||
d.native (), trunc_cast<uint32_t> (last - first), &first->native (), VK_FALSE, timeout
|
d.native (), util::cast::lossless<uint32_t> (last - first), &first->native (), VK_FALSE, timeout
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +68,6 @@ fence::wait_all (const device &d, fence *first, fence *last, uint64_t timeout)
|
|||||||
|
|
||||||
cruft::vk::error::try_func (
|
cruft::vk::error::try_func (
|
||||||
vkWaitForFences,
|
vkWaitForFences,
|
||||||
d.native (), trunc_cast<uint32_t> (last - first), &first->native (), VK_TRUE, timeout
|
d.native (), util::cast::lossless<uint32_t> (last - first), &first->native (), VK_TRUE, timeout
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ pipeline_cache::merge (const device &dev,
|
|||||||
const pipeline_cache *last)
|
const pipeline_cache *last)
|
||||||
{
|
{
|
||||||
CHECK_GE (last, first);
|
CHECK_GE (last, first);
|
||||||
auto err = vkMergePipelineCaches (dev.native (), native (), trunc_cast<uint32_t> (last - first), &first->native ());
|
auto err = vkMergePipelineCaches (dev.native (), native (), util::cast::lossless<uint32_t> (last - first), &first->native ());
|
||||||
error::try_code (err);
|
error::try_code (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user