mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
adding debug messages to renderer, working on VMA implementation
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2022/10/06 23:18:52 by maldavid #+# #+# */
|
||||
/* Updated: 2023/04/22 19:51:47 by maldavid ### ########.fr */
|
||||
/* Updated: 2023/11/08 22:33:18 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -26,37 +26,34 @@ namespace mlx
|
||||
void create(kind type, VkDeviceSize size, VkBufferUsageFlags usage, const void* data = nullptr);
|
||||
void destroy() noexcept;
|
||||
|
||||
inline void mapMem(void** data = nullptr, VkDeviceSize size = VK_WHOLE_SIZE, VkDeviceSize offset = 0) noexcept
|
||||
inline void mapMem(void** data = nullptr) noexcept
|
||||
{
|
||||
if(vkMapMemory(Render_Core::get().getDevice().get(), _memory, _offset + offset, size, 0, data) != VK_SUCCESS)
|
||||
core::error::report(e_kind::fatal_error, "Vulkan : failed to map a buffer");
|
||||
Render_Core::get().getAllocator().mapMemory(_allocation, data);
|
||||
_is_mapped = true;
|
||||
}
|
||||
inline bool isMapped() const noexcept { return _is_mapped; }
|
||||
inline void unmapMem() noexcept { vkUnmapMemory(Render_Core::get().getDevice().get(), _memory); _is_mapped = false; }
|
||||
inline void unmapMem() noexcept { Render_Core::get().getAllocator().unmapMemory(_allocation);_is_mapped = false; }
|
||||
|
||||
void flush(VkDeviceSize size = VK_WHOLE_SIZE, VkDeviceSize offset = 0);
|
||||
|
||||
inline unsigned int getSize() noexcept { return _size; }
|
||||
inline unsigned int getOffset() noexcept { return _offset; }
|
||||
inline VkDeviceMemory getDeviceMemory() noexcept { return _memory; }
|
||||
inline VkBuffer& operator()() noexcept { return _buffer; }
|
||||
inline VkBuffer& get() noexcept { return _buffer; }
|
||||
inline VkDeviceSize getSize() const noexcept { return _size; }
|
||||
|
||||
protected:
|
||||
void pushToGPU() noexcept;
|
||||
void swap(Buffer& buffer) noexcept;
|
||||
|
||||
VkDeviceMemory _memory = VK_NULL_HANDLE;
|
||||
VkDeviceSize _offset = 0;
|
||||
VkDeviceSize _size = 0;
|
||||
protected:
|
||||
VmaAllocation _allocation;
|
||||
VkBuffer _buffer = VK_NULL_HANDLE;
|
||||
VkDeviceSize _size = 0;
|
||||
|
||||
private:
|
||||
void createBuffer(VkBufferUsageFlags usage, VkMemoryPropertyFlags properties);
|
||||
void createBuffer(VkBufferUsageFlags usage, VmaAllocationCreateInfo info);
|
||||
|
||||
private:
|
||||
VkBufferUsageFlags _usage = 0;
|
||||
VkMemoryPropertyFlags _flags = 0;
|
||||
bool _is_mapped = false;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user