feat(renderer): enable vulkan validation layers in debug builds

Configured InstanceCreateInfo to request the VK_LAYER_KHRONOS_validation layer and the VK_EXT_debug_utils extension when compiling in debug mode. This lays the foundation for wiring Vulkan debug callbacks to tracing.
This commit is contained in:
Serkyo 2026-04-30 11:33:07 +02:00
parent 9ceefc6654
commit 83dde5a794

View file

@ -16,12 +16,22 @@ impl Renderer {
pub fn new(required_extensions: &[*const c_char]) -> Result<Self, RendererError> {
let entry = unsafe { Entry::load() }?;
let mut extensions: Vec<*const c_char> = required_extensions.to_vec();
let mut layers: Vec<*const c_char> = Vec::new();
#[cfg(debug_assertions)]
{
extensions.push(ash::ext::debug_utils::NAME.as_ptr());
layers.push(c"VK_LAYER_KHRONOS_validation".as_ptr());
}
let app_info = vk::ApplicationInfo::default()
.api_version(vk::API_VERSION_1_3);
let create_info = vk::InstanceCreateInfo::default()
.application_info(&app_info)
.enabled_extension_names(required_extensions);
.enabled_extension_names(&extensions)
.enabled_layer_names(&layers);
let instance = unsafe { entry.create_instance(&create_info, None)? };