8 #ifndef LLUVIA_CORE_MEMORY_MEMORY_H_
9 #define LLUVIA_CORE_MEMORY_MEMORY_H_
33 class ImageDescriptor;
35 class ImageViewDescriptor;
92 class Memory :
public std::enable_shared_from_this<ll::Memory> {
107 Memory(
const std::shared_ptr<ll::vulkan::Device>& device,
109 const uint64_t pageSize);
249 impl::MemoryAllocationTryInfo getSuitableMemoryPage(const vk::MemoryRequirements& memRequirements);
252 void releaseBuffer(const
ll::
Buffer& buffer);
253 void* mapBuffer(const
ll::
Buffer& buffer);
254 void unmapBuffer(const
ll::
Buffer& buffer);
256 void releaseImage(const
ll::
Image& image);
258 std::shared_ptr<
ll::vulkan::Device> m_device;
261 const uint64_t m_pageSize {0u};
263 std::vector<vk::DeviceMemory> m_memoryPages;
264 std::vector<ll::impl::MemoryFreeSpaceManager> m_pageManagers;
265 std::vector<bool> m_memoryPageMappingFlags;
MemoryFreeSpaceManager class.
MemoryPropertyFlags class.
Objects to manage raw portions of allocated memory.
Definition: Buffer.h:57
Stores all relevant information for creating ll::Image objects.
Definition: ImageDescriptor.h:189
Descriptor for ll::ImageView objects.
Definition: ImageViewDescriptor.h:41
Represents portions of a ll::Image to be sent as parameter to a GLSL shader.
Definition: ImageView.h:149
Objects to manage images.
Definition: Image.h:74
Class to manage allocation of objects into a specific type of memory.
Definition: Memory.h:92
std::shared_ptr< ll::Image > createImage(const ll::ImageDescriptor &descriptor)
Creates a new ll::Image object.
Memory(const std::shared_ptr< ll::vulkan::Device > &device, const ll::VkHeapInfo &heapInfo, const uint64_t pageSize)
Constructs a new ll::Memory object.
uint64_t getPageSize() const noexcept
Gets the page size.
std::shared_ptr< ll::ImageView > createImageView(const ll::ImageDescriptor &imgDescriptor, const ll::ImageViewDescriptor &viewDescriptor)
Creates an image view.
Memory(Memory &&memory)=delete
Memory(const Memory &memory)=delete
bool isPageMappable(const uint32_t page) const noexcept
Determines if a certain memory page is mappable.
Memory & operator=(Memory &&memory)=delete
std::shared_ptr< ll::Buffer > createBuffer(const uint64_t size)
Creates a buffer.
Memory & operator=(const Memory &memory)=delete
std::shared_ptr< ll::Buffer > createBufferWithUnsafeFlags(const uint64_t size, const uint32_t usageFlags)
Creates buffer with usage flags passed as integer type.
bool isMappable() const noexcept
Determines if this memory is mappable to host-visible memory.
uint32_t getPageCount() const noexcept
Gets the number of pages used.
ll::MemoryPropertyFlags getMemoryPropertyFlags() const noexcept
Gets the Vulkan memory property flags used to create this memory.
Structure to hold the allocation information of objects in memory.
Definition: MemoryAllocationInfo.h:19
Vulkan heap information.
Definition: Memory.h:41
std::vector< uint32_t > familyQueueIndices
Definition: Memory.h:61
uint64_t size
Definition: Memory.h:51
ll::MemoryPropertyFlags flags
Definition: Memory.h:56
uint32_t typeIndex
Definition: Memory.h:46