libcruft-vk/device_memory.cpp
2016-02-24 11:11:41 +11:00

40 lines
891 B
C++

#include "./device_memory.hpp"
#include "./device.hpp"
using vk::device_memory;
///////////////////////////////////////////////////////////////////////////////
void*
device_memory::map (const device &dev,
VkDeviceSize offset,
VkDeviceSize size,
VkMemoryMapFlags flags)
{
void *res;
auto err = vkMapMemory (dev.id (), id (), offset, size, flags, &res);
error::try_code (err);
return res;
}
//-----------------------------------------------------------------------------
void
device_memory::unmap (const device &dev)
{
vkUnmapMemory (dev.id (), id ());
}
///////////////////////////////////////////////////////////////////////////////
VkDeviceSize
device_memory::commitment (const device &dev) const
{
VkDeviceSize size;
vkGetDeviceMemoryCommitment (dev.id (), id (), &size);
return size;
}