Added cast operator for VkInstance

Now maintains a list of enabled extensions
This commit is contained in:
2025-07-07 22:46:21 +10:00
parent cb21dc7ede
commit 175897e7d9
2 changed files with 14 additions and 1 deletions

View File

@@ -78,6 +78,10 @@ basalt::Context::Context(const char* app_name,
ci.enabledLayerCount = required_layers.m_nelements;
ci.ppEnabledLayerNames = required_layers.m_pdata;
this->num_enabled_layers = required_layers.m_nelements;
this->pp_enabled_layers = basalt::mem::allocT<const char*>(required_layers.m_nelements, MEMORY_TAG_CLASS_ARRAY | MEMORY_TAG_ZONE_ENGINE | MEMORY_TAG_ALIGN_ANY);
memcpy(this->pp_enabled_layers, required_layers.m_pdata, sizeof(const char*) * required_layers.m_nelements);
if (this->using_validation_layers)
{
dbg_ci.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT | VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT;
@@ -113,8 +117,13 @@ basalt::Context::~Context()
}
if (this->inst != VK_NULL_HANDLE && this->should_free)
vkDestroyInstance(this->inst, this->vk_alloc);
if (this->pp_enabled_layers)
basalt::mem::dealloc(this->pp_enabled_layers, this->num_enabled_layers * sizeof(const char*), MEMORY_TAG_CLASS_ARRAY | MEMORY_TAG_ZONE_ENGINE | MEMORY_TAG_ALIGN_ANY);
}
basalt::Context::operator VkInstance(void) const noexcept
{ return this->inst; }
static VKAPI_ATTR VkBool32 VKAPI_CALL debugCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,