wgpu_core/command/
encoder.rs

1use alloc::{sync::Arc, vec::Vec};
2
3use crate::{
4    command::memory_init::CommandBufferTextureMemoryActions, device::Device,
5    init_tracker::BufferInitTrackerAction, ray_tracing::AsAction, snatch::SnatchGuard,
6    track::Tracker,
7};
8
9/// State applicable when encoding commands onto a compute pass, or onto a
10/// render pass, or directly with a command encoder.
11pub(crate) struct EncodingState<'snatch_guard, 'cmd_enc, 'raw_encoder> {
12    pub(crate) device: &'cmd_enc Arc<Device>,
13
14    pub(crate) raw_encoder: &'raw_encoder mut dyn hal::DynCommandEncoder,
15
16    pub(crate) tracker: &'cmd_enc mut Tracker,
17    pub(crate) buffer_memory_init_actions: &'cmd_enc mut Vec<BufferInitTrackerAction>,
18    pub(crate) texture_memory_actions: &'cmd_enc mut CommandBufferTextureMemoryActions,
19    pub(crate) as_actions: &'cmd_enc mut Vec<AsAction>,
20    pub(crate) indirect_draw_validation_resources:
21        &'cmd_enc mut crate::indirect_validation::DrawResources,
22
23    pub(crate) snatch_guard: &'snatch_guard SnatchGuard<'snatch_guard>,
24
25    /// Current debug scope nesting depth.
26    ///
27    /// When encoding a compute or render pass, this is the depth of debug
28    /// scopes in the pass, not the depth of debug scopes in the parent encoder.
29    pub(crate) debug_scope_depth: &'cmd_enc mut u32,
30}