Created basalt::context class and its implementation. Creates an underlying VkInstance, and if debug layers are present, creates a VkDebugUtilsMessengerEXT. There are two flags, should_free that controls whether the destructor will do anything, and using_validation_layers that states whether validation layers and debug utils have been setup. This is primarilly done to free them later and signify a runtime debug configuration.

This commit is contained in:
2025-06-24 15:59:40 +10:00
parent 105edea0f3
commit 2cd9844d07
2 changed files with 172 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
#pragma once
#include "vulkan/basalt_window.h"
#include "containers/basalt_darray.h"
namespace basalt
{
class Context
{
public:
Context(const Context& src) = delete;
Context& operator=(const Context& src) = delete;
Context(Context&& src) noexcept;
Context& operator=(Context&& src) noexcept;
Context(const char* app_name, const basalt::darray<const char*>& required_layers, const basalt::darray<const char*>& required_extensions, uint32_t app_version=VK_MAKE_API_VERSION(1, 1, 0, 0), uint32_t vulkan_version = VK_MAKE_API_VERSION(0, 1, 2, 0));
~Context();
VkInstance inst = VK_NULL_HANDLE;
VkAllocationCallbacks* vk_alloc = VK_NULL_HANDLE;
VkDebugUtilsMessengerEXT dbg_msger = VK_NULL_HANDLE;
bool should_free = true;
bool using_validation_layers = false;
};
}