pub struct WgpuRuntime { /* private fields */ }Expand description
Headless wgpu runtime for compute-only workloads.
Implementations§
Source§impl WgpuRuntime
impl WgpuRuntime
Sourcepub fn new_headless() -> SpatialResult<Self>
pub fn new_headless() -> SpatialResult<Self>
Creates a headless wgpu runtime preferring a high-performance adapter.
Prefer Self::shared when running multiple GPU filters in one process.
Sourcepub fn new_headless_with_preference(
preference: WgpuPowerPreference,
) -> SpatialResult<Self>
pub fn new_headless_with_preference( preference: WgpuPowerPreference, ) -> SpatialResult<Self>
Creates a headless wgpu runtime with an explicit adapter power preference.
Sourcepub fn new_headless_with_timestamps(
preference: WgpuPowerPreference,
) -> SpatialResult<Self>
pub fn new_headless_with_timestamps( preference: WgpuPowerPreference, ) -> SpatialResult<Self>
Creates a runtime enabling pass timestamps when supported by the adapter.
Unsupported adapters still initialize; check Self::timestamp_queries_enabled
before constructing a profiler. The default constructors request no timestamps.
Sourcepub fn new_headless_with_options(
options: WgpuRuntimeOptions,
) -> SpatialResult<Self>
pub fn new_headless_with_options( options: WgpuRuntimeOptions, ) -> SpatialResult<Self>
Creates an owned runtime using explicit backend and profiling options.
GL must be compiled for the target and provide adapter compute shaders. An uncompiled GL request fails before instance creation. Admission errors do not select another backend. Browser callers should use the async counterpart.
Sourcepub fn timestamp_queries_enabled(&self) -> bool
pub fn timestamp_queries_enabled(&self) -> bool
Returns whether this device has optional pass timestamp queries enabled.
Returns a process-wide shared headless runtime, initializing it on first use.
Sourcepub const fn adapter_info(&self) -> &WgpuAdapterInfo
pub const fn adapter_info(&self) -> &WgpuAdapterInfo
Returns the selected adapter/backend receipt.
Sourcepub fn wait_idle(&self)
pub fn wait_idle(&self)
Blocks until all previously submitted work on this device is complete.
Normal device-resident chains do not synchronize implicitly. This is an explicit profiling/testing boundary or host-coordination primitive.
Sourcepub fn cached_image_texture_count(&self) -> usize
pub fn cached_image_texture_count(&self) -> usize
Returns the number of image textures retained for steady-state reuse.
Sourcepub fn image_texture_pool_stats(&self) -> GpuResourcePoolStats
pub fn image_texture_pool_stats(&self) -> GpuResourcePoolStats
Returns image-texture retention and lifetime allocation/reuse counters. Texel bytes exclude driver overhead and live images; the default is 64 MiB.
Sourcepub fn set_image_texture_pool_budget(&self, budget_bytes: u64)
pub fn set_image_texture_pool_budget(&self, budget_bytes: u64)
Changes retained RGBA8 texel bytes; zero disables texture retention. Shrinking below current retention clears cached textures. Active images remain valid and allocations are not capped by the retention budget.
Sourcepub fn clear_image_texture_pool(&self)
pub fn clear_image_texture_pool(&self)
Drops cached texture handles without affecting live images or counters.
Sourcepub fn initialized_image_pipeline_count(&self) -> usize
pub fn initialized_image_pipeline_count(&self) -> usize
Returns the number of initialized GPU image pipeline families.
Sourcepub fn pipelines(&self) -> &ComputePipelineCache
pub fn pipelines(&self) -> &ComputePipelineCache
Returns cached compute pipelines for this runtime’s device.
Sourcepub fn max_gather_channels(&self) -> u32
pub fn max_gather_channels(&self) -> u32
Returns the maximum attribute channels gatherable in one multi dispatch.
Sourcepub fn buffer_pool(&self) -> &GpuBufferPool
pub fn buffer_pool(&self) -> &GpuBufferPool
Returns the reusable storage-buffer pool owned by this runtime.
Sourcepub fn scratch_buffer_pool_stats(&self) -> GpuResourcePoolStats
pub fn scratch_buffer_pool_stats(&self) -> GpuResourcePoolStats
Returns private point-kernel scratch retention and lifetime counters. The default budget is 64 MiB, independent of the public upload pool.
Sourcepub fn set_scratch_buffer_pool_budget(&self, budget_bytes: u64)
pub fn set_scratch_buffer_pool_budget(&self, budget_bytes: u64)
Changes private scratch retention; zero disables reuse. Shrinking below current retention clears cached buffers without affecting submitted work.
Sourcepub fn clear_scratch_buffer_pool(&self)
pub fn clear_scratch_buffer_pool(&self)
Drops cached scratch handles without changing the budget or counters.
Sourcepub fn upload_pod_storage<T: Pod>(
&self,
label: &'static str,
data: &[T],
) -> SpatialResult<Buffer>
pub fn upload_pod_storage<T: Pod>( &self, label: &'static str, data: &[T], ) -> SpatialResult<Buffer>
Uploads a POD slice into a reusable pooled storage buffer.
Sourcepub fn upload_f32_storage(
&self,
label: &'static str,
data: &[f32],
) -> SpatialResult<Buffer>
pub fn upload_f32_storage( &self, label: &'static str, data: &[f32], ) -> SpatialResult<Buffer>
Uploads f32 values into a reusable pooled storage buffer.
Sourcepub fn upload_u32_storage(
&self,
label: &'static str,
data: &[u32],
) -> SpatialResult<Buffer>
pub fn upload_u32_storage( &self, label: &'static str, data: &[u32], ) -> SpatialResult<Buffer>
Uploads u32 values into a reusable pooled storage buffer.
Sourcepub fn recycle_storage(&self, byte_len: u64, buffer: Buffer)
pub fn recycle_storage(&self, byte_len: u64, buffer: Buffer)
Returns a storage buffer to the upload pool for reuse.
Sourcepub fn clear_buffer_pool(&self)
pub fn clear_buffer_pool(&self)
Clears all buffers cached in the upload pool.
Sourcepub async fn new_headless_async(
preference: WgpuPowerPreference,
) -> SpatialResult<Self>
pub async fn new_headless_async( preference: WgpuPowerPreference, ) -> SpatialResult<Self>
Creates a headless runtime asynchronously.
This is the browser/WebGPU construction path because blocking a WASM main thread is not supported. Native callers may also use it from their async executor.
Sourcepub async fn new_headless_with_timestamps_async(
preference: WgpuPowerPreference,
) -> SpatialResult<Self>
pub async fn new_headless_with_timestamps_async( preference: WgpuPowerPreference, ) -> SpatialResult<Self>
Async counterpart of Self::new_headless_with_timestamps.
Sourcepub async fn new_headless_with_options_async(
options: WgpuRuntimeOptions,
) -> SpatialResult<Self>
pub async fn new_headless_with_options_async( options: WgpuRuntimeOptions, ) -> SpatialResult<Self>
Async counterpart of Self::new_headless_with_options.
Trait Implementations§
Source§impl SpatialRuntime for WgpuRuntime
Available on crate feature gpu-wgpu only.
impl SpatialRuntime for WgpuRuntime
gpu-wgpu only.