Skip to main content

Module gpu

Module gpu 

Source
Expand description

GPU Resource Manager

Responsible for creating, updating, and managing GPU-side resources.

Uses a modular design with different responsibilities split into separate files:

  • buffer.rs: Buffer operations
  • texture.rs: Texture and Image operations
  • geometry.rs: Geometry operations
  • material.rs: Material operations
  • binding.rs: BindGroup operations
  • allocator.rs: ModelBufferAllocator
  • resource_ids.rs: Resource ID tracking and change detection

§Resource Management Architecture

Uses an “Ensure -> Check -> Rebuild” pattern:

  1. Ensure phase: Ensure GPU resources exist with up-to-date data, returning physical resource IDs
  2. Check phase: Compare resource IDs for changes, deciding whether to rebuild BindGroup
  3. Rebuild phase: If rebuild is needed, collect LayoutEntries and check if a new Layout is required

Structs§

BindGroupContext
BindGroupFingerprint
Complete fingerprint of a BindGroup
EnsureResult
Result of an ensure operation
GpuBufferHandle
Opaque handle into the GPU buffer arena.
GpuGlobalState
GPU global state (Group 0)
MipmapGenerator
ModelBufferAllocator
Model Buffer allocator.
ResourceIdSet
Resource ID set
ResourceManager
SamplerRegistry
SystemTextures
Global system fallback texture pool and Group 3 bind-group infrastructure.
Tracked
Resource wrapper with a unique ID Used to assign identity to FrameResources or temporary resources

Enums§

CommonSampler

Functions§

generate_gpu_resource_id
hash_layout_entries
Compute the hash of a BindGroupLayoutEntry list

Type Aliases§

ResourceId
Unique identifier for a GPU resource