fixing memory leaks, begenning xmake support to build on windows

This commit is contained in:
2023-12-07 23:19:56 +01:00
parent 53c0f08bc1
commit 854a074cac
14 changed files with 1306 additions and 17 deletions

View File

@@ -6,7 +6,7 @@
# By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ # # By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2022/10/04 16:43:41 by maldavid #+# #+# # # Created: 2022/10/04 16:43:41 by maldavid #+# #+# #
# Updated: 2023/11/24 10:03:17 by maldavid ### ########.fr # # Updated: 2023/12/07 15:25:52 by kbz_8 ### ########.fr #
# # # #
# **************************************************************************** # # **************************************************************************** #
@@ -17,7 +17,7 @@ SRCS += $(wildcard $(addsuffix /*.cpp, ./src/platform))
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer)) SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer))
SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer/**)) SRCS += $(wildcard $(addsuffix /*.cpp, ./src/renderer/**))
OBJ_DIR = objs OBJ_DIR = objs/makefile
OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o)) OBJS = $(addprefix $(OBJ_DIR)/, $(SRCS:.cpp=.o))
OS = $(shell uname -s) OS = $(shell uname -s)

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/04 17:35:20 by maldavid #+# #+# */ /* Created: 2022/10/04 17:35:20 by maldavid #+# #+# */
/* Updated: 2023/11/25 10:12:36 by maldavid ### ########.fr */ /* Updated: 2023/12/07 23:05:05 by kbz_8 ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -26,8 +26,8 @@ extern "C"
mlx::core::error::report(e_kind::error, "MLX cannot be initialized multiple times"); mlx::core::error::report(e_kind::error, "MLX cannot be initialized multiple times");
return NULL; return NULL;
} }
mlx::Render_Core::get().init();
mlx::core::Application* app = new mlx::core::Application; mlx::core::Application* app = new mlx::core::Application;
mlx::Render_Core::get().init();
if(app == nullptr) if(app == nullptr)
mlx::core::error::report(e_kind::fatal_error, "Tout a pété"); mlx::core::error::report(e_kind::fatal_error, "Tout a pété");
init = true; init = true;

47
src/core/memory.cpp git.filemode.normal_file
View File

@@ -0,0 +1,47 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* memory.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kbz_8 </var/spool/mail/kbz_8> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/07 16:32:01 by kbz_8 #+# #+# */
/* Updated: 2023/12/07 16:43:56 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
#include <core/memory.h>
#include <core/errors.h>
#include <algorithm>
#include <stdlib.h>
namespace mlx
{
void* MemManager::alloc(std::size_t size)
{
void* ptr = std::malloc(size);
if(ptr != nullptr)
_blocks.push_back(ptr);
return ptr;
}
void MemManager::free(void* ptr)
{
auto it = std::find(_blocks.begin(), _blocks.end(), ptr);
if(it == _blocks.end())
{
core::error::report(e_kind::error, "Memory Manager : trying to free a pointer not allocated by the memory manager");
return;
}
std::free(*it);
_blocks.erase(it);
}
MemManager::~MemManager()
{
std::for_each(_blocks.begin(), _blocks.end(), [](void* ptr)
{
std::free(ptr);
});
}
}

38
src/core/memory.h git.filemode.normal_file
View File

@@ -0,0 +1,38 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* memory.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kbz_8 </var/spool/mail/kbz_8> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/12/07 16:31:51 by kbz_8 #+# #+# */
/* Updated: 2023/12/07 16:37:15 by kbz_8 ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef __MLX_MEMORY__
#define __MLX_MEMORY__
#include <utils/singleton.h>
#include <list>
namespace mlx
{
class MemManager : public Singleton<MemManager>
{
friend class Singleton<MemManager>;
public:
void* alloc(std::size_t size);
void free(void* ptr);
private:
MemManager() = default;
~MemManager();
private:
std::list<void*> _blocks;
};
}
#endif

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/23 18:40:44 by maldavid #+# #+# */ /* Created: 2023/01/23 18:40:44 by maldavid #+# #+# */
/* Updated: 2023/11/12 01:14:52 by maldavid ### ########.fr */ /* Updated: 2023/12/07 20:00:13 by kbz_8 ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/23 18:39:36 by maldavid #+# #+# */ /* Created: 2023/01/23 18:39:36 by maldavid #+# #+# */
/* Updated: 2023/03/31 17:28:36 by maldavid ### ########.fr */ /* Updated: 2023/12/07 19:47:07 by kbz_8 ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/07 16:36:33 by maldavid #+# #+# */ /* Created: 2023/04/07 16:36:33 by maldavid #+# #+# */
/* Updated: 2023/11/14 05:36:30 by maldavid ### ########.fr */ /* Updated: 2023/12/07 18:50:53 by kbz_8 ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -28,7 +28,7 @@ namespace mlx
void render(class Renderer& renderer, int x, int y, uint32_t ibo_size); void render(class Renderer& renderer, int x, int y, uint32_t ibo_size);
void destroy() noexcept override; void destroy() noexcept override;
inline void setDescriptor(DescriptorSet set) noexcept { _set = std::move(set); } inline void setDescriptor(DescriptorSet&& set) noexcept { _set = set; }
inline VkDescriptorSet getSet() noexcept { return _set.isInit() ? _set.get() : VK_NULL_HANDLE; } inline VkDescriptorSet getSet() noexcept { return _set.isInit() ? _set.get() : VK_NULL_HANDLE; }
inline void updateSet(int binding) noexcept { _set.writeDescriptor(binding, getImageView(), getSampler()); } inline void updateSet(int binding) noexcept { _set.writeDescriptor(binding, getImageView(), getSampler()); }

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/04/06 16:41:13 by maldavid #+# #+# */ /* Created: 2023/04/06 16:41:13 by maldavid #+# #+# */
/* Updated: 2023/11/25 10:40:39 by maldavid ### ########.fr */ /* Updated: 2023/12/07 22:29:45 by kbz_8 ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -20,7 +20,11 @@
#define STB_RECT_PACK_IMPLEMENTATION #define STB_RECT_PACK_IMPLEMENTATION
#include <stb_rect_pack.h> #include <stb_rect_pack.h>
#include <core/memory.h>
#define STB_TRUETYPE_IMPLEMENTATION #define STB_TRUETYPE_IMPLEMENTATION
#define STB_malloc(x, u) ((void)(u), MemManager::get().alloc(x))
#define STB_free(x, u) ((void)(u), MemManager::get().free(x))
#include <stb_truetype.h> #include <stb_truetype.h>
constexpr const int RANGE = 1024; constexpr const int RANGE = 1024;
@@ -74,10 +78,10 @@ namespace mlx
void TextPutPipeline::init(Renderer* renderer) noexcept void TextPutPipeline::init(Renderer* renderer) noexcept
{ {
_renderer = renderer; _renderer = renderer;
uint8_t tmp_bitmap[RANGE * RANGE]; std::vector<uint8_t> tmp_bitmap(RANGE * RANGE);
uint8_t vulkan_bitmap[RANGE * RANGE * 4]; std::vector<uint8_t> vulkan_bitmap(RANGE * RANGE * 4);
stbtt_pack_context pc; stbtt_pack_context pc;
stbtt_PackBegin(&pc, tmp_bitmap, RANGE, RANGE, RANGE, 1, nullptr); stbtt_PackBegin(&pc, tmp_bitmap.data(), RANGE, RANGE, RANGE, 1, nullptr);
stbtt_PackFontRange(&pc, dogica_ttf, 0, 6.0, 32, 96, _cdata.data()); stbtt_PackFontRange(&pc, dogica_ttf, 0, 6.0, 32, 96, _cdata.data());
stbtt_PackEnd(&pc); stbtt_PackEnd(&pc);
for(int i = 0, j = 0; i < RANGE * RANGE; i++, j += 4) for(int i = 0, j = 0; i < RANGE * RANGE; i++, j += 4)
@@ -87,14 +91,14 @@ namespace mlx
vulkan_bitmap[j + 2] = tmp_bitmap[i]; vulkan_bitmap[j + 2] = tmp_bitmap[i];
vulkan_bitmap[j + 3] = tmp_bitmap[i]; vulkan_bitmap[j + 3] = tmp_bitmap[i];
} }
_atlas.create(vulkan_bitmap, RANGE, RANGE, VK_FORMAT_R8G8B8A8_UNORM, "__mlx_texts_pipeline_texture_atlas", true); _atlas.create(vulkan_bitmap.data(), RANGE, RANGE, VK_FORMAT_R8G8B8A8_UNORM, "__mlx_texts_pipeline_texture_atlas", true);
_atlas.setDescriptor(renderer->getFragDescriptorSet().duplicate()); _atlas.setDescriptor(renderer->getFragDescriptorSet().duplicate());
} }
void TextPutPipeline::loadFont(const std::filesystem::path& filepath, float scale) void TextPutPipeline::loadFont(const std::filesystem::path& filepath, float scale)
{ {
uint8_t tmp_bitmap[RANGE * RANGE]; std::vector<uint8_t> tmp_bitmap(RANGE * RANGE);
uint8_t vulkan_bitmap[RANGE * RANGE * 4]; std::vector<uint8_t> vulkan_bitmap(RANGE * RANGE * 4);
std::ifstream file(filepath, std::ios::binary); std::ifstream file(filepath, std::ios::binary);
if(!file.is_open()) if(!file.is_open())
@@ -109,7 +113,7 @@ namespace mlx
file.close(); file.close();
stbtt_pack_context pc; stbtt_pack_context pc;
stbtt_PackBegin(&pc, tmp_bitmap, RANGE, RANGE, RANGE, 1, nullptr); stbtt_PackBegin(&pc, tmp_bitmap.data(), RANGE, RANGE, RANGE, 1, nullptr);
stbtt_PackFontRange(&pc, bytes.data(), 0, scale, 32, 96, _cdata.data()); stbtt_PackFontRange(&pc, bytes.data(), 0, scale, 32, 96, _cdata.data());
stbtt_PackEnd(&pc); stbtt_PackEnd(&pc);
for(int i = 0, j = 0; i < RANGE * RANGE; i++, j += 4) for(int i = 0, j = 0; i < RANGE * RANGE; i++, j += 4)
@@ -120,7 +124,7 @@ namespace mlx
vulkan_bitmap[j + 3] = tmp_bitmap[i]; vulkan_bitmap[j + 3] = tmp_bitmap[i];
} }
destroy(); destroy();
_atlas.create(vulkan_bitmap, RANGE, RANGE, VK_FORMAT_R8G8B8A8_UNORM, "__mlx_texts_pipeline_texture_atlas", true); _atlas.create(vulkan_bitmap.data(), RANGE, RANGE, VK_FORMAT_R8G8B8A8_UNORM, "__mlx_texts_pipeline_texture_atlas", true);
_atlas.setDescriptor(_renderer->getFragDescriptorSet().duplicate()); _atlas.setDescriptor(_renderer->getFragDescriptorSet().duplicate());
} }

234
test/memory_dump0.json git.filemode.normal_file
View File

@@ -0,0 +1,234 @@
{
"General": {
"API": "Vulkan",
"apiVersion": "1.3.260",
"GPU": "NVIDIA GeForce GTX 1650",
"deviceType": 2,
"maxMemoryAllocationCount": 4294967295,
"bufferImageGranularity": 1024,
"nonCoherentAtomSize": 64,
"memoryHeapCount": 3,
"memoryTypeCount": 5
},
"Total": {
"BlockCount": 5,
"BlockBytes": 73007104,
"AllocationCount": 19,
"AllocationBytes": 2668256,
"UnusedRangeCount": 6,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33433984
},
"MemoryInfo": {
"Heap 0": {
"Flags": ["DEVICE_LOCAL"],
"Size": 4294967296,
"Budget": {
"BudgetBytes": 3435973836,
"UsageBytes": 35422208
},
"Stats": {
"BlockCount": 3,
"BlockBytes": 35422208,
"AllocationCount": 14,
"AllocationBytes": 1988064,
"UnusedRangeCount": 4,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33433984
},
"MemoryPools": {
"Type 1": {
"Flags": ["DEVICE_LOCAL"],
"Stats": {
"BlockCount": 3,
"BlockBytes": 35422208,
"AllocationCount": 14,
"AllocationBytes": 1988064,
"UnusedRangeCount": 4,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33433984
}
}
}
},
"Heap 1": {
"Flags": [],
"Size": 6071976960,
"Budget": {
"BudgetBytes": 4857581568,
"UsageBytes": 33554432
},
"Stats": {
"BlockCount": 1,
"BlockBytes": 33554432,
"AllocationCount": 2,
"AllocationBytes": 680000,
"UnusedRangeCount": 1,
"AllocationSizeMin": 40000,
"AllocationSizeMax": 640000
},
"MemoryPools": {
"Type 0": {
"Flags": [],
"Stats": {
"BlockCount": 0,
"BlockBytes": 0,
"AllocationCount": 0,
"AllocationBytes": 0,
"UnusedRangeCount": 0
}
},
"Type 2": {
"Flags": ["HOST_VISIBLE", "HOST_COHERENT"],
"Stats": {
"BlockCount": 1,
"BlockBytes": 33554432,
"AllocationCount": 2,
"AllocationBytes": 680000,
"UnusedRangeCount": 1,
"AllocationSizeMin": 40000,
"AllocationSizeMax": 640000
}
},
"Type 3": {
"Flags": ["HOST_VISIBLE", "HOST_COHERENT", "HOST_CACHED"],
"Stats": {
"BlockCount": 0,
"BlockBytes": 0,
"AllocationCount": 0,
"AllocationBytes": 0,
"UnusedRangeCount": 0
}
}
}
},
"Heap 2": {
"Flags": ["DEVICE_LOCAL"],
"Size": 257949696,
"Budget": {
"BudgetBytes": 206359756,
"UsageBytes": 4030464
},
"Stats": {
"BlockCount": 1,
"BlockBytes": 4030464,
"AllocationCount": 3,
"AllocationBytes": 192,
"UnusedRangeCount": 1,
"AllocationSizeMin": 64,
"AllocationSizeMax": 64
},
"MemoryPools": {
"Type 4": {
"Flags": ["DEVICE_LOCAL", "HOST_VISIBLE", "HOST_COHERENT"],
"Stats": {
"BlockCount": 1,
"BlockBytes": 4030464,
"AllocationCount": 3,
"AllocationBytes": 192,
"UnusedRangeCount": 1,
"AllocationSizeMin": 64,
"AllocationSizeMax": 64
}
}
}
}
},
"DefaultPools": {
"Type 0": {
"PreferredBlockSize": 268435456,
"Blocks": {
},
"DedicatedAllocations": [
]
},
"Type 1": {
"PreferredBlockSize": 268435456,
"Blocks": {
"0": {
"MapRefCount": 0,
"TotalBytes": 33554432,
"UnusedBytes": 33434144,
"Allocations": 12,
"UnusedRanges": 4,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "__mlx_pixel_put_pipeline_texture_GPU_vertex_buffer"},
{"Offset": 128, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "__mlx_pixel_put_pipeline_texture_GPU_index_buffer"},
{"Offset": 140, "Type": "FREE", "Size": 4},
{"Offset": 144, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "42_logo.png_GPU_vertex_buffer"},
{"Offset": 272, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "42_logo.png_GPU_index_buffer"},
{"Offset": 284, "Type": "FREE", "Size": 4},
{"Offset": 288, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "__mlx_unamed_user_texture_GPU_vertex_buffer"},
{"Offset": 416, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "__mlx_unamed_user_texture_GPU_index_buffer"},
{"Offset": 428, "Type": "BUFFER", "Size": 288, "Usage": 66, "Name": "that text will disappear_GPU_index_buffer"},
{"Offset": 716, "Type": "BUFFER", "Size": 156, "Usage": 66, "Name": "that's a text_GPU_index_buffer"},
{"Offset": 872, "Type": "FREE", "Size": 152},
{"Offset": 1024, "Type": "IMAGE_OPTIMAL", "Size": 57344, "Usage": 7, "Name": "42_logo.png"},
{"Offset": 58368, "Type": "IMAGE_OPTIMAL", "Size": 57344, "Usage": 7, "Name": "__mlx_unamed_user_texture"},
{"Offset": 115712, "Type": "BUFFER", "Size": 3072, "Usage": 130, "Name": "that text will disappear_GPU_vertex_buffer"},
{"Offset": 118784, "Type": "BUFFER", "Size": 1664, "Usage": 130, "Name": "that's a text_GPU_vertex_buffer"},
{"Offset": 120448, "Type": "FREE", "Size": 33433984}
]
}
},
"DedicatedAllocations": [
{"Type": "IMAGE_OPTIMAL", "Size": 819200, "Usage": 7, "Name": "__mlx_pixel_put_pipeline_texture"},
{"Type": "IMAGE_OPTIMAL", "Size": 1048576, "Usage": 7, "Name": "__mlx_texts_pipeline_texture_atlas"}
]
},
"Type 2": {
"PreferredBlockSize": 268435456,
"Blocks": {
"0": {
"MapRefCount": 2,
"TotalBytes": 33554432,
"UnusedBytes": 32874432,
"Allocations": 2,
"UnusedRanges": 1,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 640000, "Usage": 1, "Name": "__mlx_pixel_put_pipeline_texture_buffer"},
{"Offset": 640000, "Type": "BUFFER", "Size": 40000, "Usage": 3, "Name": "__mlx_unamed_user_texture_buffer"},
{"Offset": 680000, "Type": "FREE", "Size": 32874432}
]
}
},
"DedicatedAllocations": [
]
},
"Type 3": {
"PreferredBlockSize": 268435456,
"Blocks": {
},
"DedicatedAllocations": [
]
},
"Type 4": {
"PreferredBlockSize": 32243712,
"Blocks": {
"0": {
"MapRefCount": 3,
"TotalBytes": 4030464,
"UnusedBytes": 4030272,
"Allocations": 3,
"UnusedRanges": 1,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_0_buffer"},
{"Offset": 64, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_1_buffer"},
{"Offset": 128, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_2_buffer"},
{"Offset": 192, "Type": "FREE", "Size": 4030272}
]
}
},
"DedicatedAllocations": [
]
}
},
"CustomPools": {
}
}

232
test/memory_dump1.json git.filemode.normal_file
View File

@@ -0,0 +1,232 @@
{
"General": {
"API": "Vulkan",
"apiVersion": "1.3.260",
"GPU": "NVIDIA GeForce GTX 1650",
"deviceType": 2,
"maxMemoryAllocationCount": 4294967295,
"bufferImageGranularity": 1024,
"nonCoherentAtomSize": 64,
"memoryHeapCount": 3,
"memoryTypeCount": 5
},
"Total": {
"BlockCount": 5,
"BlockBytes": 73007104,
"AllocationCount": 17,
"AllocationBytes": 2664896,
"UnusedRangeCount": 6,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
},
"MemoryInfo": {
"Heap 0": {
"Flags": ["DEVICE_LOCAL"],
"Size": 4294967296,
"Budget": {
"BudgetBytes": 3435973836,
"UsageBytes": 35422208
},
"Stats": {
"BlockCount": 3,
"BlockBytes": 35422208,
"AllocationCount": 12,
"AllocationBytes": 1984704,
"UnusedRangeCount": 4,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
},
"MemoryPools": {
"Type 1": {
"Flags": ["DEVICE_LOCAL"],
"Stats": {
"BlockCount": 3,
"BlockBytes": 35422208,
"AllocationCount": 12,
"AllocationBytes": 1984704,
"UnusedRangeCount": 4,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
}
}
}
},
"Heap 1": {
"Flags": [],
"Size": 6071976960,
"Budget": {
"BudgetBytes": 4857581568,
"UsageBytes": 33554432
},
"Stats": {
"BlockCount": 1,
"BlockBytes": 33554432,
"AllocationCount": 2,
"AllocationBytes": 680000,
"UnusedRangeCount": 1,
"AllocationSizeMin": 40000,
"AllocationSizeMax": 640000
},
"MemoryPools": {
"Type 0": {
"Flags": [],
"Stats": {
"BlockCount": 0,
"BlockBytes": 0,
"AllocationCount": 0,
"AllocationBytes": 0,
"UnusedRangeCount": 0
}
},
"Type 2": {
"Flags": ["HOST_VISIBLE", "HOST_COHERENT"],
"Stats": {
"BlockCount": 1,
"BlockBytes": 33554432,
"AllocationCount": 2,
"AllocationBytes": 680000,
"UnusedRangeCount": 1,
"AllocationSizeMin": 40000,
"AllocationSizeMax": 640000
}
},
"Type 3": {
"Flags": ["HOST_VISIBLE", "HOST_COHERENT", "HOST_CACHED"],
"Stats": {
"BlockCount": 0,
"BlockBytes": 0,
"AllocationCount": 0,
"AllocationBytes": 0,
"UnusedRangeCount": 0
}
}
}
},
"Heap 2": {
"Flags": ["DEVICE_LOCAL"],
"Size": 257949696,
"Budget": {
"BudgetBytes": 206359756,
"UsageBytes": 4030464
},
"Stats": {
"BlockCount": 1,
"BlockBytes": 4030464,
"AllocationCount": 3,
"AllocationBytes": 192,
"UnusedRangeCount": 1,
"AllocationSizeMin": 64,
"AllocationSizeMax": 64
},
"MemoryPools": {
"Type 4": {
"Flags": ["DEVICE_LOCAL", "HOST_VISIBLE", "HOST_COHERENT"],
"Stats": {
"BlockCount": 1,
"BlockBytes": 4030464,
"AllocationCount": 3,
"AllocationBytes": 192,
"UnusedRangeCount": 1,
"AllocationSizeMin": 64,
"AllocationSizeMax": 64
}
}
}
}
},
"DefaultPools": {
"Type 0": {
"PreferredBlockSize": 268435456,
"Blocks": {
},
"DedicatedAllocations": [
]
},
"Type 1": {
"PreferredBlockSize": 268435456,
"Blocks": {
"0": {
"MapRefCount": 0,
"TotalBytes": 33554432,
"UnusedBytes": 33437504,
"Allocations": 10,
"UnusedRanges": 4,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "__mlx_pixel_put_pipeline_texture_GPU_vertex_buffer"},
{"Offset": 128, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "__mlx_pixel_put_pipeline_texture_GPU_index_buffer"},
{"Offset": 140, "Type": "FREE", "Size": 4},
{"Offset": 144, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "42_logo.png_GPU_vertex_buffer"},
{"Offset": 272, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "42_logo.png_GPU_index_buffer"},
{"Offset": 284, "Type": "FREE", "Size": 4},
{"Offset": 288, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "__mlx_unamed_user_texture_GPU_vertex_buffer"},
{"Offset": 416, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "__mlx_unamed_user_texture_GPU_index_buffer"},
{"Offset": 428, "Type": "BUFFER", "Size": 156, "Usage": 66, "Name": "that's a text_GPU_index_buffer"},
{"Offset": 584, "Type": "FREE", "Size": 440},
{"Offset": 1024, "Type": "IMAGE_OPTIMAL", "Size": 57344, "Usage": 7, "Name": "42_logo.png"},
{"Offset": 58368, "Type": "IMAGE_OPTIMAL", "Size": 57344, "Usage": 7, "Name": "__mlx_unamed_user_texture"},
{"Offset": 115712, "Type": "BUFFER", "Size": 1664, "Usage": 130, "Name": "that's a text_GPU_vertex_buffer"},
{"Offset": 117376, "Type": "FREE", "Size": 33437056}
]
}
},
"DedicatedAllocations": [
{"Type": "IMAGE_OPTIMAL", "Size": 819200, "Usage": 7, "Name": "__mlx_pixel_put_pipeline_texture"},
{"Type": "IMAGE_OPTIMAL", "Size": 1048576, "Usage": 7, "Name": "__mlx_texts_pipeline_texture_atlas"}
]
},
"Type 2": {
"PreferredBlockSize": 268435456,
"Blocks": {
"0": {
"MapRefCount": 2,
"TotalBytes": 33554432,
"UnusedBytes": 32874432,
"Allocations": 2,
"UnusedRanges": 1,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 640000, "Usage": 1, "Name": "__mlx_pixel_put_pipeline_texture_buffer"},
{"Offset": 640000, "Type": "BUFFER", "Size": 40000, "Usage": 3, "Name": "__mlx_unamed_user_texture_buffer"},
{"Offset": 680000, "Type": "FREE", "Size": 32874432}
]
}
},
"DedicatedAllocations": [
]
},
"Type 3": {
"PreferredBlockSize": 268435456,
"Blocks": {
},
"DedicatedAllocations": [
]
},
"Type 4": {
"PreferredBlockSize": 32243712,
"Blocks": {
"0": {
"MapRefCount": 3,
"TotalBytes": 4030464,
"UnusedBytes": 4030272,
"Allocations": 3,
"UnusedRanges": 1,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_0_buffer"},
{"Offset": 64, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_1_buffer"},
{"Offset": 128, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_2_buffer"},
{"Offset": 192, "Type": "FREE", "Size": 4030272}
]
}
},
"DedicatedAllocations": [
]
}
},
"CustomPools": {
}
}

232
test/memory_dump2.json git.filemode.normal_file
View File

@@ -0,0 +1,232 @@
{
"General": {
"API": "Vulkan",
"apiVersion": "1.3.260",
"GPU": "NVIDIA GeForce GTX 1650",
"deviceType": 2,
"maxMemoryAllocationCount": 4294967295,
"bufferImageGranularity": 1024,
"nonCoherentAtomSize": 64,
"memoryHeapCount": 3,
"memoryTypeCount": 5
},
"Total": {
"BlockCount": 5,
"BlockBytes": 73007104,
"AllocationCount": 17,
"AllocationBytes": 2664896,
"UnusedRangeCount": 6,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
},
"MemoryInfo": {
"Heap 0": {
"Flags": ["DEVICE_LOCAL"],
"Size": 4294967296,
"Budget": {
"BudgetBytes": 3435973836,
"UsageBytes": 35422208
},
"Stats": {
"BlockCount": 3,
"BlockBytes": 35422208,
"AllocationCount": 12,
"AllocationBytes": 1984704,
"UnusedRangeCount": 4,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
},
"MemoryPools": {
"Type 1": {
"Flags": ["DEVICE_LOCAL"],
"Stats": {
"BlockCount": 3,
"BlockBytes": 35422208,
"AllocationCount": 12,
"AllocationBytes": 1984704,
"UnusedRangeCount": 4,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
}
}
}
},
"Heap 1": {
"Flags": [],
"Size": 6071976960,
"Budget": {
"BudgetBytes": 4857581568,
"UsageBytes": 33554432
},
"Stats": {
"BlockCount": 1,
"BlockBytes": 33554432,
"AllocationCount": 2,
"AllocationBytes": 680000,
"UnusedRangeCount": 1,
"AllocationSizeMin": 40000,
"AllocationSizeMax": 640000
},
"MemoryPools": {
"Type 0": {
"Flags": [],
"Stats": {
"BlockCount": 0,
"BlockBytes": 0,
"AllocationCount": 0,
"AllocationBytes": 0,
"UnusedRangeCount": 0
}
},
"Type 2": {
"Flags": ["HOST_VISIBLE", "HOST_COHERENT"],
"Stats": {
"BlockCount": 1,
"BlockBytes": 33554432,
"AllocationCount": 2,
"AllocationBytes": 680000,
"UnusedRangeCount": 1,
"AllocationSizeMin": 40000,
"AllocationSizeMax": 640000
}
},
"Type 3": {
"Flags": ["HOST_VISIBLE", "HOST_COHERENT", "HOST_CACHED"],
"Stats": {
"BlockCount": 0,
"BlockBytes": 0,
"AllocationCount": 0,
"AllocationBytes": 0,
"UnusedRangeCount": 0
}
}
}
},
"Heap 2": {
"Flags": ["DEVICE_LOCAL"],
"Size": 257949696,
"Budget": {
"BudgetBytes": 206359756,
"UsageBytes": 4030464
},
"Stats": {
"BlockCount": 1,
"BlockBytes": 4030464,
"AllocationCount": 3,
"AllocationBytes": 192,
"UnusedRangeCount": 1,
"AllocationSizeMin": 64,
"AllocationSizeMax": 64
},
"MemoryPools": {
"Type 4": {
"Flags": ["DEVICE_LOCAL", "HOST_VISIBLE", "HOST_COHERENT"],
"Stats": {
"BlockCount": 1,
"BlockBytes": 4030464,
"AllocationCount": 3,
"AllocationBytes": 192,
"UnusedRangeCount": 1,
"AllocationSizeMin": 64,
"AllocationSizeMax": 64
}
}
}
}
},
"DefaultPools": {
"Type 0": {
"PreferredBlockSize": 268435456,
"Blocks": {
},
"DedicatedAllocations": [
]
},
"Type 1": {
"PreferredBlockSize": 268435456,
"Blocks": {
"0": {
"MapRefCount": 0,
"TotalBytes": 33554432,
"UnusedBytes": 33437504,
"Allocations": 10,
"UnusedRanges": 4,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "__mlx_pixel_put_pipeline_texture_GPU_vertex_buffer"},
{"Offset": 128, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "__mlx_pixel_put_pipeline_texture_GPU_index_buffer"},
{"Offset": 140, "Type": "FREE", "Size": 4},
{"Offset": 144, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "42_logo.png_GPU_vertex_buffer"},
{"Offset": 272, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "42_logo.png_GPU_index_buffer"},
{"Offset": 284, "Type": "FREE", "Size": 4},
{"Offset": 288, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "__mlx_unamed_user_texture_GPU_vertex_buffer"},
{"Offset": 416, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "__mlx_unamed_user_texture_GPU_index_buffer"},
{"Offset": 428, "Type": "BUFFER", "Size": 156, "Usage": 66, "Name": "that's a text_GPU_index_buffer"},
{"Offset": 584, "Type": "FREE", "Size": 440},
{"Offset": 1024, "Type": "IMAGE_OPTIMAL", "Size": 57344, "Usage": 7, "Name": "42_logo.png"},
{"Offset": 58368, "Type": "IMAGE_OPTIMAL", "Size": 57344, "Usage": 7, "Name": "__mlx_unamed_user_texture"},
{"Offset": 115712, "Type": "BUFFER", "Size": 1664, "Usage": 130, "Name": "that's a text_GPU_vertex_buffer"},
{"Offset": 117376, "Type": "FREE", "Size": 33437056}
]
}
},
"DedicatedAllocations": [
{"Type": "IMAGE_OPTIMAL", "Size": 819200, "Usage": 7, "Name": "__mlx_pixel_put_pipeline_texture"},
{"Type": "IMAGE_OPTIMAL", "Size": 1048576, "Usage": 7, "Name": "__mlx_texts_pipeline_texture_atlas"}
]
},
"Type 2": {
"PreferredBlockSize": 268435456,
"Blocks": {
"0": {
"MapRefCount": 2,
"TotalBytes": 33554432,
"UnusedBytes": 32874432,
"Allocations": 2,
"UnusedRanges": 1,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 640000, "Usage": 1, "Name": "__mlx_pixel_put_pipeline_texture_buffer"},
{"Offset": 640000, "Type": "BUFFER", "Size": 40000, "Usage": 3, "Name": "__mlx_unamed_user_texture_buffer"},
{"Offset": 680000, "Type": "FREE", "Size": 32874432}
]
}
},
"DedicatedAllocations": [
]
},
"Type 3": {
"PreferredBlockSize": 268435456,
"Blocks": {
},
"DedicatedAllocations": [
]
},
"Type 4": {
"PreferredBlockSize": 32243712,
"Blocks": {
"0": {
"MapRefCount": 3,
"TotalBytes": 4030464,
"UnusedBytes": 4030272,
"Allocations": 3,
"UnusedRanges": 1,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_0_buffer"},
{"Offset": 64, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_1_buffer"},
{"Offset": 128, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_2_buffer"},
{"Offset": 192, "Type": "FREE", "Size": 4030272}
]
}
},
"DedicatedAllocations": [
]
}
},
"CustomPools": {
}
}

232
test/memory_dump3.json git.filemode.normal_file
View File

@@ -0,0 +1,232 @@
{
"General": {
"API": "Vulkan",
"apiVersion": "1.3.260",
"GPU": "NVIDIA GeForce GTX 1650",
"deviceType": 2,
"maxMemoryAllocationCount": 4294967295,
"bufferImageGranularity": 1024,
"nonCoherentAtomSize": 64,
"memoryHeapCount": 3,
"memoryTypeCount": 5
},
"Total": {
"BlockCount": 5,
"BlockBytes": 73007104,
"AllocationCount": 17,
"AllocationBytes": 2664896,
"UnusedRangeCount": 6,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
},
"MemoryInfo": {
"Heap 0": {
"Flags": ["DEVICE_LOCAL"],
"Size": 4294967296,
"Budget": {
"BudgetBytes": 3435973836,
"UsageBytes": 35422208
},
"Stats": {
"BlockCount": 3,
"BlockBytes": 35422208,
"AllocationCount": 12,
"AllocationBytes": 1984704,
"UnusedRangeCount": 4,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
},
"MemoryPools": {
"Type 1": {
"Flags": ["DEVICE_LOCAL"],
"Stats": {
"BlockCount": 3,
"BlockBytes": 35422208,
"AllocationCount": 12,
"AllocationBytes": 1984704,
"UnusedRangeCount": 4,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
}
}
}
},
"Heap 1": {
"Flags": [],
"Size": 6071976960,
"Budget": {
"BudgetBytes": 4857581568,
"UsageBytes": 33554432
},
"Stats": {
"BlockCount": 1,
"BlockBytes": 33554432,
"AllocationCount": 2,
"AllocationBytes": 680000,
"UnusedRangeCount": 1,
"AllocationSizeMin": 40000,
"AllocationSizeMax": 640000
},
"MemoryPools": {
"Type 0": {
"Flags": [],
"Stats": {
"BlockCount": 0,
"BlockBytes": 0,
"AllocationCount": 0,
"AllocationBytes": 0,
"UnusedRangeCount": 0
}
},
"Type 2": {
"Flags": ["HOST_VISIBLE", "HOST_COHERENT"],
"Stats": {
"BlockCount": 1,
"BlockBytes": 33554432,
"AllocationCount": 2,
"AllocationBytes": 680000,
"UnusedRangeCount": 1,
"AllocationSizeMin": 40000,
"AllocationSizeMax": 640000
}
},
"Type 3": {
"Flags": ["HOST_VISIBLE", "HOST_COHERENT", "HOST_CACHED"],
"Stats": {
"BlockCount": 0,
"BlockBytes": 0,
"AllocationCount": 0,
"AllocationBytes": 0,
"UnusedRangeCount": 0
}
}
}
},
"Heap 2": {
"Flags": ["DEVICE_LOCAL"],
"Size": 257949696,
"Budget": {
"BudgetBytes": 206359756,
"UsageBytes": 4030464
},
"Stats": {
"BlockCount": 1,
"BlockBytes": 4030464,
"AllocationCount": 3,
"AllocationBytes": 192,
"UnusedRangeCount": 1,
"AllocationSizeMin": 64,
"AllocationSizeMax": 64
},
"MemoryPools": {
"Type 4": {
"Flags": ["DEVICE_LOCAL", "HOST_VISIBLE", "HOST_COHERENT"],
"Stats": {
"BlockCount": 1,
"BlockBytes": 4030464,
"AllocationCount": 3,
"AllocationBytes": 192,
"UnusedRangeCount": 1,
"AllocationSizeMin": 64,
"AllocationSizeMax": 64
}
}
}
}
},
"DefaultPools": {
"Type 0": {
"PreferredBlockSize": 268435456,
"Blocks": {
},
"DedicatedAllocations": [
]
},
"Type 1": {
"PreferredBlockSize": 268435456,
"Blocks": {
"0": {
"MapRefCount": 0,
"TotalBytes": 33554432,
"UnusedBytes": 33437504,
"Allocations": 10,
"UnusedRanges": 4,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "__mlx_pixel_put_pipeline_texture_GPU_vertex_buffer"},
{"Offset": 128, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "__mlx_pixel_put_pipeline_texture_GPU_index_buffer"},
{"Offset": 140, "Type": "FREE", "Size": 4},
{"Offset": 144, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "42_logo.png_GPU_vertex_buffer"},
{"Offset": 272, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "42_logo.png_GPU_index_buffer"},
{"Offset": 284, "Type": "FREE", "Size": 4},
{"Offset": 288, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "__mlx_unamed_user_texture_GPU_vertex_buffer"},
{"Offset": 416, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "__mlx_unamed_user_texture_GPU_index_buffer"},
{"Offset": 428, "Type": "BUFFER", "Size": 156, "Usage": 66, "Name": "that's a text_GPU_index_buffer"},
{"Offset": 584, "Type": "FREE", "Size": 440},
{"Offset": 1024, "Type": "IMAGE_OPTIMAL", "Size": 57344, "Usage": 7, "Name": "42_logo.png"},
{"Offset": 58368, "Type": "IMAGE_OPTIMAL", "Size": 57344, "Usage": 7, "Name": "__mlx_unamed_user_texture"},
{"Offset": 115712, "Type": "BUFFER", "Size": 1664, "Usage": 130, "Name": "that's a text_GPU_vertex_buffer"},
{"Offset": 117376, "Type": "FREE", "Size": 33437056}
]
}
},
"DedicatedAllocations": [
{"Type": "IMAGE_OPTIMAL", "Size": 819200, "Usage": 7, "Name": "__mlx_pixel_put_pipeline_texture"},
{"Type": "IMAGE_OPTIMAL", "Size": 1048576, "Usage": 7, "Name": "__mlx_texts_pipeline_texture_atlas"}
]
},
"Type 2": {
"PreferredBlockSize": 268435456,
"Blocks": {
"0": {
"MapRefCount": 2,
"TotalBytes": 33554432,
"UnusedBytes": 32874432,
"Allocations": 2,
"UnusedRanges": 1,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 640000, "Usage": 1, "Name": "__mlx_pixel_put_pipeline_texture_buffer"},
{"Offset": 640000, "Type": "BUFFER", "Size": 40000, "Usage": 3, "Name": "__mlx_unamed_user_texture_buffer"},
{"Offset": 680000, "Type": "FREE", "Size": 32874432}
]
}
},
"DedicatedAllocations": [
]
},
"Type 3": {
"PreferredBlockSize": 268435456,
"Blocks": {
},
"DedicatedAllocations": [
]
},
"Type 4": {
"PreferredBlockSize": 32243712,
"Blocks": {
"0": {
"MapRefCount": 3,
"TotalBytes": 4030464,
"UnusedBytes": 4030272,
"Allocations": 3,
"UnusedRanges": 1,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_0_buffer"},
{"Offset": 64, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_1_buffer"},
{"Offset": 128, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_2_buffer"},
{"Offset": 192, "Type": "FREE", "Size": 4030272}
]
}
},
"DedicatedAllocations": [
]
}
},
"CustomPools": {
}
}

232
test/memory_dump4.json git.filemode.normal_file
View File

@@ -0,0 +1,232 @@
{
"General": {
"API": "Vulkan",
"apiVersion": "1.3.260",
"GPU": "NVIDIA GeForce GTX 1650",
"deviceType": 2,
"maxMemoryAllocationCount": 4294967295,
"bufferImageGranularity": 1024,
"nonCoherentAtomSize": 64,
"memoryHeapCount": 3,
"memoryTypeCount": 5
},
"Total": {
"BlockCount": 5,
"BlockBytes": 73007104,
"AllocationCount": 17,
"AllocationBytes": 2664896,
"UnusedRangeCount": 6,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
},
"MemoryInfo": {
"Heap 0": {
"Flags": ["DEVICE_LOCAL"],
"Size": 4294967296,
"Budget": {
"BudgetBytes": 3435973836,
"UsageBytes": 35422208
},
"Stats": {
"BlockCount": 3,
"BlockBytes": 35422208,
"AllocationCount": 12,
"AllocationBytes": 1984704,
"UnusedRangeCount": 4,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
},
"MemoryPools": {
"Type 1": {
"Flags": ["DEVICE_LOCAL"],
"Stats": {
"BlockCount": 3,
"BlockBytes": 35422208,
"AllocationCount": 12,
"AllocationBytes": 1984704,
"UnusedRangeCount": 4,
"AllocationSizeMin": 12,
"AllocationSizeMax": 1048576,
"UnusedRangeSizeMin": 4,
"UnusedRangeSizeMax": 33437056
}
}
}
},
"Heap 1": {
"Flags": [],
"Size": 6071976960,
"Budget": {
"BudgetBytes": 4857581568,
"UsageBytes": 33554432
},
"Stats": {
"BlockCount": 1,
"BlockBytes": 33554432,
"AllocationCount": 2,
"AllocationBytes": 680000,
"UnusedRangeCount": 1,
"AllocationSizeMin": 40000,
"AllocationSizeMax": 640000
},
"MemoryPools": {
"Type 0": {
"Flags": [],
"Stats": {
"BlockCount": 0,
"BlockBytes": 0,
"AllocationCount": 0,
"AllocationBytes": 0,
"UnusedRangeCount": 0
}
},
"Type 2": {
"Flags": ["HOST_VISIBLE", "HOST_COHERENT"],
"Stats": {
"BlockCount": 1,
"BlockBytes": 33554432,
"AllocationCount": 2,
"AllocationBytes": 680000,
"UnusedRangeCount": 1,
"AllocationSizeMin": 40000,
"AllocationSizeMax": 640000
}
},
"Type 3": {
"Flags": ["HOST_VISIBLE", "HOST_COHERENT", "HOST_CACHED"],
"Stats": {
"BlockCount": 0,
"BlockBytes": 0,
"AllocationCount": 0,
"AllocationBytes": 0,
"UnusedRangeCount": 0
}
}
}
},
"Heap 2": {
"Flags": ["DEVICE_LOCAL"],
"Size": 257949696,
"Budget": {
"BudgetBytes": 206359756,
"UsageBytes": 4030464
},
"Stats": {
"BlockCount": 1,
"BlockBytes": 4030464,
"AllocationCount": 3,
"AllocationBytes": 192,
"UnusedRangeCount": 1,
"AllocationSizeMin": 64,
"AllocationSizeMax": 64
},
"MemoryPools": {
"Type 4": {
"Flags": ["DEVICE_LOCAL", "HOST_VISIBLE", "HOST_COHERENT"],
"Stats": {
"BlockCount": 1,
"BlockBytes": 4030464,
"AllocationCount": 3,
"AllocationBytes": 192,
"UnusedRangeCount": 1,
"AllocationSizeMin": 64,
"AllocationSizeMax": 64
}
}
}
}
},
"DefaultPools": {
"Type 0": {
"PreferredBlockSize": 268435456,
"Blocks": {
},
"DedicatedAllocations": [
]
},
"Type 1": {
"PreferredBlockSize": 268435456,
"Blocks": {
"0": {
"MapRefCount": 0,
"TotalBytes": 33554432,
"UnusedBytes": 33437504,
"Allocations": 10,
"UnusedRanges": 4,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "__mlx_pixel_put_pipeline_texture_GPU_vertex_buffer"},
{"Offset": 128, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "__mlx_pixel_put_pipeline_texture_GPU_index_buffer"},
{"Offset": 140, "Type": "FREE", "Size": 4},
{"Offset": 144, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "42_logo.png_GPU_vertex_buffer"},
{"Offset": 272, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "42_logo.png_GPU_index_buffer"},
{"Offset": 284, "Type": "FREE", "Size": 4},
{"Offset": 288, "Type": "BUFFER", "Size": 128, "Usage": 130, "Name": "__mlx_unamed_user_texture_GPU_vertex_buffer"},
{"Offset": 416, "Type": "BUFFER", "Size": 12, "Usage": 66, "Name": "__mlx_unamed_user_texture_GPU_index_buffer"},
{"Offset": 428, "Type": "BUFFER", "Size": 156, "Usage": 66, "Name": "that's a text_GPU_index_buffer"},
{"Offset": 584, "Type": "FREE", "Size": 440},
{"Offset": 1024, "Type": "IMAGE_OPTIMAL", "Size": 57344, "Usage": 7, "Name": "42_logo.png"},
{"Offset": 58368, "Type": "IMAGE_OPTIMAL", "Size": 57344, "Usage": 7, "Name": "__mlx_unamed_user_texture"},
{"Offset": 115712, "Type": "BUFFER", "Size": 1664, "Usage": 130, "Name": "that's a text_GPU_vertex_buffer"},
{"Offset": 117376, "Type": "FREE", "Size": 33437056}
]
}
},
"DedicatedAllocations": [
{"Type": "IMAGE_OPTIMAL", "Size": 819200, "Usage": 7, "Name": "__mlx_pixel_put_pipeline_texture"},
{"Type": "IMAGE_OPTIMAL", "Size": 1048576, "Usage": 7, "Name": "__mlx_texts_pipeline_texture_atlas"}
]
},
"Type 2": {
"PreferredBlockSize": 268435456,
"Blocks": {
"0": {
"MapRefCount": 2,
"TotalBytes": 33554432,
"UnusedBytes": 32874432,
"Allocations": 2,
"UnusedRanges": 1,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 640000, "Usage": 1, "Name": "__mlx_pixel_put_pipeline_texture_buffer"},
{"Offset": 640000, "Type": "BUFFER", "Size": 40000, "Usage": 3, "Name": "__mlx_unamed_user_texture_buffer"},
{"Offset": 680000, "Type": "FREE", "Size": 32874432}
]
}
},
"DedicatedAllocations": [
]
},
"Type 3": {
"PreferredBlockSize": 268435456,
"Blocks": {
},
"DedicatedAllocations": [
]
},
"Type 4": {
"PreferredBlockSize": 32243712,
"Blocks": {
"0": {
"MapRefCount": 3,
"TotalBytes": 4030464,
"UnusedBytes": 4030272,
"Allocations": 3,
"UnusedRanges": 1,
"Suballocations": [
{"Offset": 0, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_0_buffer"},
{"Offset": 64, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_1_buffer"},
{"Offset": 128, "Type": "BUFFER", "Size": 64, "Usage": 16, "Name": "__mlx_matrices_uniform_buffer_2_buffer"},
{"Offset": 192, "Type": "FREE", "Size": 4030272}
]
}
},
"DedicatedAllocations": [
]
}
},
"CustomPools": {
}
}

38
xmake.lua git.filemode.normal_file
View File

@@ -0,0 +1,38 @@
--------------------------------------------------------------------------------
-- --
-- ::: :::::::: --
-- xmake.lua :+: :+: :+: --
-- +:+ +:+ +:+ --
-- By: kbz_8 </var/spool/mail/kbz_8> +#+ +:+ +#+ --
-- +#+#+#+#+#+ +#+ --
-- Created: 2023/12/07 15:21:38 by kbz_8 #+# #+# --
-- Updated: 2023/12/07 15:21:38 by kbz_8 ### ########.fr --
-- --
--------------------------------------------------------------------------------
-- Global settings
add_requires("libsdl", "vulkan-headers")
add_rules("mode.debug", "mode.release")
set_languages("cxx17")
set_objectdir("objs/xmake/$(os)_$(arch)")
set_targetdir("./")
set_optimize("fastest")
target("libmlx")
set_default(true)
set_license("MIT")
set_kind("shared")
add_includedirs("includes", "srcs", "third_party")
add_files("srcs/**.cpp")
add_packages("libsdl", "vulkan-headers")
if is_mode("debug") then
add_defines("DEBUG")
end
target_end() -- optional but I think the code is cleaner with this -- optional but I think the code is cleaner with this