Function wgpu_core::track::buffer::insert_or_barrier_update

source ·
unsafe fn insert_or_barrier_update(
    start_states: Option<&mut [BufferUses]>,
    current_states: &mut [BufferUses],
    resource_metadata: &mut ResourceMetadata<Arc<Buffer>>,
    index: usize,
    start_state_provider: BufferStateProvider<'_>,
    end_state_provider: Option<BufferStateProvider<'_>>,
    metadata_provider: ResourceMetadataProvider<'_, Arc<Buffer>>,
    barriers: &mut Vec<PendingTransition<BufferUses>>,
)
Expand description

If the resource isn’t tracked

  • Inserts the given resource.
  • Uses the start_state_provider to populate start_states
  • Uses either end_state_provider or start_state_provider to populate current_states.

If the resource is tracked

  • Inserts barriers from the state in current_states to the state provided by start_state_provider.
  • Updates the current_states with either the state from end_state_provider or start_state_provider.

Any barriers are added to the barrier vector.

§Safety

Indexes must be valid indexes into all arrays passed in to this function, either directly or via metadata or provider structs.