removing all memory dump strings informations in release mode

This commit is contained in:
2023-11-16 14:04:51 +01:00
parent e471585946
commit d1613ddfdb
10 changed files with 81 additions and 36 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/08 18:55:57 by maldavid #+# #+# */
/* Updated: 2023/11/14 09:31:58 by maldavid ### ########.fr */
/* Updated: 2023/11/16 13:54:25 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -67,15 +67,19 @@ namespace mlx
bufferInfo.usage = usage;
bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
_name = name;
std::string alloc_name = _name;
if(usage & VK_BUFFER_USAGE_INDEX_BUFFER_BIT)
alloc_name.append("_index_buffer");
else if(usage & VK_BUFFER_USAGE_VERTEX_BUFFER_BIT)
alloc_name.append("_vertex_buffer");
else if((usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) != 1)
alloc_name.append("_buffer");
_allocation = Render_Core::get().getAllocator().createBuffer(&bufferInfo, &info, _buffer, alloc_name.c_str());
#ifdef DEBUG
_name = name;
std::string alloc_name = _name;
if(usage & VK_BUFFER_USAGE_INDEX_BUFFER_BIT)
alloc_name.append("_index_buffer");
else if(usage & VK_BUFFER_USAGE_VERTEX_BUFFER_BIT)
alloc_name.append("_vertex_buffer");
else if((usage & VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT) != 1)
alloc_name.append("_buffer");
_allocation = Render_Core::get().getAllocator().createBuffer(&bufferInfo, &info, _buffer, alloc_name.c_str());
#else
_allocation = Render_Core::get().getAllocator().createBuffer(&bufferInfo, &info, _buffer, nullptr);
#endif
_size = size;
}
@@ -84,11 +88,14 @@ namespace mlx
VmaAllocationCreateInfo alloc_info{};
alloc_info.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE;
std::string new_name = _name + "_GPU";
Buffer newBuffer;
newBuffer._usage = (_usage & 0xFFFFFFFC) | VK_BUFFER_USAGE_TRANSFER_DST_BIT;
newBuffer.createBuffer(newBuffer._usage, alloc_info, _size, new_name.c_str());
#ifdef DEBUG
std::string new_name = _name + "_GPU";
newBuffer.createBuffer(newBuffer._usage, alloc_info, _size, new_name.c_str());
#else
newBuffer.createBuffer(newBuffer._usage, alloc_info, _size, nullptr);
#endif
CmdPool cmdpool;
cmdpool.init();

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/06 23:18:52 by maldavid #+# #+# */
/* Updated: 2023/11/14 03:24:12 by maldavid ### ########.fr */
/* Updated: 2023/11/16 13:56:19 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -51,7 +51,9 @@ namespace mlx
void createBuffer(VkBufferUsageFlags usage, VmaAllocationCreateInfo info, VkDeviceSize size, const char* name);
private:
std::string _name;
#ifdef DEBUG
std::string _name;
#endif
VkBufferUsageFlags _usage = 0;
bool _is_mapped = false;
};

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/06 18:45:52 by maldavid #+# #+# */
/* Updated: 2023/11/14 03:27:08 by maldavid ### ########.fr */
/* Updated: 2023/11/16 13:57:42 by maldavid ### ########.fr */
/* */
/* ************************************************************************** */
@@ -22,9 +22,13 @@ namespace mlx
for(int i = 0; i < MAX_FRAMES_IN_FLIGHT; i++)
{
std::string name_frame = name;
name_frame.append(std::to_string(i));
_buffers[i].create(Buffer::kind::uniform, size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, name_frame.c_str());
#ifdef DEBUG
std::string name_frame = name;
name_frame.append(std::to_string(i));
_buffers[i].create(Buffer::kind::uniform, size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, name_frame.c_str());
#else
_buffers[i].create(Buffer::kind::uniform, size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, nullptr);
#endif
_buffers[i].mapMem(&_maps[i]);
if(_maps[i] == nullptr)
core::error::report(e_kind::fatal_error, "Vulkan : unable to map a uniform buffer");