Crate daedalus_gpu

Crate daedalus_gpu 

Source
Expand description

GPU facade: backend selection, capability traits, opaque handles, and feature-gated backends. Feature matrix:

  • gpu-noop (default): deterministic noop backend, always available; zero-GPU environments still compile.
  • gpu-mock: deterministic mock backend for tests/CI.
  • gpu-wgpu: real wgpu backend (types remain internal), placeholder for now. Concurrency: backends are Send + Sync; clone the handle (cheap Arc) to share across tasks. Planner/runtime expectation: call select_backend once, inspect skipped reasons (for “why not GPU?”), then use the returned handle to allocate buffers/images without depending on any concrete GPU type.

Structs§

BackendSkip
Explanation for a backend that was skipped during selection.
ErasedPayload
Type-erased payload wrapper so runtimes can carry GPU-capable data without monomorphizing.
GpuAdapterInfo
Adapter information exposed to planner/runtime.
GpuBlockInfo
Block/stride info for formats (useful if compressed formats are added later).
GpuBufferHandle
Opaque buffer handle (no backend types).
GpuBufferId
Opaque buffer identifier.
GpuCapabilities
Capability query result.
GpuContextHandle
Shared handle wrapping a selected backend and diagnostics for why other backends were skipped.
GpuFormatFeatures
Per-format feature flags for planner/runtime decisions.
GpuImageHandle
Opaque image/texture handle (no backend types).
GpuImageId
Opaque image identifier.
GpuImageRequest
Request shape for image/texture creation.
GpuOptions
Adapter selection options.
GpuRequest
Request shape for resource creation.
GpuUsage
Usage flags for buffers/images; combinations are allowed.
NoopBackend
Noop backend: deterministic, does nothing.
SimpleBufferPool
Naive buffer pool that reuses freed handles by size and usage.
TransferStats
Upload telemetry for tracking bytes transferred.

Enums§

BackendSkipReason
Reason a backend was skipped during selection.
GpuBackendKind
Backend kind identifiers.
GpuError
GPU error codes for diagnostics.
GpuFormat
Common GPU formats (minimal set for planner decisions).
GpuMemoryLocation
Memory location hint for GPU resources.
Payload
Generic payload that can carry either CPU data or a GPU representation.

Traits§

BufferPool
Simple buffer pool trait; implementations provide recycling.
GpuBackend
GPU backend trait; no backend-specific types exposed.
GpuContext
Optional context trait if backends need per-thread context.
GpuSendable
Opt-in bridge to allow CPU types to participate in GPU segments. Users implement this for their own types to describe how to upload/download.

Functions§

active_backend
Convenience for callers that just need to know the active backend kind.
format_bytes_per_pixel
select_backend
Select the best available backend given build-time features and runtime options. Order: preferred backend (if set), then wgpu, mock, noop.
upload_bytes
Simple upload helper: allocates an upload buffer and returns it with bytes staged length.
upload_r8_texture
Convenience helper for uploading an R8 (single-channel) texture with basic size/length validation.
upload_rgba8_texture
Convenience helper for uploading an RGBA8 texture with basic size/length validation.
validate_texture_bytes
Validate texture copy layout against capabilities.