1
0
Fork 0
Univerxel/src/client/render/vk/api/Memory.hpp

32 lines
737 B
C++

#pragma once
#include "../forward.hpp"
#include <memory>
#include <array>
namespace render::vk { struct Allocation; }
namespace render::vk::memory {
constexpr VkMemoryPropertyFlags HOST_EASILY_WRITABLE = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
struct area {
VkDeviceMemory ref;
VkDeviceSize size;
VkDeviceSize offset;
void *ptr = nullptr;
void write(const void*, VkDeviceSize size, VkDeviceSize offset = 0);
void read(void*, VkDeviceSize size, VkDeviceSize offset = 0);
};
class Deleter {
public:
Deleter(Allocation *owner): owner(owner) { }
void operator()(area *);
private:
Allocation *owner;
};
using ptr = std::unique_ptr<area, Deleter>;
ptr GetNull();
}