Update Instance::from_core

Creation of wgc instance is not unsafe anymore (here used to be global actually).

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev authored and Teodor Tanasoaia committed 2026-08-31 11:20:09 +02:00
1 parent 78fa6152cc
commit f54ae8f3b5
2 files changed
+3 -9

No files matched your search

+2 -8
View File
@@ -407,15 +407,9 @@ impl Instance {
/// # Arguments
///
/// - `core_instance` - wgpu-core instance.
///
/// # Safety
///
/// Refer to the creation of wgpu-core Instance.
pub unsafe fn from_core(core_instance: Arc<wgc::instance::Instance>) -> Self {
pub fn from_core(core_instance: Arc<wgc::instance::Instance>) -> Self {
Self {
inner: unsafe {
crate::backend::ContextWgpuCore::from_core_instance(core_instance).into()
},
inner: crate::backend::ContextWgpuCore::from_core_instance(core_instance).into(),
}
}
}
+1 -1
View File
@@ -61,7 +61,7 @@ impl ContextWgpuCore {
unsafe { self.0.as_hal::<A>() }
}
pub unsafe fn from_core_instance(core_instance: Arc<wgc::instance::Instance>) -> Self {
pub fn from_core_instance(core_instance: Arc<wgc::instance::Instance>) -> Self {
Self(core_instance)
}