improving vulkan error messages

This commit is contained in:
2024-01-03 15:15:38 +01:00
parent 1a19c55568
commit ae6c4710c8
15 changed files with 149 additions and 59 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 17:55:21 by maldavid #+# #+# */ /* Created: 2022/10/04 17:55:21 by maldavid #+# #+# */
/* Updated: 2023/12/31 01:13:40 by maldavid ### ########.fr */ /* Updated: 2024/01/03 12:29:31 by maldavid ### ########.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/11/10 08:49:17 by maldavid #+# #+# */ /* Created: 2023/11/10 08:49:17 by maldavid #+# #+# */
/* Updated: 2023/12/16 20:20:35 by maldavid ### ########.fr */ /* Updated: 2024/01/03 14:39:23 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -93,6 +93,32 @@
#define MLX_FUNC_SIG "Unknown function" #define MLX_FUNC_SIG "Unknown function"
#endif #endif
#ifndef __cplusplus // if we compile in C
#ifdef __STDC__
#ifdef __STDC_VERSION__
#if __STDC_VERSION__ == 199409L
#define MLX_C_VERSION 1994
#elif __STDC_VERSION__ == 199901L
#define MLX_C_VERSION 1999
#elif __STDC_VERSION__ == 201112L
#define MLX_C_VERSION 2011
#elif __STDC_VERSION__ == 201710L
#define MLX_C_VERSION 2017
#elif __STDC_VERSION__ == 202311L
#define MLX_C_VERSION 2023
#else
#define MLX_C_VERSION 0
#endif
#else
#define MLX_C_VERSION 0
#endif
#else
#define MLX_C_VERSION 0
#endif
#else
#define MLX_C_VERSION 0
#endif
// Checking common assumptions // Checking common assumptions
#ifdef __cplusplus #ifdef __cplusplus
#include <climits> #include <climits>
@@ -109,8 +135,48 @@
static_assert(sizeof(uint16_t) == 2, "uint16_t is not of the correct size"); static_assert(sizeof(uint16_t) == 2, "uint16_t is not of the correct size");
static_assert(sizeof(uint32_t) == 4, "uint32_t is not of the correct size"); static_assert(sizeof(uint32_t) == 4, "uint32_t is not of the correct size");
static_assert(sizeof(uint64_t) == 8, "uint64_t is not of the correct size"); static_assert(sizeof(uint64_t) == 8, "uint64_t is not of the correct size");
#elif MLX_C_VERSION >= 2011
#if MLX_C_VERSION < 2023
#include <assert.h>
#endif
#include <limits.h>
#include <stdint.h>
static_assert(CHAR_BIT == 8, "CHAR_BIT is expected to be 8");
static_assert(sizeof(int8_t) == 1, "int8_t is not of the correct size" );
static_assert(sizeof(int16_t) == 2, "int16_t is not of the correct size");
static_assert(sizeof(int32_t) == 4, "int32_t is not of the correct size");
static_assert(sizeof(int64_t) == 8, "int64_t is not of the correct size");
static_assert(sizeof(uint8_t) == 1, "uint8_t is not of the correct size" );
static_assert(sizeof(uint16_t) == 2, "uint16_t is not of the correct size");
static_assert(sizeof(uint32_t) == 4, "uint32_t is not of the correct size");
static_assert(sizeof(uint64_t) == 8, "uint64_t is not of the correct size");
#elif defined(MLX_COMPILER_GCC)
#define STATIC_ASSERT(cnd, descr) \
({ \
extern int __attribute__((error("static assert failed: (" #cnd ") (" #descr ")"))) compile_time_check(void); \
((cnd) ? 0 : compile_time_check()), 0; \
})
#include <limits.h>
#include <stdint.h>
STATIC_ASSERT(CHAR_BIT == 8, "CHAR_BIT is expected to be 8");
STATIC_ASSERT(sizeof(int8_t) == 1, "int8_t is not of the correct size" );
STATIC_ASSERT(sizeof(int16_t) == 2, "int16_t is not of the correct size");
STATIC_ASSERT(sizeof(int32_t) == 4, "int32_t is not of the correct size");
STATIC_ASSERT(sizeof(int64_t) == 8, "int64_t is not of the correct size");
STATIC_ASSERT(sizeof(uint8_t) == 1, "uint8_t is not of the correct size" );
STATIC_ASSERT(sizeof(uint16_t) == 2, "uint16_t is not of the correct size");
STATIC_ASSERT(sizeof(uint32_t) == 4, "uint32_t is not of the correct size");
STATIC_ASSERT(sizeof(uint64_t) == 8, "uint64_t is not of the correct size");
#else #else
#define STATIC_ASSERT(COND, MSG) typedef char static_assertion___##MSG[(COND)?1:-1] #define STATIC_ASSERT(COND, MSG) typedef char static_assertion___##MSG[(COND)?1:-1]
#include <limits.h> #include <limits.h>
#include <stdint.h> #include <stdint.h>

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/06 18:26:06 by maldavid #+# #+# */ /* Created: 2022/10/06 18:26:06 by maldavid #+# #+# */
/* Updated: 2023/12/24 12:58:36 by kbz_8 ### ########.fr */ /* Updated: 2024/01/03 13:12:58 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -32,8 +32,9 @@ namespace mlx
allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; allocInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
allocInfo.commandBufferCount = 1; allocInfo.commandBufferCount = 1;
if(vkAllocateCommandBuffers(Render_Core::get().getDevice().get(), &allocInfo, &_cmd_buffer) != VK_SUCCESS) VkResult res = vkAllocateCommandBuffers(Render_Core::get().getDevice().get(), &allocInfo, &_cmd_buffer);
core::error::report(e_kind::fatal_error, "Vulkan : failed to allocate command buffer"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan : failed to allocate command buffer, %s", RCore::verbaliseResultVk(res));
#ifdef DEBUG #ifdef DEBUG
core::error::report(e_kind::message, "Vulkan : created new command buffer"); core::error::report(e_kind::message, "Vulkan : created new command buffer");
#endif #endif
@@ -85,8 +86,9 @@ namespace mlx
VkFence fence; VkFence fence;
vkCreateFence(device, &fenceCreateInfo, nullptr, &fence); vkCreateFence(device, &fenceCreateInfo, nullptr, &fence);
vkResetFences(device, 1, &fence); vkResetFences(device, 1, &fence);
if(vkQueueSubmit(Render_Core::get().getQueue().getGraphic(), 1, &submitInfo, fence) != VK_SUCCESS) VkResult res = vkQueueSubmit(Render_Core::get().getQueue().getGraphic(), 1, &submitInfo, fence);
core::error::report(e_kind::fatal_error, "Vulkan error : failed to submit a single time command buffer"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan error : failed to submit a single time command buffer, %s", RCore::verbaliseResultVk(res));
_state = state::submitted; _state = state::submitted;
vkWaitForFences(device, 1, &fence, VK_TRUE, UINT64_MAX); vkWaitForFences(device, 1, &fence, VK_TRUE, UINT64_MAX);
vkDestroyFence(device, fence, nullptr); vkDestroyFence(device, fence, nullptr);
@@ -120,8 +122,9 @@ namespace mlx
submitInfo.signalSemaphoreCount = (semaphores == nullptr ? 0 : signalSemaphores.size()); submitInfo.signalSemaphoreCount = (semaphores == nullptr ? 0 : signalSemaphores.size());
submitInfo.pSignalSemaphores = signalSemaphores.data(); submitInfo.pSignalSemaphores = signalSemaphores.data();
if(vkQueueSubmit(Render_Core::get().getQueue().getGraphic(), 1, &submitInfo, _fence.get()) != VK_SUCCESS) VkResult res = vkQueueSubmit(Render_Core::get().getQueue().getGraphic(), 1, &submitInfo, _fence.get());
core::error::report(e_kind::fatal_error, "Vulkan error : failed to submit draw command buffer"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan error : failed to submit draw command buffer, %s", RCore::verbaliseResultVk(res));
_state = state::submitted; _state = state::submitted;
} }

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/06 18:24:33 by maldavid #+# #+# */ /* Created: 2022/10/06 18:24:33 by maldavid #+# #+# */
/* Updated: 2023/11/18 17:23:38 by maldavid ### ########.fr */ /* Updated: 2024/01/03 13:13:25 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -22,8 +22,9 @@ namespace mlx
poolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT; poolInfo.flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT;
poolInfo.queueFamilyIndex = Render_Core::get().getQueue().getFamilies().graphicsFamily.value(); poolInfo.queueFamilyIndex = Render_Core::get().getQueue().getFamilies().graphicsFamily.value();
if(vkCreateCommandPool(Render_Core::get().getDevice().get(), &poolInfo, nullptr, &_cmd_pool) != VK_SUCCESS) VkResult res = vkCreateCommandPool(Render_Core::get().getDevice().get(), &poolInfo, nullptr, &_cmd_pool);
core::error::report(e_kind::fatal_error, "Vulkan : failed to create command pool"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan : failed to create command pool, %s", RCore::verbaliseResultVk(res));
} }
void CmdPool::destroy() noexcept void CmdPool::destroy() noexcept

View File

@@ -6,7 +6,7 @@
/* By: kbz_8 <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: kbz_8 <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/20 22:02:37 by kbz_8 #+# #+# */ /* Created: 2023/10/20 22:02:37 by kbz_8 #+# #+# */
/* Updated: 2023/12/27 21:31:04 by maldavid ### ########.fr */ /* Updated: 2024/01/03 13:09:40 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -76,18 +76,20 @@ namespace mlx
allocatorCreateInfo.instance = Render_Core::get().getInstance().get(); allocatorCreateInfo.instance = Render_Core::get().getInstance().get();
allocatorCreateInfo.pVulkanFunctions = &vma_vulkan_func; allocatorCreateInfo.pVulkanFunctions = &vma_vulkan_func;
if(vmaCreateAllocator(&allocatorCreateInfo, &_allocator) != VK_SUCCESS) VkResult res = vmaCreateAllocator(&allocatorCreateInfo, &_allocator);
core::error::report(e_kind::fatal_error, "Vulkan : failed to create graphics memory allocator"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Graphics allocator : failed to create graphics memory allocator, %s", RCore::verbaliseResultVk(res));
#ifdef DEBUG #ifdef DEBUG
core::error::report(e_kind::message, "Vulkan : created new allocator"); core::error::report(e_kind::message, "Graphics allocator : created new allocator");
#endif #endif
} }
VmaAllocation GPUallocator::createBuffer(const VkBufferCreateInfo* binfo, const VmaAllocationCreateInfo* vinfo, VkBuffer& buffer, const char* name) noexcept VmaAllocation GPUallocator::createBuffer(const VkBufferCreateInfo* binfo, const VmaAllocationCreateInfo* vinfo, VkBuffer& buffer, const char* name) noexcept
{ {
VmaAllocation allocation; VmaAllocation allocation;
if(vmaCreateBuffer(_allocator, binfo, vinfo, &buffer, &allocation, nullptr) != VK_SUCCESS) VkResult res = vmaCreateBuffer(_allocator, binfo, vinfo, &buffer, &allocation, nullptr);
core::error::report(e_kind::fatal_error, "Vulkan : failed to allocate a buffer"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Graphics allocator : failed to allocate a buffer, %s", RCore::verbaliseResultVk(res));
if(name != nullptr) if(name != nullptr)
vmaSetAllocationName(_allocator, allocation, name); vmaSetAllocationName(_allocator, allocation, name);
#ifdef DEBUG #ifdef DEBUG
@@ -110,8 +112,9 @@ namespace mlx
VmaAllocation GPUallocator::createImage(const VkImageCreateInfo* iminfo, const VmaAllocationCreateInfo* vinfo, VkImage& image, const char* name) noexcept VmaAllocation GPUallocator::createImage(const VkImageCreateInfo* iminfo, const VmaAllocationCreateInfo* vinfo, VkImage& image, const char* name) noexcept
{ {
VmaAllocation allocation; VmaAllocation allocation;
if(vmaCreateImage(_allocator, iminfo, vinfo, &image, &allocation, nullptr) != VK_SUCCESS) VkResult res = vmaCreateImage(_allocator, iminfo, vinfo, &image, &allocation, nullptr);
core::error::report(e_kind::fatal_error, "Vulkan : failed to allocate an image"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Graphics allocator : failed to allocate an image, %s", RCore::verbaliseResultVk(res));
if(name != nullptr) if(name != nullptr)
vmaSetAllocationName(_allocator, allocation, name); vmaSetAllocationName(_allocator, allocation, name);
#ifdef DEBUG #ifdef DEBUG
@@ -133,8 +136,9 @@ namespace mlx
void GPUallocator::mapMemory(VmaAllocation allocation, void** data) noexcept void GPUallocator::mapMemory(VmaAllocation allocation, void** data) noexcept
{ {
if(vmaMapMemory(_allocator, allocation, data) != VK_SUCCESS) VkResult res = vmaMapMemory(_allocator, allocation, data);
core::error::report(e_kind::fatal_error, "Graphics allocator : unable to map GPU memory to CPU memory"); 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));
} }
void GPUallocator::unmapMemory(VmaAllocation allocation) noexcept void GPUallocator::unmapMemory(VmaAllocation allocation) noexcept

View File

@@ -6,30 +6,34 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/17 23:33:34 by maldavid #+# #+# */ /* Created: 2022/12/17 23:33:34 by maldavid #+# #+# */
/* Updated: 2023/12/15 20:32:01 by maldavid ### ########.fr */ /* Updated: 2024/01/03 13:47:13 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#define VOLK_IMPLEMENTATION #define VOLK_IMPLEMENTATION
#if defined(_WIN32) || defined(_WIN64) #if defined(MLX_PLAT_WINDOWS)
#define VK_USE_PLATFORM_WIN32_KHR #define VK_USE_PLATFORM_WIN32_KHR
#elif defined(__APPLE__) || defined(__MACH__) constexpr const char* VULKAN_LIB_NAME = "vulkan-1.dll";
#elif defined(MLX_PLAT_MACOS)
#define VK_USE_PLATFORM_MACOS_MVK #define VK_USE_PLATFORM_MACOS_MVK
#define VK_USE_PLATFORM_METAL_EXT #define VK_USE_PLATFORM_METAL_EXT
constexpr const char* VULKAN_LIB_NAME = "libvulkan.dylib / libvulkan.1.dylib / libMoltenVK.dylib";
#else #else
#define VK_USE_PLATFORM_XLIB_KHR #define VK_USE_PLATFORM_XLIB_KHR
#define VK_USE_PLATFORM_WAYLAND_KHR #define VK_USE_PLATFORM_WAYLAND_KHR
constexpr const char* VULKAN_LIB_NAME = "libvulkan.so / libvulkan.so.1";
#endif #endif
#include "render_core.h" #include <mlx_profile.h>
#include <renderer/core/render_core.h>
#include <mutex> #include <mutex>
#ifdef DEBUG #ifdef DEBUG
#ifndef MLX_COMPILER_MSVC #ifdef MLX_COMPILER_MSVC
#warning "MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances"
#else
#pragma NOTE("MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances") #pragma NOTE("MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances")
#else
#warning "MLX is being compiled in debug mode, this activates Vulkan's validation layers and debug messages which may impact rendering performances"
#endif #endif
#endif #endif
@@ -88,7 +92,8 @@ namespace mlx
void Render_Core::init() void Render_Core::init()
{ {
volkInitialize(); if(volkInitialize() != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan loader : cannot load %s, are you sure Vulkan is installed on your system ?", VULKAN_LIB_NAME);
_instance.init(); _instance.init();
volkLoadInstance(_instance.get()); volkLoadInstance(_instance.get());

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/19 14:05:25 by maldavid #+# #+# */ /* Created: 2022/12/19 14:05:25 by maldavid #+# #+# */
/* Updated: 2023/12/31 00:41:39 by maldavid ### ########.fr */ /* Updated: 2024/01/03 13:11:27 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -27,8 +27,9 @@ namespace mlx
VkDebugUtilsMessengerCreateInfoEXT createInfo{}; VkDebugUtilsMessengerCreateInfoEXT createInfo{};
populateDebugMessengerCreateInfo(createInfo); populateDebugMessengerCreateInfo(createInfo);
if(createDebugUtilsMessengerEXT(&createInfo, nullptr) != VK_SUCCESS) VkResult res = createDebugUtilsMessengerEXT(&createInfo, nullptr);
core::error::report(e_kind::warning, "Vulkan : failed to set up debug messenger"); if(res != VK_SUCCESS)
core::error::report(e_kind::warning, "Vulkan : failed to set up debug messenger, %s", RCore::verbaliseResultVk(res));
#ifdef DEBUG #ifdef DEBUG
else else
core::error::report(e_kind::message, "Vulkan : enabled validation layers"); core::error::report(e_kind::message, "Vulkan : enabled validation layers");

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:34:23 by maldavid #+# #+# */ /* Created: 2023/01/23 18:34:23 by maldavid #+# #+# */
/* Updated: 2023/11/18 17:23:05 by maldavid ### ########.fr */ /* Updated: 2024/01/03 13:13:54 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -23,8 +23,9 @@ namespace mlx
poolInfo.pPoolSizes = size; poolInfo.pPoolSizes = size;
poolInfo.maxSets = 8192; poolInfo.maxSets = 8192;
if(vkCreateDescriptorPool(Render_Core::get().getDevice().get(), &poolInfo, nullptr, &_pool) != VK_SUCCESS) VkResult res = vkCreateDescriptorPool(Render_Core::get().getDevice().get(), &poolInfo, nullptr, &_pool);
core::error::report(e_kind::fatal_error, "Vulkan : failed to create descriptor pool"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan : failed to create descriptor pool, %s", RCore::verbaliseResultVk(res));
} }
void DescriptorPool::destroy() noexcept void DescriptorPool::destroy() noexcept

View File

@@ -6,11 +6,12 @@
/* 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/12/24 09:37:55 by kbz_8 ### ########.fr */ /* Updated: 2024/01/03 13:14:24 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
#include "vk_descriptor_set.h" #include "vk_descriptor_set.h"
#include "renderer/core/render_core.h"
#include "vk_descriptor_pool.h" #include "vk_descriptor_pool.h"
#include "vk_descriptor_set_layout.h" #include "vk_descriptor_set_layout.h"
#include <renderer/buffers/vk_ubo.h> #include <renderer/buffers/vk_ubo.h>
@@ -36,8 +37,9 @@ namespace mlx
allocInfo.descriptorSetCount = static_cast<uint32_t>(MAX_FRAMES_IN_FLIGHT); allocInfo.descriptorSetCount = static_cast<uint32_t>(MAX_FRAMES_IN_FLIGHT);
allocInfo.pSetLayouts = layouts.data(); allocInfo.pSetLayouts = layouts.data();
if(vkAllocateDescriptorSets(device, &allocInfo, _desc_set.data()) != VK_SUCCESS) VkResult res = vkAllocateDescriptorSets(device, &allocInfo, _desc_set.data());
core::error::report(e_kind::fatal_error, "Vulkan : failed to allocate descriptor set"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan : failed to allocate descriptor set, %s", RCore::verbaliseResultVk(res));
#ifdef DEBUG #ifdef DEBUG
core::error::report(e_kind::message, "Vulkan : created new descriptor set"); core::error::report(e_kind::message, "Vulkan : created new descriptor set");
#endif #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:37:28 by maldavid #+# #+# */ /* Created: 2023/01/23 18:37:28 by maldavid #+# #+# */
/* Updated: 2023/12/10 22:25:59 by kbz_8 ### ########.fr */ /* Updated: 2024/01/03 13:14:58 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -34,8 +34,9 @@ namespace mlx
layoutInfo.bindingCount = _bindings.size(); layoutInfo.bindingCount = _bindings.size();
layoutInfo.pBindings = bindings.data(); layoutInfo.pBindings = bindings.data();
if(vkCreateDescriptorSetLayout(Render_Core::get().getDevice().get(), &layoutInfo, nullptr, &_layout) != VK_SUCCESS) VkResult res = vkCreateDescriptorSetLayout(Render_Core::get().getDevice().get(), &layoutInfo, nullptr, &_layout);
core::error::report(e_kind::fatal_error, "Vulkan : failed to create descriptor set layout"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan : failed to create descriptor set layout, %s", RCore::verbaliseResultVk(res));
} }
void DescriptorSetLayout::destroy() noexcept void DescriptorSetLayout::destroy() noexcept

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/25 11:59:07 by maldavid #+# #+# */ /* Created: 2023/01/25 11:59:07 by maldavid #+# #+# */
/* Updated: 2023/12/22 23:35:07 by kbz_8 ### ########.fr */ /* Updated: 2024/01/03 13:16:21 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -182,8 +182,9 @@ namespace mlx
viewInfo.subresourceRange.baseArrayLayer = 0; viewInfo.subresourceRange.baseArrayLayer = 0;
viewInfo.subresourceRange.layerCount = 1; viewInfo.subresourceRange.layerCount = 1;
if(vkCreateImageView(Render_Core::get().getDevice().get(), &viewInfo, nullptr, &_image_view) != VK_SUCCESS) VkResult res = vkCreateImageView(Render_Core::get().getDevice().get(), &viewInfo, nullptr, &_image_view);
core::error::report(e_kind::fatal_error, "Vulkan : failed to create an image view"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan : failed to create an image view, %s", RCore::verbaliseResultVk(res));
} }
void Image::createSampler() noexcept void Image::createSampler() noexcept
@@ -201,8 +202,9 @@ namespace mlx
info.anisotropyEnable = VK_FALSE; info.anisotropyEnable = VK_FALSE;
info.maxAnisotropy = 1.0f; info.maxAnisotropy = 1.0f;
if(vkCreateSampler(Render_Core::get().getDevice().get(), &info, nullptr, &_sampler) != VK_SUCCESS) VkResult res = vkCreateSampler(Render_Core::get().getDevice().get(), &info, nullptr, &_sampler);
core::error::report(e_kind::fatal_error, "Vulkan : failed to create an image"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan : failed to create an image, %s", RCore::verbaliseResultVk(res));
} }
void Image::copyFromBuffer(Buffer& buffer) void Image::copyFromBuffer(Buffer& buffer)

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/18 21:27:38 by maldavid #+# #+# */ /* Created: 2022/12/18 21:27:38 by maldavid #+# #+# */
/* Updated: 2023/12/22 22:00:37 by kbz_8 ### ########.fr */ /* Updated: 2024/01/03 13:16:57 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -305,8 +305,9 @@ namespace mlx
pipelineInfo.subpass = 0; pipelineInfo.subpass = 0;
pipelineInfo.basePipelineHandle = VK_NULL_HANDLE; pipelineInfo.basePipelineHandle = VK_NULL_HANDLE;
if(vkCreateGraphicsPipelines(Render_Core::get().getDevice().get(), VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, &_graphicsPipeline) != VK_SUCCESS) VkResult res = vkCreateGraphicsPipelines(Render_Core::get().getDevice().get(), VK_NULL_HANDLE, 1, &pipelineInfo, nullptr, &_graphicsPipeline);
core::error::report(e_kind::fatal_error, "Vulkan : failed to create a graphics pipeline"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan : failed to create a graphics pipeline, %s", RCore::verbaliseResultVk(res));
#ifdef DEBUG #ifdef DEBUG
core::error::report(e_kind::message, "Vulkan : created new graphic pipeline"); core::error::report(e_kind::message, "Vulkan : created new graphic pipeline");
#endif #endif

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/06 18:18:06 by maldavid #+# #+# */ /* Created: 2022/10/06 18:18:06 by maldavid #+# #+# */
/* Updated: 2023/11/20 07:24:26 by maldavid ### ########.fr */ /* Updated: 2024/01/03 13:17:27 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -33,8 +33,9 @@ namespace mlx
framebufferInfo.height = _height; framebufferInfo.height = _height;
framebufferInfo.layers = 1; framebufferInfo.layers = 1;
if(vkCreateFramebuffer(Render_Core::get().getDevice().get(), &framebufferInfo, nullptr, &_framebuffer) != VK_SUCCESS) VkResult res = vkCreateFramebuffer(Render_Core::get().getDevice().get(), &framebufferInfo, nullptr, &_framebuffer);
core::error::report(e_kind::fatal_error, "Vulkan : failed to create a framebuffer"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan : failed to create a framebuffer, %s", RCore::verbaliseResultVk(res));
#ifdef DEBUG #ifdef DEBUG
core::error::report(e_kind::message, "Vulkan : created new framebuffer"); core::error::report(e_kind::message, "Vulkan : created new framebuffer");
#endif #endif

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/06 18:21:36 by maldavid #+# #+# */ /* Created: 2022/10/06 18:21:36 by maldavid #+# #+# */
/* Updated: 2023/12/24 15:31:02 by kbz_8 ### ########.fr */ /* Updated: 2024/01/03 13:17:56 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -70,8 +70,9 @@ namespace mlx
renderPassInfo.dependencyCount = static_cast<uint32_t>(subpassesDeps.size()); renderPassInfo.dependencyCount = static_cast<uint32_t>(subpassesDeps.size());
renderPassInfo.pDependencies = subpassesDeps.data(); renderPassInfo.pDependencies = subpassesDeps.data();
if(vkCreateRenderPass(Render_Core::get().getDevice().get(), &renderPassInfo, nullptr, &_renderPass) != VK_SUCCESS) VkResult res = vkCreateRenderPass(Render_Core::get().getDevice().get(), &renderPassInfo, nullptr, &_renderPass);
core::error::report(e_kind::fatal_error, "Vulkan : failed to create render pass"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan : failed to create render pass, %s", RCore::verbaliseResultVk(res));
#ifdef DEBUG #ifdef DEBUG
core::error::report(e_kind::message, "Vulkan : created new render pass"); core::error::report(e_kind::message, "Vulkan : created new render pass");
#endif #endif

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/06 18:22:28 by maldavid #+# #+# */ /* Created: 2022/10/06 18:22:28 by maldavid #+# #+# */
/* Updated: 2023/12/15 21:49:19 by maldavid ### ########.fr */ /* Updated: 2024/01/03 13:18:25 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -59,8 +59,9 @@ namespace mlx
else else
createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
if(vkCreateSwapchainKHR(device, &createInfo, nullptr, &_swapChain) != VK_SUCCESS) VkResult res = vkCreateSwapchainKHR(device, &createInfo, nullptr, &_swapChain);
core::error::report(e_kind::fatal_error, "Vulkan : failed to create the swapchain"); if(res != VK_SUCCESS)
core::error::report(e_kind::fatal_error, "Vulkan : failed to create the swapchain, %s", RCore::verbaliseResultVk(res));
std::vector<VkImage> tmp; std::vector<VkImage> tmp;
vkGetSwapchainImagesKHR(device, _swapChain, &imageCount, nullptr); vkGetSwapchainImagesKHR(device, _swapChain, &imageCount, nullptr);