kazan 0.3.9+1.4.359

Vulkan bindings for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
//! <https://registry.khronos.org/vulkan/specs/latest/man/html/VK_KHR_fragment_shading_rate.html>
#![allow(unused_imports)]
use crate::{vk::Result as VkResult, vk::*, *};
use core::ffi::{CStr, c_char, c_int, c_void};
use core::mem::transmute;
use core::ptr;

pub const EXTENSION_NAME: &CStr = c"VK_KHR_fragment_shading_rate";

pub(super) mod defs {
    #![allow(non_camel_case_types, unused_imports)]
    use crate::{vk::*, *};
    use core::ffi::{CStr, c_char, c_int, c_void};
    use core::fmt;
    use core::marker::PhantomData;
    use core::ptr;

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/VkFragmentShadingRateAttachmentInfoKHR.html>
    #[repr(C)]
    #[derive(Copy, Clone)]
    #[must_use]
    pub struct FragmentShadingRateAttachmentInfoKHR<'a> {
        pub s_type: StructureType,
        pub p_next: *const c_void,
        pub p_fragment_shading_rate_attachment: *const AttachmentReference2<'a>,
        pub shading_rate_attachment_texel_size: Extent2D,
        pub _marker: PhantomData<&'a ()>,
    }

    #[cfg(feature = "debug")]
    impl fmt::Debug for FragmentShadingRateAttachmentInfoKHR<'_> {
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            f.debug_struct("FragmentShadingRateAttachmentInfoKHR")
                .field("s_type", &self.s_type)
                .field("p_next", &self.p_next)
                .field(
                    "p_fragment_shading_rate_attachment",
                    &self.p_fragment_shading_rate_attachment,
                )
                .field(
                    "shading_rate_attachment_texel_size",
                    &self.shading_rate_attachment_texel_size,
                )
                .finish()
        }
    }

    unsafe impl<'a> TaggedStructure<'a> for FragmentShadingRateAttachmentInfoKHR<'a> {
        const STRUCTURE_TYPE: StructureType =
            StructureType::FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR;
    }

    unsafe impl Extends<SubpassDescription2<'_>> for FragmentShadingRateAttachmentInfoKHR<'_> {}

    impl Default for FragmentShadingRateAttachmentInfoKHR<'_> {
        fn default() -> Self {
            Self {
                s_type: Self::STRUCTURE_TYPE,
                p_next: ptr::null(),
                p_fragment_shading_rate_attachment: ptr::null(),
                shading_rate_attachment_texel_size: Default::default(),
                _marker: PhantomData,
            }
        }
    }

    impl<'a> FragmentShadingRateAttachmentInfoKHR<'a> {
        #[inline]
        pub fn fragment_shading_rate_attachment(
            mut self,
            fragment_shading_rate_attachment: &'a AttachmentReference2<'a>,
        ) -> Self {
            self.p_fragment_shading_rate_attachment = fragment_shading_rate_attachment;
            self
        }

        #[inline]
        pub fn shading_rate_attachment_texel_size(
            mut self,
            shading_rate_attachment_texel_size: Extent2D,
        ) -> Self {
            self.shading_rate_attachment_texel_size = shading_rate_attachment_texel_size;
            self
        }
    }

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/VkPipelineFragmentShadingRateStateCreateInfoKHR.html>
    #[repr(C)]
    #[derive(Copy, Clone)]
    #[must_use]
    pub struct PipelineFragmentShadingRateStateCreateInfoKHR<'a> {
        pub s_type: StructureType,
        pub p_next: *const c_void,
        pub fragment_size: Extent2D,
        pub combiner_ops: [FragmentShadingRateCombinerOpKHR; 2],
        pub _marker: PhantomData<&'a ()>,
    }

    #[cfg(feature = "debug")]
    impl fmt::Debug for PipelineFragmentShadingRateStateCreateInfoKHR<'_> {
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            f.debug_struct("PipelineFragmentShadingRateStateCreateInfoKHR")
                .field("s_type", &self.s_type)
                .field("p_next", &self.p_next)
                .field("fragment_size", &self.fragment_size)
                .field("combiner_ops", &self.combiner_ops)
                .finish()
        }
    }

    unsafe impl<'a> TaggedStructure<'a> for PipelineFragmentShadingRateStateCreateInfoKHR<'a> {
        const STRUCTURE_TYPE: StructureType =
            StructureType::PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR;
    }

    unsafe impl Extends<GraphicsPipelineCreateInfo<'_>>
        for PipelineFragmentShadingRateStateCreateInfoKHR<'_>
    {
    }

    impl Default for PipelineFragmentShadingRateStateCreateInfoKHR<'_> {
        fn default() -> Self {
            Self {
                s_type: Self::STRUCTURE_TYPE,
                p_next: ptr::null(),
                fragment_size: Default::default(),
                combiner_ops: [Default::default(); _],
                _marker: PhantomData,
            }
        }
    }

    impl<'a> PipelineFragmentShadingRateStateCreateInfoKHR<'a> {
        #[inline]
        pub fn fragment_size(mut self, fragment_size: Extent2D) -> Self {
            self.fragment_size = fragment_size;
            self
        }

        #[inline]
        pub fn combiner_ops(mut self, combiner_ops: [FragmentShadingRateCombinerOpKHR; 2]) -> Self {
            self.combiner_ops = combiner_ops;
            self
        }
    }

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/VkPhysicalDeviceFragmentShadingRateFeaturesKHR.html>
    #[repr(C)]
    #[derive(Copy, Clone)]
    #[must_use]
    pub struct PhysicalDeviceFragmentShadingRateFeaturesKHR<'a> {
        pub s_type: StructureType,
        pub p_next: *mut c_void,
        pub pipeline_fragment_shading_rate: Bool32,
        pub primitive_fragment_shading_rate: Bool32,
        pub attachment_fragment_shading_rate: Bool32,
        pub _marker: PhantomData<&'a ()>,
    }

    #[cfg(feature = "debug")]
    impl fmt::Debug for PhysicalDeviceFragmentShadingRateFeaturesKHR<'_> {
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            f.debug_struct("PhysicalDeviceFragmentShadingRateFeaturesKHR")
                .field("s_type", &self.s_type)
                .field("p_next", &self.p_next)
                .field(
                    "pipeline_fragment_shading_rate",
                    &self.pipeline_fragment_shading_rate,
                )
                .field(
                    "primitive_fragment_shading_rate",
                    &self.primitive_fragment_shading_rate,
                )
                .field(
                    "attachment_fragment_shading_rate",
                    &self.attachment_fragment_shading_rate,
                )
                .finish()
        }
    }

    unsafe impl<'a> TaggedStructure<'a> for PhysicalDeviceFragmentShadingRateFeaturesKHR<'a> {
        const STRUCTURE_TYPE: StructureType =
            StructureType::PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR;
    }

    unsafe impl Extends<PhysicalDeviceFeatures2<'_>>
        for PhysicalDeviceFragmentShadingRateFeaturesKHR<'_>
    {
    }
    unsafe impl Extends<DeviceCreateInfo<'_>> for PhysicalDeviceFragmentShadingRateFeaturesKHR<'_> {}

    impl Default for PhysicalDeviceFragmentShadingRateFeaturesKHR<'_> {
        fn default() -> Self {
            Self {
                s_type: Self::STRUCTURE_TYPE,
                p_next: ptr::null_mut(),
                pipeline_fragment_shading_rate: Default::default(),
                primitive_fragment_shading_rate: Default::default(),
                attachment_fragment_shading_rate: Default::default(),
                _marker: PhantomData,
            }
        }
    }

    impl<'a> PhysicalDeviceFragmentShadingRateFeaturesKHR<'a> {
        #[inline]
        pub fn pipeline_fragment_shading_rate(
            mut self,
            pipeline_fragment_shading_rate: bool,
        ) -> Self {
            self.pipeline_fragment_shading_rate = pipeline_fragment_shading_rate.into();
            self
        }

        #[inline]
        pub fn primitive_fragment_shading_rate(
            mut self,
            primitive_fragment_shading_rate: bool,
        ) -> Self {
            self.primitive_fragment_shading_rate = primitive_fragment_shading_rate.into();
            self
        }

        #[inline]
        pub fn attachment_fragment_shading_rate(
            mut self,
            attachment_fragment_shading_rate: bool,
        ) -> Self {
            self.attachment_fragment_shading_rate = attachment_fragment_shading_rate.into();
            self
        }
    }

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/VkPhysicalDeviceFragmentShadingRatePropertiesKHR.html>
    #[repr(C)]
    #[derive(Copy, Clone)]
    #[must_use]
    pub struct PhysicalDeviceFragmentShadingRatePropertiesKHR<'a> {
        pub s_type: StructureType,
        pub p_next: *mut c_void,
        pub min_fragment_shading_rate_attachment_texel_size: Extent2D,
        pub max_fragment_shading_rate_attachment_texel_size: Extent2D,
        pub max_fragment_shading_rate_attachment_texel_size_aspect_ratio: u32,
        pub primitive_fragment_shading_rate_with_multiple_viewports: Bool32,
        pub layered_shading_rate_attachments: Bool32,
        pub fragment_shading_rate_non_trivial_combiner_ops: Bool32,
        pub max_fragment_size: Extent2D,
        pub max_fragment_size_aspect_ratio: u32,
        pub max_fragment_shading_rate_coverage_samples: u32,
        pub max_fragment_shading_rate_rasterization_samples: SampleCountFlagBits,
        pub fragment_shading_rate_with_shader_depth_stencil_writes: Bool32,
        pub fragment_shading_rate_with_sample_mask: Bool32,
        pub fragment_shading_rate_with_shader_sample_mask: Bool32,
        pub fragment_shading_rate_with_conservative_rasterization: Bool32,
        pub fragment_shading_rate_with_fragment_shader_interlock: Bool32,
        pub fragment_shading_rate_with_custom_sample_locations: Bool32,
        pub fragment_shading_rate_strict_multiply_combiner: Bool32,
        pub _marker: PhantomData<&'a ()>,
    }

    #[cfg(feature = "debug")]
    impl fmt::Debug for PhysicalDeviceFragmentShadingRatePropertiesKHR<'_> {
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            f.debug_struct("PhysicalDeviceFragmentShadingRatePropertiesKHR")
                .field("s_type", &self.s_type)
                .field("p_next", &self.p_next)
                .field(
                    "min_fragment_shading_rate_attachment_texel_size",
                    &self.min_fragment_shading_rate_attachment_texel_size,
                )
                .field(
                    "max_fragment_shading_rate_attachment_texel_size",
                    &self.max_fragment_shading_rate_attachment_texel_size,
                )
                .field(
                    "max_fragment_shading_rate_attachment_texel_size_aspect_ratio",
                    &self.max_fragment_shading_rate_attachment_texel_size_aspect_ratio,
                )
                .field(
                    "primitive_fragment_shading_rate_with_multiple_viewports",
                    &self.primitive_fragment_shading_rate_with_multiple_viewports,
                )
                .field(
                    "layered_shading_rate_attachments",
                    &self.layered_shading_rate_attachments,
                )
                .field(
                    "fragment_shading_rate_non_trivial_combiner_ops",
                    &self.fragment_shading_rate_non_trivial_combiner_ops,
                )
                .field("max_fragment_size", &self.max_fragment_size)
                .field(
                    "max_fragment_size_aspect_ratio",
                    &self.max_fragment_size_aspect_ratio,
                )
                .field(
                    "max_fragment_shading_rate_coverage_samples",
                    &self.max_fragment_shading_rate_coverage_samples,
                )
                .field(
                    "max_fragment_shading_rate_rasterization_samples",
                    &self.max_fragment_shading_rate_rasterization_samples,
                )
                .field(
                    "fragment_shading_rate_with_shader_depth_stencil_writes",
                    &self.fragment_shading_rate_with_shader_depth_stencil_writes,
                )
                .field(
                    "fragment_shading_rate_with_sample_mask",
                    &self.fragment_shading_rate_with_sample_mask,
                )
                .field(
                    "fragment_shading_rate_with_shader_sample_mask",
                    &self.fragment_shading_rate_with_shader_sample_mask,
                )
                .field(
                    "fragment_shading_rate_with_conservative_rasterization",
                    &self.fragment_shading_rate_with_conservative_rasterization,
                )
                .field(
                    "fragment_shading_rate_with_fragment_shader_interlock",
                    &self.fragment_shading_rate_with_fragment_shader_interlock,
                )
                .field(
                    "fragment_shading_rate_with_custom_sample_locations",
                    &self.fragment_shading_rate_with_custom_sample_locations,
                )
                .field(
                    "fragment_shading_rate_strict_multiply_combiner",
                    &self.fragment_shading_rate_strict_multiply_combiner,
                )
                .finish()
        }
    }

    unsafe impl<'a> TaggedStructure<'a> for PhysicalDeviceFragmentShadingRatePropertiesKHR<'a> {
        const STRUCTURE_TYPE: StructureType =
            StructureType::PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR;
    }

    unsafe impl Extends<PhysicalDeviceProperties2<'_>>
        for PhysicalDeviceFragmentShadingRatePropertiesKHR<'_>
    {
    }

    impl Default for PhysicalDeviceFragmentShadingRatePropertiesKHR<'_> {
        fn default() -> Self {
            Self {
                s_type: Self::STRUCTURE_TYPE,
                p_next: ptr::null_mut(),
                min_fragment_shading_rate_attachment_texel_size: Default::default(),
                max_fragment_shading_rate_attachment_texel_size: Default::default(),
                max_fragment_shading_rate_attachment_texel_size_aspect_ratio: Default::default(),
                primitive_fragment_shading_rate_with_multiple_viewports: Default::default(),
                layered_shading_rate_attachments: Default::default(),
                fragment_shading_rate_non_trivial_combiner_ops: Default::default(),
                max_fragment_size: Default::default(),
                max_fragment_size_aspect_ratio: Default::default(),
                max_fragment_shading_rate_coverage_samples: Default::default(),
                max_fragment_shading_rate_rasterization_samples: Default::default(),
                fragment_shading_rate_with_shader_depth_stencil_writes: Default::default(),
                fragment_shading_rate_with_sample_mask: Default::default(),
                fragment_shading_rate_with_shader_sample_mask: Default::default(),
                fragment_shading_rate_with_conservative_rasterization: Default::default(),
                fragment_shading_rate_with_fragment_shader_interlock: Default::default(),
                fragment_shading_rate_with_custom_sample_locations: Default::default(),
                fragment_shading_rate_strict_multiply_combiner: Default::default(),
                _marker: PhantomData,
            }
        }
    }

    impl<'a> PhysicalDeviceFragmentShadingRatePropertiesKHR<'a> {
        #[inline]
        pub fn min_fragment_shading_rate_attachment_texel_size(
            mut self,
            min_fragment_shading_rate_attachment_texel_size: Extent2D,
        ) -> Self {
            self.min_fragment_shading_rate_attachment_texel_size =
                min_fragment_shading_rate_attachment_texel_size;
            self
        }

        #[inline]
        pub fn max_fragment_shading_rate_attachment_texel_size(
            mut self,
            max_fragment_shading_rate_attachment_texel_size: Extent2D,
        ) -> Self {
            self.max_fragment_shading_rate_attachment_texel_size =
                max_fragment_shading_rate_attachment_texel_size;
            self
        }

        #[inline]
        pub fn max_fragment_shading_rate_attachment_texel_size_aspect_ratio(
            mut self,
            max_fragment_shading_rate_attachment_texel_size_aspect_ratio: u32,
        ) -> Self {
            self.max_fragment_shading_rate_attachment_texel_size_aspect_ratio =
                max_fragment_shading_rate_attachment_texel_size_aspect_ratio;
            self
        }

        #[inline]
        pub fn primitive_fragment_shading_rate_with_multiple_viewports(
            mut self,
            primitive_fragment_shading_rate_with_multiple_viewports: bool,
        ) -> Self {
            self.primitive_fragment_shading_rate_with_multiple_viewports =
                primitive_fragment_shading_rate_with_multiple_viewports.into();
            self
        }

        #[inline]
        pub fn layered_shading_rate_attachments(
            mut self,
            layered_shading_rate_attachments: bool,
        ) -> Self {
            self.layered_shading_rate_attachments = layered_shading_rate_attachments.into();
            self
        }

        #[inline]
        pub fn fragment_shading_rate_non_trivial_combiner_ops(
            mut self,
            fragment_shading_rate_non_trivial_combiner_ops: bool,
        ) -> Self {
            self.fragment_shading_rate_non_trivial_combiner_ops =
                fragment_shading_rate_non_trivial_combiner_ops.into();
            self
        }

        #[inline]
        pub fn max_fragment_size(mut self, max_fragment_size: Extent2D) -> Self {
            self.max_fragment_size = max_fragment_size;
            self
        }

        #[inline]
        pub fn max_fragment_size_aspect_ratio(
            mut self,
            max_fragment_size_aspect_ratio: u32,
        ) -> Self {
            self.max_fragment_size_aspect_ratio = max_fragment_size_aspect_ratio;
            self
        }

        #[inline]
        pub fn max_fragment_shading_rate_coverage_samples(
            mut self,
            max_fragment_shading_rate_coverage_samples: u32,
        ) -> Self {
            self.max_fragment_shading_rate_coverage_samples =
                max_fragment_shading_rate_coverage_samples;
            self
        }

        #[inline]
        pub fn max_fragment_shading_rate_rasterization_samples(
            mut self,
            max_fragment_shading_rate_rasterization_samples: SampleCountFlagBits,
        ) -> Self {
            self.max_fragment_shading_rate_rasterization_samples =
                max_fragment_shading_rate_rasterization_samples;
            self
        }

        #[inline]
        pub fn fragment_shading_rate_with_shader_depth_stencil_writes(
            mut self,
            fragment_shading_rate_with_shader_depth_stencil_writes: bool,
        ) -> Self {
            self.fragment_shading_rate_with_shader_depth_stencil_writes =
                fragment_shading_rate_with_shader_depth_stencil_writes.into();
            self
        }

        #[inline]
        pub fn fragment_shading_rate_with_sample_mask(
            mut self,
            fragment_shading_rate_with_sample_mask: bool,
        ) -> Self {
            self.fragment_shading_rate_with_sample_mask =
                fragment_shading_rate_with_sample_mask.into();
            self
        }

        #[inline]
        pub fn fragment_shading_rate_with_shader_sample_mask(
            mut self,
            fragment_shading_rate_with_shader_sample_mask: bool,
        ) -> Self {
            self.fragment_shading_rate_with_shader_sample_mask =
                fragment_shading_rate_with_shader_sample_mask.into();
            self
        }

        #[inline]
        pub fn fragment_shading_rate_with_conservative_rasterization(
            mut self,
            fragment_shading_rate_with_conservative_rasterization: bool,
        ) -> Self {
            self.fragment_shading_rate_with_conservative_rasterization =
                fragment_shading_rate_with_conservative_rasterization.into();
            self
        }

        #[inline]
        pub fn fragment_shading_rate_with_fragment_shader_interlock(
            mut self,
            fragment_shading_rate_with_fragment_shader_interlock: bool,
        ) -> Self {
            self.fragment_shading_rate_with_fragment_shader_interlock =
                fragment_shading_rate_with_fragment_shader_interlock.into();
            self
        }

        #[inline]
        pub fn fragment_shading_rate_with_custom_sample_locations(
            mut self,
            fragment_shading_rate_with_custom_sample_locations: bool,
        ) -> Self {
            self.fragment_shading_rate_with_custom_sample_locations =
                fragment_shading_rate_with_custom_sample_locations.into();
            self
        }

        #[inline]
        pub fn fragment_shading_rate_strict_multiply_combiner(
            mut self,
            fragment_shading_rate_strict_multiply_combiner: bool,
        ) -> Self {
            self.fragment_shading_rate_strict_multiply_combiner =
                fragment_shading_rate_strict_multiply_combiner.into();
            self
        }
    }

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/VkPhysicalDeviceFragmentShadingRateKHR.html>
    #[repr(C)]
    #[derive(Copy, Clone)]
    #[must_use]
    pub struct PhysicalDeviceFragmentShadingRateKHR<'a> {
        pub s_type: StructureType,
        pub p_next: *mut c_void,
        pub sample_counts: SampleCountFlags,
        pub fragment_size: Extent2D,
        pub _marker: PhantomData<&'a ()>,
    }

    #[cfg(feature = "debug")]
    impl fmt::Debug for PhysicalDeviceFragmentShadingRateKHR<'_> {
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            f.debug_struct("PhysicalDeviceFragmentShadingRateKHR")
                .field("s_type", &self.s_type)
                .field("p_next", &self.p_next)
                .field("sample_counts", &self.sample_counts)
                .field("fragment_size", &self.fragment_size)
                .finish()
        }
    }

    unsafe impl<'a> TaggedStructure<'a> for PhysicalDeviceFragmentShadingRateKHR<'a> {
        const STRUCTURE_TYPE: StructureType =
            StructureType::PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_KHR;
    }

    impl Default for PhysicalDeviceFragmentShadingRateKHR<'_> {
        fn default() -> Self {
            Self {
                s_type: Self::STRUCTURE_TYPE,
                p_next: ptr::null_mut(),
                sample_counts: Default::default(),
                fragment_size: Default::default(),
                _marker: PhantomData,
            }
        }
    }

    impl<'a> PhysicalDeviceFragmentShadingRateKHR<'a> {
        #[inline]
        pub fn sample_counts(mut self, sample_counts: SampleCountFlags) -> Self {
            self.sample_counts = sample_counts;
            self
        }

        #[inline]
        pub fn fragment_size(mut self, fragment_size: Extent2D) -> Self {
            self.fragment_size = fragment_size;
            self
        }
    }

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/VkRenderingFragmentShadingRateAttachmentInfoKHR.html>
    #[repr(C)]
    #[derive(Copy, Clone)]
    #[must_use]
    pub struct RenderingFragmentShadingRateAttachmentInfoKHR<'a> {
        pub s_type: StructureType,
        pub p_next: *const c_void,
        pub image_view: ImageView,
        pub image_layout: ImageLayout,
        pub shading_rate_attachment_texel_size: Extent2D,
        pub _marker: PhantomData<&'a ()>,
    }

    #[cfg(feature = "debug")]
    impl fmt::Debug for RenderingFragmentShadingRateAttachmentInfoKHR<'_> {
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            f.debug_struct("RenderingFragmentShadingRateAttachmentInfoKHR")
                .field("s_type", &self.s_type)
                .field("p_next", &self.p_next)
                .field("image_view", &self.image_view)
                .field("image_layout", &self.image_layout)
                .field(
                    "shading_rate_attachment_texel_size",
                    &self.shading_rate_attachment_texel_size,
                )
                .finish()
        }
    }

    unsafe impl<'a> TaggedStructure<'a> for RenderingFragmentShadingRateAttachmentInfoKHR<'a> {
        const STRUCTURE_TYPE: StructureType =
            StructureType::RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR;
    }

    unsafe impl Extends<RenderingInfo<'_>> for RenderingFragmentShadingRateAttachmentInfoKHR<'_> {}

    impl Default for RenderingFragmentShadingRateAttachmentInfoKHR<'_> {
        fn default() -> Self {
            Self {
                s_type: Self::STRUCTURE_TYPE,
                p_next: ptr::null(),
                image_view: Default::default(),
                image_layout: Default::default(),
                shading_rate_attachment_texel_size: Default::default(),
                _marker: PhantomData,
            }
        }
    }

    impl<'a> RenderingFragmentShadingRateAttachmentInfoKHR<'a> {
        #[inline]
        pub fn image_view(mut self, image_view: ImageView) -> Self {
            self.image_view = image_view;
            self
        }

        #[inline]
        pub fn image_layout(mut self, image_layout: ImageLayout) -> Self {
            self.image_layout = image_layout;
            self
        }

        #[inline]
        pub fn shading_rate_attachment_texel_size(
            mut self,
            shading_rate_attachment_texel_size: Extent2D,
        ) -> Self {
            self.shading_rate_attachment_texel_size = shading_rate_attachment_texel_size;
            self
        }
    }

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/VkFragmentShadingRateCombinerOpKHR.html>
    #[repr(transparent)]
    #[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct FragmentShadingRateCombinerOpKHR(i32);

    impl FragmentShadingRateCombinerOpKHR {
        #[inline]
        pub const fn from_raw(x: i32) -> Self {
            Self(x)
        }
        #[inline]
        pub const fn as_raw(self) -> i32 {
            self.0
        }

        pub const KEEP_KHR: Self = Self(0);
        pub const REPLACE_KHR: Self = Self(1);
        pub const MIN_KHR: Self = Self(2);
        pub const MAX_KHR: Self = Self(3);
        pub const MUL_KHR: Self = Self(4);
    }

    impl fmt::Debug for FragmentShadingRateCombinerOpKHR {
        fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
            let name = match *self {
                Self::KEEP_KHR => Some("KEEP_KHR"),
                Self::REPLACE_KHR => Some("REPLACE_KHR"),
                Self::MIN_KHR => Some("MIN_KHR"),
                Self::MAX_KHR => Some("MAX_KHR"),
                Self::MUL_KHR => Some("MUL_KHR"),
                _ => None,
            };
            if let Some(name) = name {
                f.write_str(name)
            } else {
                self.0.fmt(f)
            }
        }
    }

    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/vkCmdSetFragmentShadingRateKHR.html>
    pub type PFN_vkCmdSetFragmentShadingRateKHR = unsafe extern "system" fn(
        command_buffer: CommandBuffer,
        p_fragment_size: *const Extent2D,
        combiner_ops: *const [FragmentShadingRateCombinerOpKHR; 2],
    );
    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/vkGetPhysicalDeviceFragmentShadingRatesKHR.html>
    pub type PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR =
        unsafe extern "system" fn(
            physical_device: PhysicalDevice,
            p_fragment_shading_rate_count: *mut u32,
            p_fragment_shading_rates: *mut PhysicalDeviceFragmentShadingRateKHR<'_>,
        ) -> vk::Result;
}

