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:
parent
9ceefc6654
commit
83dde5a794
|
|
@ -16,12 +16,22 @@ impl Renderer {
|
||||||
pub fn new(required_extensions: &[*const c_char]) -> Result<Self, RendererError> {
|
pub fn new(required_extensions: &[*const c_char]) -> Result<Self, RendererError> {
|
||||||
let entry = unsafe { Entry::load() }?;
|
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()
|
let app_info = vk::ApplicationInfo::default()
|
||||||
.api_version(vk::API_VERSION_1_3);
|
.api_version(vk::API_VERSION_1_3);
|
||||||
|
|
||||||
let create_info = vk::InstanceCreateInfo::default()
|
let create_info = vk::InstanceCreateInfo::default()
|
||||||
.application_info(&app_info)
|
.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)? };
|
let instance = unsafe { entry.create_instance(&create_info, None)? };
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue