wgpu_core/command/
compute_command.rs

1use alloc::vec::Vec;
2
3#[cfg(feature = "serde")]
4use crate::command::serde_object_reference_struct;
5use crate::command::{ArcReferences, ReferenceType};
6
7#[cfg(feature = "serde")]
8use macro_rules_attribute::apply;
9
10/// cbindgen:ignore
11#[derive(Clone, Debug)]
12#[cfg_attr(feature = "serde", apply(serde_object_reference_struct))]
13pub enum ComputeCommand<R: ReferenceType> {
14    SetBindGroup {
15        index: u32,
16        num_dynamic_offsets: usize,
17        bind_group: Option<R::BindGroup>,
18    },
19
20    SetPipeline(R::ComputePipeline),
21
22    /// Set a range of immediates to values stored in `immediates_data`.
23    SetImmediate {
24        /// The byte offset within the immediate data storage to write to. This
25        /// must be a multiple of four.
26        offset: u32,
27
28        /// The immediate data to be written.
29        data: Vec<u32>,
30    },
31
32    DispatchWorkgroups([u32; 3]),
33
34    DispatchWorkgroupsIndirect {
35        buffer: R::Buffer,
36        offset: wgt::BufferAddress,
37    },
38
39    PushDebugGroup {
40        color: u32,
41        len: usize,
42    },
43
44    PopDebugGroup,
45
46    InsertDebugMarker {
47        color: u32,
48        len: usize,
49    },
50
51    WriteTimestamp {
52        query_set: R::QuerySet,
53        query_index: u32,
54    },
55
56    BeginPipelineStatisticsQuery {
57        query_set: R::QuerySet,
58        query_index: u32,
59    },
60
61    EndPipelineStatisticsQuery,
62
63    TransitionResources {
64        buffer_transitions: Vec<wgt::BufferTransition<R::Buffer>>,
65        texture_transitions: Vec<wgt::TextureTransition<R::TextureView>>,
66    },
67}
68
69/// cbindgen:ignore
70pub type ArcComputeCommand = ComputeCommand<ArcReferences>;