quickgpu/builders/
draw_indexed_indirect_args_builder.rs

1// The code in this file is generated by a script. Do not edit it directly.
2//
3
4pub use super::super::Nested;
5pub use std::{borrow::Cow, num::NonZeroU32, ops::Range};
6pub trait Field {}
7pub trait IsOptional {}
8#[doc = "\nBuilder for [`wgpu::util::DrawIndexedIndirectArgs`]\n        \nSet all required fields and any optional fields, then call `build()`.\n\nBuilder field setters:\n  - [index_count](DrawIndexedIndirectArgsBuilder::index_count) Optional, defaults to `0u32`\n  - [instance_count](DrawIndexedIndirectArgsBuilder::instance_count) Optional, defaults to `0u32`\n  - [first_index](DrawIndexedIndirectArgsBuilder::first_index) Optional, defaults to `0u32`\n  - [base_vertex](DrawIndexedIndirectArgsBuilder::base_vertex) Optional, defaults to `0i32`\n  - [first_instance](DrawIndexedIndirectArgsBuilder::first_instance) Optional, defaults to `0u32`\n"]
9pub struct DrawIndexedIndirectArgsBuilder<CS: State> {
10    index_count: CS::IndexCount,
11    instance_count: CS::InstanceCount,
12    first_index: CS::FirstIndex,
13    base_vertex: CS::BaseVertex,
14    first_instance: CS::FirstInstance,
15}
16impl DrawIndexedIndirectArgsBuilder<Empty> {
17    pub fn new() -> DrawIndexedIndirectArgsBuilder<Empty> {
18        DrawIndexedIndirectArgsBuilder {
19            index_count: IndexCountEmpty,
20            instance_count: InstanceCountEmpty,
21            first_index: FirstIndexEmpty,
22            base_vertex: BaseVertexEmpty,
23            first_instance: FirstInstanceEmpty,
24        }
25    }
26}
27#[doc = "\nReturns [DrawIndexedIndirectArgsBuilder] for building [`wgpu::util::DrawIndexedIndirectArgs`]\n        \nSet all required fields and any optional fields, then call `build()`.\n\nBuilder field setters:\n  - [index_count](DrawIndexedIndirectArgsBuilder::index_count) Optional, defaults to `0u32`\n  - [instance_count](DrawIndexedIndirectArgsBuilder::instance_count) Optional, defaults to `0u32`\n  - [first_index](DrawIndexedIndirectArgsBuilder::first_index) Optional, defaults to `0u32`\n  - [base_vertex](DrawIndexedIndirectArgsBuilder::base_vertex) Optional, defaults to `0i32`\n  - [first_instance](DrawIndexedIndirectArgsBuilder::first_instance) Optional, defaults to `0u32`\n"]
28pub fn draw_indexed_indirect_args() -> DrawIndexedIndirectArgsBuilder<Empty> {
29    DrawIndexedIndirectArgsBuilder::new()
30}
31pub struct IndexCountEmpty;
32impl Field for IndexCountEmpty {}
33pub trait IndexCountIsEmpty {}
34impl IndexCountIsEmpty for IndexCountEmpty {}
35pub trait IsSetIndexCount {
36    fn get(self) -> u32;
37}
38impl IsSetIndexCount for IndexCountEmpty {
39    fn get(self) -> u32 {
40        0u32
41    }
42}
43pub struct IndexCountValue(pub u32);
44impl Field for IndexCountValue {}
45impl IsSetIndexCount for IndexCountValue {
46    fn get(self) -> u32 {
47        self.0
48    }
49}
50pub struct InstanceCountEmpty;
51impl Field for InstanceCountEmpty {}
52pub trait InstanceCountIsEmpty {}
53impl InstanceCountIsEmpty for InstanceCountEmpty {}
54pub trait IsSetInstanceCount {
55    fn get(self) -> u32;
56}
57impl IsSetInstanceCount for InstanceCountEmpty {
58    fn get(self) -> u32 {
59        0u32
60    }
61}
62pub struct InstanceCountValue(pub u32);
63impl Field for InstanceCountValue {}
64impl IsSetInstanceCount for InstanceCountValue {
65    fn get(self) -> u32 {
66        self.0
67    }
68}
69pub struct FirstIndexEmpty;
70impl Field for FirstIndexEmpty {}
71pub trait FirstIndexIsEmpty {}
72impl FirstIndexIsEmpty for FirstIndexEmpty {}
73pub trait IsSetFirstIndex {
74    fn get(self) -> u32;
75}
76impl IsSetFirstIndex for FirstIndexEmpty {
77    fn get(self) -> u32 {
78        0u32
79    }
80}
81pub struct FirstIndexValue(pub u32);
82impl Field for FirstIndexValue {}
83impl IsSetFirstIndex for FirstIndexValue {
84    fn get(self) -> u32 {
85        self.0
86    }
87}
88pub struct BaseVertexEmpty;
89impl Field for BaseVertexEmpty {}
90pub trait BaseVertexIsEmpty {}
91impl BaseVertexIsEmpty for BaseVertexEmpty {}
92pub trait IsSetBaseVertex {
93    fn get(self) -> i32;
94}
95impl IsSetBaseVertex for BaseVertexEmpty {
96    fn get(self) -> i32 {
97        0i32
98    }
99}
100pub struct BaseVertexValue(pub i32);
101impl Field for BaseVertexValue {}
102impl IsSetBaseVertex for BaseVertexValue {
103    fn get(self) -> i32 {
104        self.0
105    }
106}
107pub struct FirstInstanceEmpty;
108impl Field for FirstInstanceEmpty {}
109pub trait FirstInstanceIsEmpty {}
110impl FirstInstanceIsEmpty for FirstInstanceEmpty {}
111pub trait IsSetFirstInstance {
112    fn get(self) -> u32;
113}
114impl IsSetFirstInstance for FirstInstanceEmpty {
115    fn get(self) -> u32 {
116        0u32
117    }
118}
119pub struct FirstInstanceValue(pub u32);
120impl Field for FirstInstanceValue {}
121impl IsSetFirstInstance for FirstInstanceValue {
122    fn get(self) -> u32 {
123        self.0
124    }
125}
126pub trait State {
127    type IndexCount: Field;
128    type InstanceCount: Field;
129    type FirstIndex: Field;
130    type BaseVertex: Field;
131    type FirstInstance: Field;
132}
133pub struct Empty;
134impl State for Empty {
135    type IndexCount = IndexCountEmpty;
136    type InstanceCount = InstanceCountEmpty;
137    type FirstIndex = FirstIndexEmpty;
138    type BaseVertex = BaseVertexEmpty;
139    type FirstInstance = FirstInstanceEmpty;
140}
141pub struct SetIndexCount<CS>(CS);
142impl<CS: State> State for SetIndexCount<CS> {
143    type IndexCount = IndexCountValue;
144    type InstanceCount = CS::InstanceCount;
145    type FirstIndex = CS::FirstIndex;
146    type BaseVertex = CS::BaseVertex;
147    type FirstInstance = CS::FirstInstance;
148}
149pub struct SetInstanceCount<CS>(CS);
150impl<CS: State> State for SetInstanceCount<CS> {
151    type IndexCount = CS::IndexCount;
152    type InstanceCount = InstanceCountValue;
153    type FirstIndex = CS::FirstIndex;
154    type BaseVertex = CS::BaseVertex;
155    type FirstInstance = CS::FirstInstance;
156}
157pub struct SetFirstIndex<CS>(CS);
158impl<CS: State> State for SetFirstIndex<CS> {
159    type IndexCount = CS::IndexCount;
160    type InstanceCount = CS::InstanceCount;
161    type FirstIndex = FirstIndexValue;
162    type BaseVertex = CS::BaseVertex;
163    type FirstInstance = CS::FirstInstance;
164}
165pub struct SetBaseVertex<CS>(CS);
166impl<CS: State> State for SetBaseVertex<CS> {
167    type IndexCount = CS::IndexCount;
168    type InstanceCount = CS::InstanceCount;
169    type FirstIndex = CS::FirstIndex;
170    type BaseVertex = BaseVertexValue;
171    type FirstInstance = CS::FirstInstance;
172}
173pub struct SetFirstInstance<CS>(CS);
174impl<CS: State> State for SetFirstInstance<CS> {
175    type IndexCount = CS::IndexCount;
176    type InstanceCount = CS::InstanceCount;
177    type FirstIndex = CS::FirstIndex;
178    type BaseVertex = CS::BaseVertex;
179    type FirstInstance = FirstInstanceValue;
180}
181impl<CS: State> DrawIndexedIndirectArgsBuilder<CS> {
182    #[doc = "Setter for [wgpu::util::DrawIndexedIndirectArgs::index_count]. Optional, defaults to `0u32`.\n"]
183    pub fn index_count(self, index_count: u32) -> DrawIndexedIndirectArgsBuilder<SetIndexCount<CS>>
184    where
185        CS::IndexCount: IndexCountIsEmpty,
186    {
187        DrawIndexedIndirectArgsBuilder {
188            index_count: IndexCountValue(index_count),
189            instance_count: self.instance_count,
190            first_index: self.first_index,
191            base_vertex: self.base_vertex,
192            first_instance: self.first_instance,
193        }
194    }
195    #[doc = "Setter for [wgpu::util::DrawIndexedIndirectArgs::instance_count]. Optional, defaults to `0u32`.\n"]
196    pub fn instance_count(
197        self,
198        instance_count: u32,
199    ) -> DrawIndexedIndirectArgsBuilder<SetInstanceCount<CS>>
200    where
201        CS::InstanceCount: InstanceCountIsEmpty,
202    {
203        DrawIndexedIndirectArgsBuilder {
204            index_count: self.index_count,
205            instance_count: InstanceCountValue(instance_count),
206            first_index: self.first_index,
207            base_vertex: self.base_vertex,
208            first_instance: self.first_instance,
209        }
210    }
211    #[doc = "Setter for [wgpu::util::DrawIndexedIndirectArgs::first_index]. Optional, defaults to `0u32`.\n"]
212    pub fn first_index(self, first_index: u32) -> DrawIndexedIndirectArgsBuilder<SetFirstIndex<CS>>
213    where
214        CS::FirstIndex: FirstIndexIsEmpty,
215    {
216        DrawIndexedIndirectArgsBuilder {
217            index_count: self.index_count,
218            instance_count: self.instance_count,
219            first_index: FirstIndexValue(first_index),
220            base_vertex: self.base_vertex,
221            first_instance: self.first_instance,
222        }
223    }
224    #[doc = "Setter for [wgpu::util::DrawIndexedIndirectArgs::base_vertex]. Optional, defaults to `0i32`.\n"]
225    pub fn base_vertex(self, base_vertex: i32) -> DrawIndexedIndirectArgsBuilder<SetBaseVertex<CS>>
226    where
227        CS::BaseVertex: BaseVertexIsEmpty,
228    {
229        DrawIndexedIndirectArgsBuilder {
230            index_count: self.index_count,
231            instance_count: self.instance_count,
232            first_index: self.first_index,
233            base_vertex: BaseVertexValue(base_vertex),
234            first_instance: self.first_instance,
235        }
236    }
237    #[doc = "Setter for [wgpu::util::DrawIndexedIndirectArgs::first_instance]. Optional, defaults to `0u32`.\n"]
238    pub fn first_instance(
239        self,
240        first_instance: u32,
241    ) -> DrawIndexedIndirectArgsBuilder<SetFirstInstance<CS>>
242    where
243        CS::FirstInstance: FirstInstanceIsEmpty,
244    {
245        DrawIndexedIndirectArgsBuilder {
246            index_count: self.index_count,
247            instance_count: self.instance_count,
248            first_index: self.first_index,
249            base_vertex: self.base_vertex,
250            first_instance: FirstInstanceValue(first_instance),
251        }
252    }
253}
254pub trait Complete:
255    State<
256    IndexCount: IsSetIndexCount,
257    InstanceCount: IsSetInstanceCount,
258    FirstIndex: IsSetFirstIndex,
259    BaseVertex: IsSetBaseVertex,
260    FirstInstance: IsSetFirstInstance,
261>
262{
263}
264impl<
265        CS: State<
266            IndexCount: IsSetIndexCount,
267            InstanceCount: IsSetInstanceCount,
268            FirstIndex: IsSetFirstIndex,
269            BaseVertex: IsSetBaseVertex,
270            FirstInstance: IsSetFirstInstance,
271        >,
272    > Complete for CS
273{
274}
275impl<CS: Complete> DrawIndexedIndirectArgsBuilder<CS> {
276    pub fn build(self) -> wgpu::util::DrawIndexedIndirectArgs {
277        wgpu::util::DrawIndexedIndirectArgs {
278            index_count: IsSetIndexCount::get(self.index_count),
279            instance_count: IsSetInstanceCount::get(self.instance_count),
280            first_index: IsSetFirstIndex::get(self.first_index),
281            base_vertex: IsSetBaseVertex::get(self.base_vertex),
282            first_instance: IsSetFirstInstance::get(self.first_instance),
283        }
284    }
285}
286impl Nested<wgpu::util::DrawIndexedIndirectArgs> for wgpu::util::DrawIndexedIndirectArgs {
287    fn unnest(self) -> wgpu::util::DrawIndexedIndirectArgs {
288        self
289    }
290}
291impl<CS: Complete> Nested<wgpu::util::DrawIndexedIndirectArgs>
292    for DrawIndexedIndirectArgsBuilder<CS>
293{
294    fn unnest(self) -> wgpu::util::DrawIndexedIndirectArgs {
295        self.build()
296    }
297}
298#[cfg(test)]
299mod tests {
300    #[allow(unused_imports)]
301    #[allow(unused_imports)]
302    use std::num::NonZeroU32;
303    #[test]
304    pub fn test_default() {
305        assert_eq!(
306            format!("{:#?}", super::draw_indexed_indirect_args().build()),
307            format!("{:#?}", wgpu::util::DrawIndexedIndirectArgs::default()),
308        );
309    }
310}