mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-12 07:03:34 +00:00
adding profiler
This commit is contained in:
@@ -6,12 +6,13 @@
|
||||
/* By: kbz_8 <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/10/20 22:02:37 by kbz_8 #+# #+# */
|
||||
/* Updated: 2024/01/07 00:09:18 by maldavid ### ########.fr */
|
||||
/* Updated: 2024/01/10 18:29:07 by maldavid ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include <mlx_profile.h>
|
||||
#include <core/errors.h>
|
||||
#include <core/profiler.h>
|
||||
#include <cstdio>
|
||||
|
||||
#define VMA_STATIC_VULKAN_FUNCTIONS 0
|
||||
@@ -86,6 +87,7 @@ namespace mlx
|
||||
|
||||
VmaAllocation GPUallocator::createBuffer(const VkBufferCreateInfo* binfo, const VmaAllocationCreateInfo* vinfo, VkBuffer& buffer, const char* name) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
VmaAllocation allocation;
|
||||
VkResult res = vmaCreateBuffer(_allocator, binfo, vinfo, &buffer, &allocation, nullptr);
|
||||
if(res != VK_SUCCESS)
|
||||
@@ -104,6 +106,7 @@ namespace mlx
|
||||
|
||||
void GPUallocator::destroyBuffer(VmaAllocation allocation, VkBuffer buffer) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
vkDeviceWaitIdle(Render_Core::get().getDevice().get());
|
||||
vmaDestroyBuffer(_allocator, buffer, allocation);
|
||||
#ifdef DEBUG
|
||||
@@ -114,6 +117,7 @@ namespace mlx
|
||||
|
||||
VmaAllocation GPUallocator::createImage(const VkImageCreateInfo* iminfo, const VmaAllocationCreateInfo* vinfo, VkImage& image, const char* name) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
VmaAllocation allocation;
|
||||
VkResult res = vmaCreateImage(_allocator, iminfo, vinfo, &image, &allocation, nullptr);
|
||||
if(res != VK_SUCCESS)
|
||||
@@ -132,6 +136,7 @@ namespace mlx
|
||||
|
||||
void GPUallocator::destroyImage(VmaAllocation allocation, VkImage image) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
vkDeviceWaitIdle(Render_Core::get().getDevice().get());
|
||||
vmaDestroyImage(_allocator, image, allocation);
|
||||
#ifdef DEBUG
|
||||
@@ -142,6 +147,7 @@ namespace mlx
|
||||
|
||||
void GPUallocator::mapMemory(VmaAllocation allocation, void** data) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
VkResult res = vmaMapMemory(_allocator, allocation, data);
|
||||
if(res != VK_SUCCESS)
|
||||
core::error::report(e_kind::fatal_error, "Graphics allocator : unable to map GPU memory to CPU memory, %s", RCore::verbaliseResultVk(res));
|
||||
@@ -149,6 +155,7 @@ namespace mlx
|
||||
|
||||
void GPUallocator::unmapMemory(VmaAllocation allocation) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
vmaUnmapMemory(_allocator, allocation);
|
||||
}
|
||||
|
||||
@@ -173,6 +180,7 @@ namespace mlx
|
||||
|
||||
void GPUallocator::flush(VmaAllocation allocation, VkDeviceSize size, VkDeviceSize offset) noexcept
|
||||
{
|
||||
MLX_PROFILE_FUNCTION();
|
||||
vmaFlushAllocation(_allocator, allocation, offset, size);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user