pub fn probe_gpu_profile() -> crate::gfx::backend::GpuProfile {
#[cfg(backend_dx)]
{
crate::directx::probe_gpu_profile()
}
#[cfg(backend_vk)]
{
crate::vulkan::probe_gpu_profile()
}
#[cfg(backend_metal)]
{
crate::metal::probe_gpu_profile()
}
}
pub fn init_backend(
init: crate::gfx::backend_init::BackendInit<'_>,
) -> Option<Box<dyn crate::gfx::backend::RenderBackend>> {
#[cfg(backend_dx)]
{
match crate::directx::DxContext::new(init) {
Ok(dx) => Some(Box::new(dx)),
Err(e) => {
tracing::error!("GraphicsSystem: D3D12 init failed: {}", e);
None
}
}
}
#[cfg(backend_vk)]
{
match crate::vulkan::VkContext::new(init) {
Ok(vk) => Some(Box::new(vk)),
Err(e) => {
tracing::error!("GraphicsSystem: Vulkan init failed: {}", e);
None
}
}
}
#[cfg(backend_metal)]
{
match crate::metal::MtlContext::new(init) {
Ok(mtl) => Some(Box::new(mtl)),
Err(e) => {
tracing::error!("GraphicsSystem: Metal init failed: {}", e);
None
}
}
}
}