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 number of bytes to write. This must be a multiple of four.
29        size_bytes: u32,
30
31        /// Index in `immediates_data` of the start of the data
32        /// to be written.
33        ///
34        /// Note: this is not a byte offset like `offset`. Rather, it is the
35        /// index of the first `u32` element in `immediates_data` to read.
36        values_offset: u32,
37    },
38
39    DispatchWorkgroups([u32; 3]),
40
41    DispatchWorkgroupsIndirect {
42        buffer: R::Buffer,
43        offset: wgt::BufferAddress,
44    },
45
46    PushDebugGroup {
47        color: u32,
48        len: usize,
49    },
50
51    PopDebugGroup,
52
53    InsertDebugMarker {
54        color: u32,
55        len: usize,
56    },
57
58    WriteTimestamp {
59        query_set: R::QuerySet,
60        query_index: u32,
61    },
62
63    BeginPipelineStatisticsQuery {
64        query_set: R::QuerySet,
65        query_index: u32,
66    },
67
68    EndPipelineStatisticsQuery,
69
70    TransitionResources {
71        buffer_transitions: Vec<wgt::BufferTransition<R::Buffer>>,
72        texture_transitions: Vec<wgt::TextureTransition<R::TextureView>>,
73    },
74}
75
76/// cbindgen:ignore
77pub type ArcComputeCommand = ComputeCommand<ArcReferences>;