#[cfg(feature = "ffi")]
pub(super) mod ffi {
    #![allow(non_camel_case_types)]
    use super::defs::*;

    pub type VkFragmentShadingRateAttachmentInfoKHR = FragmentShadingRateAttachmentInfoKHR<'static>;
    pub type VkPipelineFragmentShadingRateStateCreateInfoKHR =
        PipelineFragmentShadingRateStateCreateInfoKHR<'static>;
    pub type VkPhysicalDeviceFragmentShadingRateFeaturesKHR =
        PhysicalDeviceFragmentShadingRateFeaturesKHR<'static>;
    pub type VkPhysicalDeviceFragmentShadingRatePropertiesKHR =
        PhysicalDeviceFragmentShadingRatePropertiesKHR<'static>;
    pub type VkPhysicalDeviceFragmentShadingRateKHR = PhysicalDeviceFragmentShadingRateKHR<'static>;
    pub type VkRenderingFragmentShadingRateAttachmentInfoKHR =
        RenderingFragmentShadingRateAttachmentInfoKHR<'static>;
    pub type VkFragmentShadingRateCombinerOpKHR = FragmentShadingRateCombinerOpKHR;
    impl FragmentShadingRateAttachmentInfoKHR<'_> {
        #[inline]
        pub unsafe fn drop_lifetime_for_ffi(&self) -> &VkFragmentShadingRateAttachmentInfoKHR {
            unsafe { core::mem::transmute(self) }
        }
    }
    impl PipelineFragmentShadingRateStateCreateInfoKHR<'_> {
        #[inline]
        pub unsafe fn drop_lifetime_for_ffi(
            &self,
        ) -> &VkPipelineFragmentShadingRateStateCreateInfoKHR {
            unsafe { core::mem::transmute(self) }
        }
    }
    impl PhysicalDeviceFragmentShadingRateFeaturesKHR<'_> {
        #[inline]
        pub unsafe fn drop_lifetime_for_ffi(
            &self,
        ) -> &VkPhysicalDeviceFragmentShadingRateFeaturesKHR {
            unsafe { core::mem::transmute(self) }
        }
    }
    impl PhysicalDeviceFragmentShadingRatePropertiesKHR<'_> {
        #[inline]
        pub unsafe fn drop_lifetime_for_ffi(
            &self,
        ) -> &VkPhysicalDeviceFragmentShadingRatePropertiesKHR {
            unsafe { core::mem::transmute(self) }
        }
    }
    impl PhysicalDeviceFragmentShadingRateKHR<'_> {
        #[inline]
        pub unsafe fn drop_lifetime_for_ffi(&self) -> &VkPhysicalDeviceFragmentShadingRateKHR {
            unsafe { core::mem::transmute(self) }
        }
    }
    impl RenderingFragmentShadingRateAttachmentInfoKHR<'_> {
        #[inline]
        pub unsafe fn drop_lifetime_for_ffi(
            &self,
        ) -> &VkRenderingFragmentShadingRateAttachmentInfoKHR {
            unsafe { core::mem::transmute(self) }
        }
    }
}

