Instance::preinitialized tmp logging
This commit is contained in:
parent
f82fad411f
commit
c9aed7518a
1 changed files with 46 additions and 3 deletions
|
@ -99,6 +99,22 @@ impl Layer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn log(msg: impl ToString) {
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
|
let home = std::env::var("HOME").unwrap();
|
||||||
|
|
||||||
|
let log_file = format!("{}/rf2_vk_hud.log", home);
|
||||||
|
|
||||||
|
if let Ok(mut file) = std::fs::OpenOptions::new()
|
||||||
|
.append(true)
|
||||||
|
.create(true)
|
||||||
|
.open(&log_file)
|
||||||
|
{
|
||||||
|
if let Err(_) = file.write_all(format!("{}\n", msg.to_string()).as_bytes()) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Instance {
|
impl Instance {
|
||||||
pub fn preinitialized(
|
pub fn preinitialized(
|
||||||
instance: VkInstance,
|
instance: VkInstance,
|
||||||
|
@ -106,19 +122,42 @@ impl Instance {
|
||||||
extensions: &[VkString],
|
extensions: &[VkString],
|
||||||
api_version: u32,
|
api_version: u32,
|
||||||
) -> Result<Arc<Instance>> {
|
) -> Result<Arc<Instance>> {
|
||||||
|
log("Instance::preinitialized: start");
|
||||||
|
|
||||||
let static_functions = StaticFunctions {
|
let static_functions = StaticFunctions {
|
||||||
_lib: None,
|
_lib: None,
|
||||||
vkGetInstanceProcAddr: proc_addr,
|
vkGetInstanceProcAddr: proc_addr,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
log("Instance::preinitialized: StaticFunctions");
|
||||||
|
|
||||||
let entry_functions = EntryFunctions::new(&static_functions);
|
let entry_functions = EntryFunctions::new(&static_functions);
|
||||||
|
|
||||||
|
log("Instance::preinitialized: EntryFunctions");
|
||||||
|
|
||||||
let instance_functions = InstanceFunctions::new(&static_functions, instance);
|
let instance_functions = InstanceFunctions::new(&static_functions, instance);
|
||||||
|
|
||||||
|
log("Instance::preinitialized: InstanceFunctions");
|
||||||
|
|
||||||
let instance_wsi_functions = InstanceWSIFunctions::new(&static_functions, instance);
|
let instance_wsi_functions = InstanceWSIFunctions::new(&static_functions, instance);
|
||||||
|
|
||||||
|
log("Instance::preinitialized: InstanceWSIFunctions");
|
||||||
|
|
||||||
let physical_device_properties2_functions =
|
let physical_device_properties2_functions =
|
||||||
PhysicalDeviceProperties2Functions::new(&static_functions, instance);
|
PhysicalDeviceProperties2Functions::new(&static_functions, instance);
|
||||||
|
|
||||||
|
log("Instance::preinitialized: PhysicalDeviceProperties2Functions");
|
||||||
|
|
||||||
let debug_report_callback_functions =
|
let debug_report_callback_functions =
|
||||||
DebugReportCallbackFunctions::new(&static_functions, instance);
|
DebugReportCallbackFunctions::new(&static_functions, instance);
|
||||||
|
|
||||||
Ok(Arc::new(Instance {
|
log("Instance::preinitialized: DebugReportCallbackFunctions");
|
||||||
|
|
||||||
|
let instance_extensions = InstanceExtensions::from_list(extensions);
|
||||||
|
|
||||||
|
log("Instance::preinitialized: InstanceExtensions");
|
||||||
|
|
||||||
|
let instance = Arc::new(Instance {
|
||||||
_static_functions: static_functions,
|
_static_functions: static_functions,
|
||||||
_entry_functions: entry_functions,
|
_entry_functions: entry_functions,
|
||||||
instance_functions,
|
instance_functions,
|
||||||
|
@ -129,12 +168,16 @@ impl Instance {
|
||||||
|
|
||||||
instance,
|
instance,
|
||||||
|
|
||||||
instance_extensions: InstanceExtensions::from_list(extensions),
|
instance_extensions,
|
||||||
|
|
||||||
debug_report: None,
|
debug_report: None,
|
||||||
|
|
||||||
api_version,
|
api_version,
|
||||||
}))
|
});
|
||||||
|
|
||||||
|
log("Instance::preinitialized: Arc<Instance> created!");
|
||||||
|
|
||||||
|
Ok(instance)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
|
|
Loading…
Reference in a new issue