1use blade_graphics as gpu;
2use std::sync::Arc;
3
4#[cfg_attr(target_os = "macos", derive(Clone))]
5pub struct BladeContext {
6 pub(super) gpu: Arc<gpu::Context>,
7}
8
9impl BladeContext {
10 pub fn new() -> anyhow::Result<Self> {
11 let gpu = Arc::new(
12 unsafe {
13 gpu::Context::init(gpu::ContextDesc {
14 presentation: true,
15 validation: false,
16 device_id: 0, //TODO: hook up to user settings
17 ..Default::default()
18 })
19 }
20 .map_err(|e| anyhow::anyhow!("{:?}", e))?,
21 );
22 Ok(Self { gpu })
23 }
24}