Improve logging
This commit is contained in:
parent
3fdc3a80eb
commit
469328b934
2 changed files with 27 additions and 16 deletions
|
@ -55,7 +55,9 @@ extern "system" fn get_device_proc_addr(
|
||||||
_device: VkDevice,
|
_device: VkDevice,
|
||||||
function_name: *const c_char,
|
function_name: *const c_char,
|
||||||
) -> PFN_vkVoidFunction {
|
) -> PFN_vkVoidFunction {
|
||||||
write_log!("get_device_proc_addr");
|
if cfg!(debug_assertions) {
|
||||||
|
write_log!("get_device_proc_addr");
|
||||||
|
}
|
||||||
|
|
||||||
let func_string = match VkString::try_from(function_name) {
|
let func_string = match VkString::try_from(function_name) {
|
||||||
Ok(func) => func,
|
Ok(func) => func,
|
||||||
|
@ -67,7 +69,9 @@ extern "system" fn get_device_proc_addr(
|
||||||
|
|
||||||
let s = func_string.as_str();
|
let s = func_string.as_str();
|
||||||
|
|
||||||
write_log!(format!("\t{}", s));
|
if cfg!(debug_assertions) {
|
||||||
|
write_log!(format!("\t{}", s));
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(func) = Functions::get_vk_func(s) {
|
if let Some(func) = Functions::get_vk_func(s) {
|
||||||
return func.convert();
|
return func.convert();
|
||||||
|
@ -77,7 +81,9 @@ extern "system" fn get_device_proc_addr(
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_log!("\t-> returning null");
|
if cfg!(debug_assertions) {
|
||||||
|
write_log!("\t-> returning null");
|
||||||
|
}
|
||||||
|
|
||||||
Functions::Null.convert()
|
Functions::Null.convert()
|
||||||
}
|
}
|
||||||
|
@ -87,7 +93,9 @@ extern "system" fn get_instance_proc_addr(
|
||||||
_instance: VkInstance,
|
_instance: VkInstance,
|
||||||
function_name: *const c_char,
|
function_name: *const c_char,
|
||||||
) -> PFN_vkVoidFunction {
|
) -> PFN_vkVoidFunction {
|
||||||
write_log!("get_instance_proc_addr");
|
if cfg!(debug_assertions) {
|
||||||
|
write_log!("get_instance_proc_addr");
|
||||||
|
}
|
||||||
|
|
||||||
let func_string = match VkString::try_from(function_name) {
|
let func_string = match VkString::try_from(function_name) {
|
||||||
Ok(func) => func,
|
Ok(func) => func,
|
||||||
|
@ -99,7 +107,9 @@ extern "system" fn get_instance_proc_addr(
|
||||||
|
|
||||||
let s = func_string.as_str();
|
let s = func_string.as_str();
|
||||||
|
|
||||||
write_log!(format!("\t{}", s));
|
if cfg!(debug_assertions) {
|
||||||
|
write_log!(format!("\t{}", s));
|
||||||
|
}
|
||||||
|
|
||||||
if let Some(func) = Functions::get_vk_func(s) {
|
if let Some(func) = Functions::get_vk_func(s) {
|
||||||
return func.convert();
|
return func.convert();
|
||||||
|
@ -109,7 +119,9 @@ extern "system" fn get_instance_proc_addr(
|
||||||
return func;
|
return func;
|
||||||
}
|
}
|
||||||
|
|
||||||
write_log!("\t-> returning null");
|
if cfg!(debug_assertions) {
|
||||||
|
write_log!("\t-> returning null");
|
||||||
|
}
|
||||||
|
|
||||||
Functions::Null.convert()
|
Functions::Null.convert()
|
||||||
}
|
}
|
||||||
|
@ -366,14 +378,7 @@ pub(crate) extern "system" fn create_swapchain(
|
||||||
*p_swapchain
|
*p_swapchain
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let swapchain =
|
let swapchain = unsafe { Swapchain::from_raw(OVERLAY.device(), &*create_info, *p_swapchain) };
|
||||||
match unsafe { Swapchain::from_raw(OVERLAY.device(), &*create_info, *p_swapchain) } {
|
|
||||||
Ok(swapchain) => swapchain,
|
|
||||||
Err(err) => {
|
|
||||||
write_log!(format!("create swapchain failed: {:?}", err));
|
|
||||||
return VK_ERROR_INITIALIZATION_FAILED;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
write_log!("-> created Arc<Swapchain>");
|
write_log!("-> created Arc<Swapchain>");
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,10 @@ impl VkTypedefHandles {
|
||||||
let function = proc_addr(instance, name.as_ptr());
|
let function = proc_addr(instance, name.as_ptr());
|
||||||
|
|
||||||
if mem::transmute::<PFN_vkVoidFunction, *const c_void>(function) != ptr::null() {
|
if mem::transmute::<PFN_vkVoidFunction, *const c_void>(function) != ptr::null() {
|
||||||
write_log!(format!("layer (instance): successfully read: {}", symbol));
|
if cfg!(debug_assertions) {
|
||||||
|
write_log!(format!("layer (instance): successfully read: {}", symbol));
|
||||||
|
}
|
||||||
|
|
||||||
self.functions.insert(symbol.clone(), function);
|
self.functions.insert(symbol.clone(), function);
|
||||||
} else {
|
} else {
|
||||||
write_log!(format!("layer (instance): failed reading {}", symbol));
|
write_log!(format!("layer (instance): failed reading {}", symbol));
|
||||||
|
@ -61,7 +64,10 @@ impl VkTypedefHandles {
|
||||||
let function = proc_addr(device, name.as_ptr());
|
let function = proc_addr(device, name.as_ptr());
|
||||||
|
|
||||||
if mem::transmute::<PFN_vkVoidFunction, *const c_void>(function) != ptr::null() {
|
if mem::transmute::<PFN_vkVoidFunction, *const c_void>(function) != ptr::null() {
|
||||||
write_log!(format!("layer (device): successfully read: {}", symbol));
|
if cfg!(debug_assertions) {
|
||||||
|
write_log!(format!("layer (device): successfully read: {}", symbol));
|
||||||
|
}
|
||||||
|
|
||||||
self.functions.insert(symbol.clone(), function);
|
self.functions.insert(symbol.clone(), function);
|
||||||
} else {
|
} else {
|
||||||
write_log!(format!("layer (device): failed reading {}", symbol));
|
write_log!(format!("layer (device): failed reading {}", symbol));
|
||||||
|
|
Loading…
Reference in a new issue