pub struct InstanceFn {
    get_physical_device_fragment_shading_rates: PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR,
}

impl LoadInstanceFn for InstanceFn {
    unsafe fn load_with(
        load: impl Fn(&CStr) -> Option<PFN_vkVoidFunction>,
    ) -> core::result::Result<Self, MissingEntryPointError> {
        unsafe {
            Ok(Self {
                get_physical_device_fragment_shading_rates: transmute(
                    load(c"vkGetPhysicalDeviceFragmentShadingRatesKHR")
                        .ok_or(MissingEntryPointError)?,
                ),
            })
        }
    }
}

impl InstanceFn {
    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/vkGetPhysicalDeviceFragmentShadingRatesKHR.html>
    #[inline]
    pub unsafe fn get_physical_device_fragment_shading_rates<'a>(
        &self,
        physical_device: PhysicalDevice,
        mut fragment_shading_rates: impl EnumerateInto<PhysicalDeviceFragmentShadingRateKHR<'a>>,
    ) -> crate::Result<()> {
        unsafe {
            let call = |fragment_shading_rate_count, fragment_shading_rates| {
                let result = (self.get_physical_device_fragment_shading_rates)(
                    physical_device,
                    fragment_shading_rate_count,
                    fragment_shading_rates as _,
                );

                match result {
                    VkResult::SUCCESS => Ok(()),
                    VkResult::INCOMPLETE => Ok(()),
                    err => Err(err),
                }
            };
            let mut len = 0;
            call(&mut len, std::ptr::null_mut())?;
            let capacity = len.try_into().expect("failed to convert `N` to usize");
            let fragment_shading_rates_buf = fragment_shading_rates.reserve(capacity);
            len = fragment_shading_rates_buf.len().try_into().unwrap();
            let result = call(&mut len, fragment_shading_rates_buf.as_mut_ptr() as *mut _)?;
            fragment_shading_rates.set_len(len.try_into().unwrap());
            Ok(result)
        }
    }
}

pub struct DeviceFn {
    cmd_set_fragment_shading_rate: PFN_vkCmdSetFragmentShadingRateKHR,
}

impl LoadDeviceFn for DeviceFn {
    unsafe fn load_with(
        load: impl Fn(&CStr) -> Option<PFN_vkVoidFunction>,
    ) -> core::result::Result<Self, MissingEntryPointError> {
        unsafe {
            Ok(Self {
                cmd_set_fragment_shading_rate: transmute(
                    load(c"vkCmdSetFragmentShadingRateKHR").ok_or(MissingEntryPointError)?,
                ),
            })
        }
    }
}

impl DeviceFn {
    /// <https://registry.khronos.org/vulkan/specs/latest/man/html/vkCmdSetFragmentShadingRateKHR.html>
    #[inline]
    pub unsafe fn cmd_set_fragment_shading_rate(
        &self,
        command_buffer: CommandBuffer,
        fragment_size: &Extent2D,
        combiner_ops: &[FragmentShadingRateCombinerOpKHR; 2],
    ) {
        unsafe { (self.cmd_set_fragment_shading_rate)(command_buffer, fragment_size, combiner_ops) }
    }
}