Skip to main content

quickgpu/builders/
render_pipeline_descriptor_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::RenderPipelineDescriptor`]\n        \nSet all required fields and any optional fields, then call `build()`.\n\nBuilder field setters:\n  - [layout](RenderPipelineDescriptorBuilder::layout) Optional, defaults to `None`\n  - [vertex](RenderPipelineDescriptorBuilder::vertex) Required\n  - [primitive](RenderPipelineDescriptorBuilder::primitive) Optional, defaults to [wgpu::PrimitiveState::default()]\n  - [depth_stencil](RenderPipelineDescriptorBuilder::depth_stencil) Optional, defaults to `None`\n  - [multisample](RenderPipelineDescriptorBuilder::multisample) Optional, defaults to [wgpu::MultisampleState::default()]\n  - [fragment](RenderPipelineDescriptorBuilder::fragment) Optional, defaults to `None`\n  - [multiview_mask](RenderPipelineDescriptorBuilder::multiview_mask) Optional, defaults to `None`\n  - [cache](RenderPipelineDescriptorBuilder::cache) Optional, defaults to `None`\n"]
9pub struct RenderPipelineDescriptorBuilder<'a, CS: State<'a>> {
10    label: CS::Label,
11    layout: CS::Layout,
12    vertex: CS::Vertex,
13    primitive: CS::Primitive,
14    depth_stencil: CS::DepthStencil,
15    multisample: CS::Multisample,
16    fragment: CS::Fragment,
17    multiview_mask: CS::MultiviewMask,
18    cache: CS::Cache,
19}
20impl<'a> RenderPipelineDescriptorBuilder<'a, Empty> {
21    pub fn new() -> RenderPipelineDescriptorBuilder<'a, Empty> {
22        RenderPipelineDescriptorBuilder {
23            label: LabelEmpty,
24            layout: LayoutEmpty,
25            vertex: VertexEmpty,
26            primitive: PrimitiveEmpty,
27            depth_stencil: DepthStencilEmpty,
28            multisample: MultisampleEmpty,
29            fragment: FragmentEmpty,
30            multiview_mask: MultiviewMaskEmpty,
31            cache: CacheEmpty,
32        }
33    }
34}
35#[doc = "\nReturns [RenderPipelineDescriptorBuilder] for building [`wgpu::RenderPipelineDescriptor`]\n        \nSet all required fields and any optional fields, then call `build()`.\n\nBuilder field setters:\n  - [layout](RenderPipelineDescriptorBuilder::layout) Optional, defaults to `None`\n  - [vertex](RenderPipelineDescriptorBuilder::vertex) Required\n  - [primitive](RenderPipelineDescriptorBuilder::primitive) Optional, defaults to [wgpu::PrimitiveState::default()]\n  - [depth_stencil](RenderPipelineDescriptorBuilder::depth_stencil) Optional, defaults to `None`\n  - [multisample](RenderPipelineDescriptorBuilder::multisample) Optional, defaults to [wgpu::MultisampleState::default()]\n  - [fragment](RenderPipelineDescriptorBuilder::fragment) Optional, defaults to `None`\n  - [multiview_mask](RenderPipelineDescriptorBuilder::multiview_mask) Optional, defaults to `None`\n  - [cache](RenderPipelineDescriptorBuilder::cache) Optional, defaults to `None`\n"]
36pub fn render_pipeline_descriptor<'a>(
37    label: wgpu::Label<'a>,
38) -> RenderPipelineDescriptorBuilder<'a, SetLabel<Empty>> {
39    RenderPipelineDescriptorBuilder::new().label(label)
40}
41pub struct LabelEmpty;
42impl Field for LabelEmpty {}
43pub trait LabelIsEmpty {}
44impl LabelIsEmpty for LabelEmpty {}
45pub trait IsSetLabel<'a> {
46    fn get(self) -> wgpu::Label<'a>;
47}
48impl<'a> IsSetLabel<'a> for LabelEmpty {
49    fn get(self) -> wgpu::Label<'a> {
50        None
51    }
52}
53pub struct LabelValue<'a>(pub wgpu::Label<'a>);
54impl<'a> Field for LabelValue<'a> {}
55impl<'a> IsSetLabel<'a> for LabelValue<'a> {
56    fn get(self) -> wgpu::Label<'a> {
57        self.0
58    }
59}
60pub struct LayoutEmpty;
61impl Field for LayoutEmpty {}
62pub trait LayoutIsEmpty {}
63impl LayoutIsEmpty for LayoutEmpty {}
64pub trait IsSetLayout<'a> {
65    fn get(self) -> Option<&'a wgpu::PipelineLayout>;
66}
67impl<'a> IsSetLayout<'a> for LayoutEmpty {
68    fn get(self) -> Option<&'a wgpu::PipelineLayout> {
69        None
70    }
71}
72pub struct LayoutValue<'a>(pub Option<&'a wgpu::PipelineLayout>);
73impl<'a> Field for LayoutValue<'a> {}
74impl<'a> IsSetLayout<'a> for LayoutValue<'a> {
75    fn get(self) -> Option<&'a wgpu::PipelineLayout> {
76        self.0
77    }
78}
79pub struct VertexEmpty;
80impl Field for VertexEmpty {}
81pub trait VertexIsEmpty {}
82impl VertexIsEmpty for VertexEmpty {}
83pub trait IsSetVertex<'a> {
84    fn get(self) -> wgpu::VertexState<'a>;
85}
86pub struct VertexValue<'a>(pub wgpu::VertexState<'a>);
87impl<'a> Field for VertexValue<'a> {}
88impl<'a> IsSetVertex<'a> for VertexValue<'a> {
89    fn get(self) -> wgpu::VertexState<'a> {
90        self.0
91    }
92}
93pub struct PrimitiveEmpty;
94impl Field for PrimitiveEmpty {}
95pub trait PrimitiveIsEmpty {}
96impl PrimitiveIsEmpty for PrimitiveEmpty {}
97pub trait IsSetPrimitive {
98    fn get(self) -> wgpu::PrimitiveState;
99}
100impl IsSetPrimitive for PrimitiveEmpty {
101    fn get(self) -> wgpu::PrimitiveState {
102        wgpu::PrimitiveState::default()
103    }
104}
105pub struct PrimitiveValue(pub wgpu::PrimitiveState);
106impl Field for PrimitiveValue {}
107impl IsSetPrimitive for PrimitiveValue {
108    fn get(self) -> wgpu::PrimitiveState {
109        self.0
110    }
111}
112pub struct DepthStencilEmpty;
113impl Field for DepthStencilEmpty {}
114pub trait DepthStencilIsEmpty {}
115impl DepthStencilIsEmpty for DepthStencilEmpty {}
116pub trait IsSetDepthStencil {
117    fn get(self) -> Option<wgpu::DepthStencilState>;
118}
119impl IsSetDepthStencil for DepthStencilEmpty {
120    fn get(self) -> Option<wgpu::DepthStencilState> {
121        None
122    }
123}
124pub struct DepthStencilValue(pub Option<wgpu::DepthStencilState>);
125impl Field for DepthStencilValue {}
126impl IsSetDepthStencil for DepthStencilValue {
127    fn get(self) -> Option<wgpu::DepthStencilState> {
128        self.0
129    }
130}
131pub struct MultisampleEmpty;
132impl Field for MultisampleEmpty {}
133pub trait MultisampleIsEmpty {}
134impl MultisampleIsEmpty for MultisampleEmpty {}
135pub trait IsSetMultisample {
136    fn get(self) -> wgpu::MultisampleState;
137}
138impl IsSetMultisample for MultisampleEmpty {
139    fn get(self) -> wgpu::MultisampleState {
140        wgpu::MultisampleState::default()
141    }
142}
143pub struct MultisampleValue(pub wgpu::MultisampleState);
144impl Field for MultisampleValue {}
145impl IsSetMultisample for MultisampleValue {
146    fn get(self) -> wgpu::MultisampleState {
147        self.0
148    }
149}
150pub struct FragmentEmpty;
151impl Field for FragmentEmpty {}
152pub trait FragmentIsEmpty {}
153impl FragmentIsEmpty for FragmentEmpty {}
154pub trait IsSetFragment<'a> {
155    fn get(self) -> Option<wgpu::FragmentState<'a>>;
156}
157impl<'a> IsSetFragment<'a> for FragmentEmpty {
158    fn get(self) -> Option<wgpu::FragmentState<'a>> {
159        None
160    }
161}
162pub struct FragmentValue<'a>(pub Option<wgpu::FragmentState<'a>>);
163impl<'a> Field for FragmentValue<'a> {}
164impl<'a> IsSetFragment<'a> for FragmentValue<'a> {
165    fn get(self) -> Option<wgpu::FragmentState<'a>> {
166        self.0
167    }
168}
169pub struct MultiviewMaskEmpty;
170impl Field for MultiviewMaskEmpty {}
171pub trait MultiviewMaskIsEmpty {}
172impl MultiviewMaskIsEmpty for MultiviewMaskEmpty {}
173pub trait IsSetMultiviewMask {
174    fn get(self) -> Option<NonZeroU32>;
175}
176impl IsSetMultiviewMask for MultiviewMaskEmpty {
177    fn get(self) -> Option<NonZeroU32> {
178        None
179    }
180}
181pub struct MultiviewMaskValue(pub Option<NonZeroU32>);
182impl Field for MultiviewMaskValue {}
183impl IsSetMultiviewMask for MultiviewMaskValue {
184    fn get(self) -> Option<NonZeroU32> {
185        self.0
186    }
187}
188pub struct CacheEmpty;
189impl Field for CacheEmpty {}
190pub trait CacheIsEmpty {}
191impl CacheIsEmpty for CacheEmpty {}
192pub trait IsSetCache<'a> {
193    fn get(self) -> Option<&'a wgpu::PipelineCache>;
194}
195impl<'a> IsSetCache<'a> for CacheEmpty {
196    fn get(self) -> Option<&'a wgpu::PipelineCache> {
197        None
198    }
199}
200pub struct CacheValue<'a>(pub Option<&'a wgpu::PipelineCache>);
201impl<'a> Field for CacheValue<'a> {}
202impl<'a> IsSetCache<'a> for CacheValue<'a> {
203    fn get(self) -> Option<&'a wgpu::PipelineCache> {
204        self.0
205    }
206}
207pub trait State<'a> {
208    type Label: Field;
209    type Layout: Field;
210    type Vertex: Field;
211    type Primitive: Field;
212    type DepthStencil: Field;
213    type Multisample: Field;
214    type Fragment: Field;
215    type MultiviewMask: Field;
216    type Cache: Field;
217}
218pub struct Empty;
219impl<'a> State<'a> for Empty {
220    type Label = LabelEmpty;
221    type Layout = LayoutEmpty;
222    type Vertex = VertexEmpty;
223    type Primitive = PrimitiveEmpty;
224    type DepthStencil = DepthStencilEmpty;
225    type Multisample = MultisampleEmpty;
226    type Fragment = FragmentEmpty;
227    type MultiviewMask = MultiviewMaskEmpty;
228    type Cache = CacheEmpty;
229}
230pub struct SetLabel<CS>(CS);
231impl<'a, CS: State<'a>> State<'a> for SetLabel<CS> {
232    type Label = LabelValue<'a>;
233    type Layout = CS::Layout;
234    type Vertex = CS::Vertex;
235    type Primitive = CS::Primitive;
236    type DepthStencil = CS::DepthStencil;
237    type Multisample = CS::Multisample;
238    type Fragment = CS::Fragment;
239    type MultiviewMask = CS::MultiviewMask;
240    type Cache = CS::Cache;
241}
242pub struct SetLayout<CS>(CS);
243impl<'a, CS: State<'a>> State<'a> for SetLayout<CS> {
244    type Label = CS::Label;
245    type Layout = LayoutValue<'a>;
246    type Vertex = CS::Vertex;
247    type Primitive = CS::Primitive;
248    type DepthStencil = CS::DepthStencil;
249    type Multisample = CS::Multisample;
250    type Fragment = CS::Fragment;
251    type MultiviewMask = CS::MultiviewMask;
252    type Cache = CS::Cache;
253}
254pub struct SetVertex<CS>(CS);
255impl<'a, CS: State<'a>> State<'a> for SetVertex<CS> {
256    type Label = CS::Label;
257    type Layout = CS::Layout;
258    type Vertex = VertexValue<'a>;
259    type Primitive = CS::Primitive;
260    type DepthStencil = CS::DepthStencil;
261    type Multisample = CS::Multisample;
262    type Fragment = CS::Fragment;
263    type MultiviewMask = CS::MultiviewMask;
264    type Cache = CS::Cache;
265}
266pub struct SetPrimitive<CS>(CS);
267impl<'a, CS: State<'a>> State<'a> for SetPrimitive<CS> {
268    type Label = CS::Label;
269    type Layout = CS::Layout;
270    type Vertex = CS::Vertex;
271    type Primitive = PrimitiveValue;
272    type DepthStencil = CS::DepthStencil;
273    type Multisample = CS::Multisample;
274    type Fragment = CS::Fragment;
275    type MultiviewMask = CS::MultiviewMask;
276    type Cache = CS::Cache;
277}
278pub struct SetDepthStencil<CS>(CS);
279impl<'a, CS: State<'a>> State<'a> for SetDepthStencil<CS> {
280    type Label = CS::Label;
281    type Layout = CS::Layout;
282    type Vertex = CS::Vertex;
283    type Primitive = CS::Primitive;
284    type DepthStencil = DepthStencilValue;
285    type Multisample = CS::Multisample;
286    type Fragment = CS::Fragment;
287    type MultiviewMask = CS::MultiviewMask;
288    type Cache = CS::Cache;
289}
290pub struct SetMultisample<CS>(CS);
291impl<'a, CS: State<'a>> State<'a> for SetMultisample<CS> {
292    type Label = CS::Label;
293    type Layout = CS::Layout;
294    type Vertex = CS::Vertex;
295    type Primitive = CS::Primitive;
296    type DepthStencil = CS::DepthStencil;
297    type Multisample = MultisampleValue;
298    type Fragment = CS::Fragment;
299    type MultiviewMask = CS::MultiviewMask;
300    type Cache = CS::Cache;
301}
302pub struct SetFragment<CS>(CS);
303impl<'a, CS: State<'a>> State<'a> for SetFragment<CS> {
304    type Label = CS::Label;
305    type Layout = CS::Layout;
306    type Vertex = CS::Vertex;
307    type Primitive = CS::Primitive;
308    type DepthStencil = CS::DepthStencil;
309    type Multisample = CS::Multisample;
310    type Fragment = FragmentValue<'a>;
311    type MultiviewMask = CS::MultiviewMask;
312    type Cache = CS::Cache;
313}
314pub struct SetMultiviewMask<CS>(CS);
315impl<'a, CS: State<'a>> State<'a> for SetMultiviewMask<CS> {
316    type Label = CS::Label;
317    type Layout = CS::Layout;
318    type Vertex = CS::Vertex;
319    type Primitive = CS::Primitive;
320    type DepthStencil = CS::DepthStencil;
321    type Multisample = CS::Multisample;
322    type Fragment = CS::Fragment;
323    type MultiviewMask = MultiviewMaskValue;
324    type Cache = CS::Cache;
325}
326pub struct SetCache<CS>(CS);
327impl<'a, CS: State<'a>> State<'a> for SetCache<CS> {
328    type Label = CS::Label;
329    type Layout = CS::Layout;
330    type Vertex = CS::Vertex;
331    type Primitive = CS::Primitive;
332    type DepthStencil = CS::DepthStencil;
333    type Multisample = CS::Multisample;
334    type Fragment = CS::Fragment;
335    type MultiviewMask = CS::MultiviewMask;
336    type Cache = CacheValue<'a>;
337}
338impl<'a, CS: State<'a>> RenderPipelineDescriptorBuilder<'a, CS> {
339    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::label]. Optional, defaults to `None`.\n"]
340    pub fn label(self, label: wgpu::Label<'a>) -> RenderPipelineDescriptorBuilder<'a, SetLabel<CS>>
341    where
342        CS::Label: LabelIsEmpty,
343    {
344        RenderPipelineDescriptorBuilder {
345            label: LabelValue(label),
346            layout: self.layout,
347            vertex: self.vertex,
348            primitive: self.primitive,
349            depth_stencil: self.depth_stencil,
350            multisample: self.multisample,
351            fragment: self.fragment,
352            multiview_mask: self.multiview_mask,
353            cache: self.cache,
354        }
355    }
356    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::layout]. Optional, defaults to `None`.\n"]
357    pub fn layout(
358        self,
359        layout: &'a wgpu::PipelineLayout,
360    ) -> RenderPipelineDescriptorBuilder<'a, SetLayout<CS>>
361    where
362        CS::Layout: LayoutIsEmpty,
363    {
364        RenderPipelineDescriptorBuilder {
365            label: self.label,
366            layout: LayoutValue(Some(layout)),
367            vertex: self.vertex,
368            primitive: self.primitive,
369            depth_stencil: self.depth_stencil,
370            multisample: self.multisample,
371            fragment: self.fragment,
372            multiview_mask: self.multiview_mask,
373            cache: self.cache,
374        }
375    }
376    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::layout]. Optional, defaults to `None`.\n"]
377    pub fn maybe_layout(
378        self,
379        layout: Option<&'a wgpu::PipelineLayout>,
380    ) -> RenderPipelineDescriptorBuilder<'a, SetLayout<CS>>
381    where
382        CS::Layout: LayoutIsEmpty,
383    {
384        RenderPipelineDescriptorBuilder {
385            label: self.label,
386            layout: LayoutValue(layout),
387            vertex: self.vertex,
388            primitive: self.primitive,
389            depth_stencil: self.depth_stencil,
390            multisample: self.multisample,
391            fragment: self.fragment,
392            multiview_mask: self.multiview_mask,
393            cache: self.cache,
394        }
395    }
396    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::vertex]. Required.\n"]
397    pub fn vertex(
398        self,
399        vertex: impl Nested<wgpu::VertexState<'a>>,
400    ) -> RenderPipelineDescriptorBuilder<'a, SetVertex<CS>>
401    where
402        CS::Vertex: VertexIsEmpty,
403    {
404        RenderPipelineDescriptorBuilder {
405            label: self.label,
406            layout: self.layout,
407            vertex: VertexValue(Nested::unnest(vertex)),
408            primitive: self.primitive,
409            depth_stencil: self.depth_stencil,
410            multisample: self.multisample,
411            fragment: self.fragment,
412            multiview_mask: self.multiview_mask,
413            cache: self.cache,
414        }
415    }
416    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::primitive]. Optional, defaults to [wgpu::PrimitiveState::default()].\n"]
417    pub fn primitive(
418        self,
419        primitive: impl Nested<wgpu::PrimitiveState>,
420    ) -> RenderPipelineDescriptorBuilder<'a, SetPrimitive<CS>>
421    where
422        CS::Primitive: PrimitiveIsEmpty,
423    {
424        RenderPipelineDescriptorBuilder {
425            label: self.label,
426            layout: self.layout,
427            vertex: self.vertex,
428            primitive: PrimitiveValue(Nested::unnest(primitive)),
429            depth_stencil: self.depth_stencil,
430            multisample: self.multisample,
431            fragment: self.fragment,
432            multiview_mask: self.multiview_mask,
433            cache: self.cache,
434        }
435    }
436    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::depth_stencil]. Optional, defaults to `None`.\n"]
437    pub fn depth_stencil(
438        self,
439        depth_stencil: impl Nested<wgpu::DepthStencilState>,
440    ) -> RenderPipelineDescriptorBuilder<'a, SetDepthStencil<CS>>
441    where
442        CS::DepthStencil: DepthStencilIsEmpty,
443    {
444        RenderPipelineDescriptorBuilder {
445            label: self.label,
446            layout: self.layout,
447            vertex: self.vertex,
448            primitive: self.primitive,
449            depth_stencil: DepthStencilValue(Some(Nested::unnest(depth_stencil))),
450            multisample: self.multisample,
451            fragment: self.fragment,
452            multiview_mask: self.multiview_mask,
453            cache: self.cache,
454        }
455    }
456    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::depth_stencil]. Optional, defaults to `None`.\n"]
457    pub fn maybe_depth_stencil(
458        self,
459        depth_stencil: impl Nested<Option<wgpu::DepthStencilState>>,
460    ) -> RenderPipelineDescriptorBuilder<'a, SetDepthStencil<CS>>
461    where
462        CS::DepthStencil: DepthStencilIsEmpty,
463    {
464        RenderPipelineDescriptorBuilder {
465            label: self.label,
466            layout: self.layout,
467            vertex: self.vertex,
468            primitive: self.primitive,
469            depth_stencil: DepthStencilValue(Nested::unnest(depth_stencil)),
470            multisample: self.multisample,
471            fragment: self.fragment,
472            multiview_mask: self.multiview_mask,
473            cache: self.cache,
474        }
475    }
476    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::multisample]. Optional, defaults to [wgpu::MultisampleState::default()].\n"]
477    pub fn multisample(
478        self,
479        multisample: impl Nested<wgpu::MultisampleState>,
480    ) -> RenderPipelineDescriptorBuilder<'a, SetMultisample<CS>>
481    where
482        CS::Multisample: MultisampleIsEmpty,
483    {
484        RenderPipelineDescriptorBuilder {
485            label: self.label,
486            layout: self.layout,
487            vertex: self.vertex,
488            primitive: self.primitive,
489            depth_stencil: self.depth_stencil,
490            multisample: MultisampleValue(Nested::unnest(multisample)),
491            fragment: self.fragment,
492            multiview_mask: self.multiview_mask,
493            cache: self.cache,
494        }
495    }
496    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::fragment]. Optional, defaults to `None`.\n"]
497    pub fn fragment(
498        self,
499        fragment: impl Nested<wgpu::FragmentState<'a>>,
500    ) -> RenderPipelineDescriptorBuilder<'a, SetFragment<CS>>
501    where
502        CS::Fragment: FragmentIsEmpty,
503    {
504        RenderPipelineDescriptorBuilder {
505            label: self.label,
506            layout: self.layout,
507            vertex: self.vertex,
508            primitive: self.primitive,
509            depth_stencil: self.depth_stencil,
510            multisample: self.multisample,
511            fragment: FragmentValue(Some(Nested::unnest(fragment))),
512            multiview_mask: self.multiview_mask,
513            cache: self.cache,
514        }
515    }
516    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::fragment]. Optional, defaults to `None`.\n"]
517    pub fn maybe_fragment(
518        self,
519        fragment: impl Nested<Option<wgpu::FragmentState<'a>>>,
520    ) -> RenderPipelineDescriptorBuilder<'a, SetFragment<CS>>
521    where
522        CS::Fragment: FragmentIsEmpty,
523    {
524        RenderPipelineDescriptorBuilder {
525            label: self.label,
526            layout: self.layout,
527            vertex: self.vertex,
528            primitive: self.primitive,
529            depth_stencil: self.depth_stencil,
530            multisample: self.multisample,
531            fragment: FragmentValue(Nested::unnest(fragment)),
532            multiview_mask: self.multiview_mask,
533            cache: self.cache,
534        }
535    }
536    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::multiview_mask]. Optional, defaults to `None`.\n"]
537    pub fn multiview_mask(
538        self,
539        multiview_mask: NonZeroU32,
540    ) -> RenderPipelineDescriptorBuilder<'a, SetMultiviewMask<CS>>
541    where
542        CS::MultiviewMask: MultiviewMaskIsEmpty,
543    {
544        RenderPipelineDescriptorBuilder {
545            label: self.label,
546            layout: self.layout,
547            vertex: self.vertex,
548            primitive: self.primitive,
549            depth_stencil: self.depth_stencil,
550            multisample: self.multisample,
551            fragment: self.fragment,
552            multiview_mask: MultiviewMaskValue(Some(multiview_mask)),
553            cache: self.cache,
554        }
555    }
556    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::multiview_mask]. Optional, defaults to `None`.\n"]
557    pub fn maybe_multiview_mask(
558        self,
559        multiview_mask: Option<NonZeroU32>,
560    ) -> RenderPipelineDescriptorBuilder<'a, SetMultiviewMask<CS>>
561    where
562        CS::MultiviewMask: MultiviewMaskIsEmpty,
563    {
564        RenderPipelineDescriptorBuilder {
565            label: self.label,
566            layout: self.layout,
567            vertex: self.vertex,
568            primitive: self.primitive,
569            depth_stencil: self.depth_stencil,
570            multisample: self.multisample,
571            fragment: self.fragment,
572            multiview_mask: MultiviewMaskValue(multiview_mask),
573            cache: self.cache,
574        }
575    }
576    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::cache]. Optional, defaults to `None`.\n"]
577    pub fn cache(
578        self,
579        cache: &'a wgpu::PipelineCache,
580    ) -> RenderPipelineDescriptorBuilder<'a, SetCache<CS>>
581    where
582        CS::Cache: CacheIsEmpty,
583    {
584        RenderPipelineDescriptorBuilder {
585            label: self.label,
586            layout: self.layout,
587            vertex: self.vertex,
588            primitive: self.primitive,
589            depth_stencil: self.depth_stencil,
590            multisample: self.multisample,
591            fragment: self.fragment,
592            multiview_mask: self.multiview_mask,
593            cache: CacheValue(Some(cache)),
594        }
595    }
596    #[doc = "Setter for [wgpu::RenderPipelineDescriptor::cache]. Optional, defaults to `None`.\n"]
597    pub fn maybe_cache(
598        self,
599        cache: Option<&'a wgpu::PipelineCache>,
600    ) -> RenderPipelineDescriptorBuilder<'a, SetCache<CS>>
601    where
602        CS::Cache: CacheIsEmpty,
603    {
604        RenderPipelineDescriptorBuilder {
605            label: self.label,
606            layout: self.layout,
607            vertex: self.vertex,
608            primitive: self.primitive,
609            depth_stencil: self.depth_stencil,
610            multisample: self.multisample,
611            fragment: self.fragment,
612            multiview_mask: self.multiview_mask,
613            cache: CacheValue(cache),
614        }
615    }
616}
617pub trait Complete<'a>:
618    State<
619    'a,
620    Label: IsSetLabel<'a>,
621    Layout: IsSetLayout<'a>,
622    Vertex: IsSetVertex<'a>,
623    Primitive: IsSetPrimitive,
624    DepthStencil: IsSetDepthStencil,
625    Multisample: IsSetMultisample,
626    Fragment: IsSetFragment<'a>,
627    MultiviewMask: IsSetMultiviewMask,
628    Cache: IsSetCache<'a>,
629>
630{
631}
632impl<
633        'a,
634        CS: State<
635            'a,
636            Label: IsSetLabel<'a>,
637            Layout: IsSetLayout<'a>,
638            Vertex: IsSetVertex<'a>,
639            Primitive: IsSetPrimitive,
640            DepthStencil: IsSetDepthStencil,
641            Multisample: IsSetMultisample,
642            Fragment: IsSetFragment<'a>,
643            MultiviewMask: IsSetMultiviewMask,
644            Cache: IsSetCache<'a>,
645        >,
646    > Complete<'a> for CS
647{
648}
649impl<'a, CS: Complete<'a>> RenderPipelineDescriptorBuilder<'a, CS> {
650    pub fn build(self) -> wgpu::RenderPipelineDescriptor<'a> {
651        wgpu::RenderPipelineDescriptor {
652            label: IsSetLabel::get(self.label),
653            layout: IsSetLayout::get(self.layout),
654            vertex: IsSetVertex::get(self.vertex),
655            primitive: IsSetPrimitive::get(self.primitive),
656            depth_stencil: IsSetDepthStencil::get(self.depth_stencil),
657            multisample: IsSetMultisample::get(self.multisample),
658            fragment: IsSetFragment::get(self.fragment),
659            multiview_mask: IsSetMultiviewMask::get(self.multiview_mask),
660            cache: IsSetCache::get(self.cache),
661        }
662    }
663}
664impl<'a> Nested<wgpu::RenderPipelineDescriptor<'a>> for wgpu::RenderPipelineDescriptor<'a> {
665    fn unnest(self) -> wgpu::RenderPipelineDescriptor<'a> {
666        self
667    }
668}
669impl<'a, CS: Complete<'a>> Nested<wgpu::RenderPipelineDescriptor<'a>>
670    for RenderPipelineDescriptorBuilder<'a, CS>
671{
672    fn unnest(self) -> wgpu::RenderPipelineDescriptor<'a> {
673        self.build()
674    }
675}
676#[cfg(test)]
677mod tests {
678    #[allow(unused_imports)]
679    #[allow(unused_imports)]
680    use std::num::NonZeroU32;
681    #[test]
682    pub fn test_default() {
683        assert_eq!(
684            format!("{:#?}", super::IsSetLabel::get(super::LabelEmpty)),
685            format!("{:#?}", wgpu::Label::default()),
686        );
687        assert_eq!(
688            format!("{:#?}", super::IsSetLayout::get(super::LayoutEmpty)),
689            format!("{:#?}", Option::<&wgpu::PipelineLayout>::default()),
690        );
691        assert_eq!(
692            format!("{:#?}", super::IsSetPrimitive::get(super::PrimitiveEmpty)),
693            format!("{:#?}", wgpu::PrimitiveState::default()),
694        );
695        assert_eq!(
696            format!(
697                "{:#?}",
698                super::IsSetDepthStencil::get(super::DepthStencilEmpty)
699            ),
700            format!("{:#?}", Option::<wgpu::DepthStencilState>::default()),
701        );
702        assert_eq!(
703            format!(
704                "{:#?}",
705                super::IsSetMultisample::get(super::MultisampleEmpty)
706            ),
707            format!("{:#?}", wgpu::MultisampleState::default()),
708        );
709        assert_eq!(
710            format!("{:#?}", super::IsSetFragment::get(super::FragmentEmpty)),
711            format!("{:#?}", Option::<wgpu::FragmentState>::default()),
712        );
713        assert_eq!(
714            format!(
715                "{:#?}",
716                super::IsSetMultiviewMask::get(super::MultiviewMaskEmpty)
717            ),
718            format!("{:#?}", Option::<NonZeroU32>::default()),
719        );
720        assert_eq!(
721            format!("{:#?}", super::IsSetCache::get(super::CacheEmpty)),
722            format!("{:#?}", Option::<&wgpu::PipelineCache>::default()),
723        );
724    }
725}