Implement native asset pipeline and cache (#64)
Some checks failed
Native code generation / deterministic (push) Failing after 2m18s
Imaging and meshing gate / native (push) Failing after 1m30s
JPEG 2000 feature / linux (push) Successful in 2m40s
Native Rust workspace compile / compile (push) Failing after 57s
Skia feature / linux (push) Successful in 31m8s

This commit is contained in:
2026-08-10 07:51:17 +00:00
parent d5c318d280
commit 52f62d8c39
23 changed files with 4511 additions and 1620 deletions

View File

@@ -120,6 +120,7 @@ struct ClientRuntime {
agent_manager: Mutex<std::sync::Weak<crate::agent_manager::AgentManagerInner>>,
inventory_manager: Mutex<Option<Arc<crate::inventory_manager::InventoryManagerInner>>>,
inventory_ais_client: Mutex<Option<crate::inventory_ais::InventoryAISClient>>,
asset_manager: Mutex<Option<Arc<crate::asset_manager::AssetManagerInner>>>,
shutdown_complete: Condvar,
shutdown_wait: Mutex<()>,
}
@@ -150,6 +151,7 @@ impl ClientRuntime {
agent_manager: Mutex::new(std::sync::Weak::new()),
inventory_manager: Mutex::new(None),
inventory_ais_client: Mutex::new(None),
asset_manager: Mutex::new(None),
shutdown_complete: Condvar::new(),
shutdown_wait: Mutex::new(()),
}
@@ -447,6 +449,29 @@ impl GridClient {
Ok(manager)
}
pub(crate) fn native_assets(&self) -> Result<crate::AssetManager, crate::Error> {
let mut cached = self
.runtime
.asset_manager
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner);
if let Some(inner) = cached.as_ref() {
return crate::asset_manager::AssetManager::native_from_inner(Arc::clone(inner));
}
let manager = crate::asset_manager::AssetManager::new(Some(self.clone()))?;
*cached = Some(manager.native_inner());
Ok(manager)
}
#[allow(clippy::needless_pass_by_value)]
pub(crate) fn native_set_assets(&mut self, value: crate::AssetManager) {
*self
.runtime
.asset_manager
.lock()
.unwrap_or_else(std::sync::PoisonError::into_inner) = Some(value.native_inner());
}
pub(crate) fn native_ais_client(&self) -> Result<crate::InventoryAISClient, crate::Error> {
let mut cached = self
.runtime