1use std::ffi::c_void;
6use std::ptr::NonNull;
7
8use mtl_foundation::{Referencing, UInteger};
9use mtl_sys::{msg_send_0, msg_send_1, msg_send_2, sel};
10
11use super::enums::{
12 AlphaToCoverageState, AlphaToOneState, BlendState, IndirectCommandBufferSupportState,
13 LogicalToPhysicalColorAttachmentMappingState,
14};
15use super::{FunctionDescriptor, PipelineOptions, StaticLinkingDescriptor};
16use crate::{BlendFactor, BlendOperation, ColorWriteMask, PixelFormat, PrimitiveTopologyClass};
17
18#[repr(transparent)]
26pub struct RenderPipelineColorAttachmentDescriptor(NonNull<c_void>);
27
28impl RenderPipelineColorAttachmentDescriptor {
29 #[inline]
31 pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self> {
32 NonNull::new(ptr).map(Self)
33 }
34
35 #[inline]
37 pub fn as_raw(&self) -> *mut c_void {
38 self.0.as_ptr()
39 }
40
41 pub fn new() -> Option<Self> {
43 unsafe {
44 let class = mtl_sys::Class::get("MTL4RenderPipelineColorAttachmentDescriptor")?;
45 let ptr: *mut c_void = msg_send_0(class.as_ptr(), sel!(alloc));
46 if ptr.is_null() {
47 return None;
48 }
49 let ptr: *mut c_void = msg_send_0(ptr, sel!(init));
50 Self::from_raw(ptr)
51 }
52 }
53
54 pub fn pixel_format(&self) -> PixelFormat {
58 unsafe { msg_send_0(self.as_ptr(), sel!(pixelFormat)) }
59 }
60
61 pub fn set_pixel_format(&self, format: PixelFormat) {
65 unsafe {
66 let _: () = msg_send_1(self.as_ptr(), sel!(setPixelFormat:), format);
67 }
68 }
69
70 pub fn blending_state(&self) -> BlendState {
74 unsafe { msg_send_0(self.as_ptr(), sel!(blendingState)) }
75 }
76
77 pub fn set_blending_state(&self, state: BlendState) {
81 unsafe {
82 let _: () = msg_send_1(self.as_ptr(), sel!(setBlendingState:), state);
83 }
84 }
85
86 pub fn source_rgb_blend_factor(&self) -> BlendFactor {
90 unsafe { msg_send_0(self.as_ptr(), sel!(sourceRGBBlendFactor)) }
91 }
92
93 pub fn set_source_rgb_blend_factor(&self, factor: BlendFactor) {
97 unsafe {
98 let _: () = msg_send_1(self.as_ptr(), sel!(setSourceRGBBlendFactor:), factor);
99 }
100 }
101
102 pub fn destination_rgb_blend_factor(&self) -> BlendFactor {
106 unsafe { msg_send_0(self.as_ptr(), sel!(destinationRGBBlendFactor)) }
107 }
108
109 pub fn set_destination_rgb_blend_factor(&self, factor: BlendFactor) {
113 unsafe {
114 let _: () = msg_send_1(self.as_ptr(), sel!(setDestinationRGBBlendFactor:), factor);
115 }
116 }
117
118 pub fn rgb_blend_operation(&self) -> BlendOperation {
122 unsafe { msg_send_0(self.as_ptr(), sel!(rgbBlendOperation)) }
123 }
124
125 pub fn set_rgb_blend_operation(&self, operation: BlendOperation) {
129 unsafe {
130 let _: () = msg_send_1(self.as_ptr(), sel!(setRgbBlendOperation:), operation);
131 }
132 }
133
134 pub fn source_alpha_blend_factor(&self) -> BlendFactor {
138 unsafe { msg_send_0(self.as_ptr(), sel!(sourceAlphaBlendFactor)) }
139 }
140
141 pub fn set_source_alpha_blend_factor(&self, factor: BlendFactor) {
145 unsafe {
146 let _: () = msg_send_1(self.as_ptr(), sel!(setSourceAlphaBlendFactor:), factor);
147 }
148 }
149
150 pub fn destination_alpha_blend_factor(&self) -> BlendFactor {
154 unsafe { msg_send_0(self.as_ptr(), sel!(destinationAlphaBlendFactor)) }
155 }
156
157 pub fn set_destination_alpha_blend_factor(&self, factor: BlendFactor) {
161 unsafe {
162 let _: () = msg_send_1(self.as_ptr(), sel!(setDestinationAlphaBlendFactor:), factor);
163 }
164 }
165
166 pub fn alpha_blend_operation(&self) -> BlendOperation {
170 unsafe { msg_send_0(self.as_ptr(), sel!(alphaBlendOperation)) }
171 }
172
173 pub fn set_alpha_blend_operation(&self, operation: BlendOperation) {
177 unsafe {
178 let _: () = msg_send_1(self.as_ptr(), sel!(setAlphaBlendOperation:), operation);
179 }
180 }
181
182 pub fn write_mask(&self) -> ColorWriteMask {
186 unsafe { msg_send_0(self.as_ptr(), sel!(writeMask)) }
187 }
188
189 pub fn set_write_mask(&self, mask: ColorWriteMask) {
193 unsafe {
194 let _: () = msg_send_1(self.as_ptr(), sel!(setWriteMask:), mask);
195 }
196 }
197
198 pub fn reset(&self) {
202 unsafe {
203 let _: () = msg_send_0(self.as_ptr(), sel!(reset));
204 }
205 }
206}
207
208impl Clone for RenderPipelineColorAttachmentDescriptor {
209 fn clone(&self) -> Self {
210 unsafe {
211 mtl_sys::msg_send_0::<*mut c_void>(self.as_ptr(), mtl_sys::sel!(retain));
212 }
213 Self(self.0)
214 }
215}
216
217impl Drop for RenderPipelineColorAttachmentDescriptor {
218 fn drop(&mut self) {
219 unsafe {
220 mtl_sys::msg_send_0::<()>(self.as_ptr(), mtl_sys::sel!(release));
221 }
222 }
223}
224
225impl Referencing for RenderPipelineColorAttachmentDescriptor {
226 #[inline]
227 fn as_ptr(&self) -> *const c_void {
228 self.0.as_ptr()
229 }
230}
231
232unsafe impl Send for RenderPipelineColorAttachmentDescriptor {}
233unsafe impl Sync for RenderPipelineColorAttachmentDescriptor {}
234
235#[repr(transparent)]
243pub struct RenderPipelineColorAttachmentDescriptorArray(NonNull<c_void>);
244
245impl RenderPipelineColorAttachmentDescriptorArray {
246 #[inline]
248 pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self> {
249 NonNull::new(ptr).map(Self)
250 }
251
252 #[inline]
254 pub fn as_raw(&self) -> *mut c_void {
255 self.0.as_ptr()
256 }
257
258 pub fn new() -> Option<Self> {
260 unsafe {
261 let class = mtl_sys::Class::get("MTL4RenderPipelineColorAttachmentDescriptorArray")?;
262 let ptr: *mut c_void = msg_send_0(class.as_ptr(), sel!(alloc));
263 if ptr.is_null() {
264 return None;
265 }
266 let ptr: *mut c_void = msg_send_0(ptr, sel!(init));
267 Self::from_raw(ptr)
268 }
269 }
270
271 pub fn object(&self, index: UInteger) -> Option<RenderPipelineColorAttachmentDescriptor> {
275 unsafe {
276 let ptr: *mut c_void =
277 msg_send_1(self.as_ptr(), sel!(objectAtIndexedSubscript:), index);
278 RenderPipelineColorAttachmentDescriptor::from_raw(ptr)
279 }
280 }
281
282 pub fn set_object(
286 &self,
287 attachment: &RenderPipelineColorAttachmentDescriptor,
288 index: UInteger,
289 ) {
290 unsafe {
291 let _: () = msg_send_2(
292 self.as_ptr(),
293 sel!(setObject:atIndexedSubscript:),
294 attachment.as_ptr(),
295 index,
296 );
297 }
298 }
299
300 pub fn reset(&self) {
304 unsafe {
305 let _: () = msg_send_0(self.as_ptr(), sel!(reset));
306 }
307 }
308}
309
310impl Clone for RenderPipelineColorAttachmentDescriptorArray {
311 fn clone(&self) -> Self {
312 unsafe {
313 mtl_sys::msg_send_0::<*mut c_void>(self.as_ptr(), mtl_sys::sel!(retain));
314 }
315 Self(self.0)
316 }
317}
318
319impl Drop for RenderPipelineColorAttachmentDescriptorArray {
320 fn drop(&mut self) {
321 unsafe {
322 mtl_sys::msg_send_0::<()>(self.as_ptr(), mtl_sys::sel!(release));
323 }
324 }
325}
326
327impl Referencing for RenderPipelineColorAttachmentDescriptorArray {
328 #[inline]
329 fn as_ptr(&self) -> *const c_void {
330 self.0.as_ptr()
331 }
332}
333
334unsafe impl Send for RenderPipelineColorAttachmentDescriptorArray {}
335unsafe impl Sync for RenderPipelineColorAttachmentDescriptorArray {}
336
337#[repr(transparent)]
345pub struct RenderPipelineBinaryFunctionsDescriptor(NonNull<c_void>);
346
347impl RenderPipelineBinaryFunctionsDescriptor {
348 #[inline]
350 pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self> {
351 NonNull::new(ptr).map(Self)
352 }
353
354 #[inline]
356 pub fn as_raw(&self) -> *mut c_void {
357 self.0.as_ptr()
358 }
359
360 pub fn new() -> Option<Self> {
362 unsafe {
363 let class = mtl_sys::Class::get("MTL4RenderPipelineBinaryFunctionsDescriptor")?;
364 let ptr: *mut c_void = msg_send_0(class.as_ptr(), sel!(alloc));
365 if ptr.is_null() {
366 return None;
367 }
368 let ptr: *mut c_void = msg_send_0(ptr, sel!(init));
369 Self::from_raw(ptr)
370 }
371 }
372
373 pub fn vertex_additional_binary_functions_raw(&self) -> *mut c_void {
375 unsafe { msg_send_0(self.as_ptr(), sel!(vertexAdditionalBinaryFunctions)) }
376 }
377
378 pub fn set_vertex_additional_binary_functions_raw(&self, functions: *const c_void) {
380 unsafe {
381 let _: () = msg_send_1(
382 self.as_ptr(),
383 sel!(setVertexAdditionalBinaryFunctions:),
384 functions,
385 );
386 }
387 }
388
389 pub fn fragment_additional_binary_functions_raw(&self) -> *mut c_void {
391 unsafe { msg_send_0(self.as_ptr(), sel!(fragmentAdditionalBinaryFunctions)) }
392 }
393
394 pub fn set_fragment_additional_binary_functions_raw(&self, functions: *const c_void) {
396 unsafe {
397 let _: () = msg_send_1(
398 self.as_ptr(),
399 sel!(setFragmentAdditionalBinaryFunctions:),
400 functions,
401 );
402 }
403 }
404
405 pub fn tile_additional_binary_functions_raw(&self) -> *mut c_void {
407 unsafe { msg_send_0(self.as_ptr(), sel!(tileAdditionalBinaryFunctions)) }
408 }
409
410 pub fn set_tile_additional_binary_functions_raw(&self, functions: *const c_void) {
412 unsafe {
413 let _: () = msg_send_1(
414 self.as_ptr(),
415 sel!(setTileAdditionalBinaryFunctions:),
416 functions,
417 );
418 }
419 }
420
421 pub fn object_additional_binary_functions_raw(&self) -> *mut c_void {
423 unsafe { msg_send_0(self.as_ptr(), sel!(objectAdditionalBinaryFunctions)) }
424 }
425
426 pub fn set_object_additional_binary_functions_raw(&self, functions: *const c_void) {
428 unsafe {
429 let _: () = msg_send_1(
430 self.as_ptr(),
431 sel!(setObjectAdditionalBinaryFunctions:),
432 functions,
433 );
434 }
435 }
436
437 pub fn mesh_additional_binary_functions_raw(&self) -> *mut c_void {
439 unsafe { msg_send_0(self.as_ptr(), sel!(meshAdditionalBinaryFunctions)) }
440 }
441
442 pub fn set_mesh_additional_binary_functions_raw(&self, functions: *const c_void) {
444 unsafe {
445 let _: () = msg_send_1(
446 self.as_ptr(),
447 sel!(setMeshAdditionalBinaryFunctions:),
448 functions,
449 );
450 }
451 }
452
453 pub fn reset(&self) {
455 unsafe {
456 let _: () = msg_send_0(self.as_ptr(), sel!(reset));
457 }
458 }
459}
460
461impl Clone for RenderPipelineBinaryFunctionsDescriptor {
462 fn clone(&self) -> Self {
463 unsafe {
464 mtl_sys::msg_send_0::<*mut c_void>(self.as_ptr(), mtl_sys::sel!(retain));
465 }
466 Self(self.0)
467 }
468}
469
470impl Drop for RenderPipelineBinaryFunctionsDescriptor {
471 fn drop(&mut self) {
472 unsafe {
473 mtl_sys::msg_send_0::<()>(self.as_ptr(), mtl_sys::sel!(release));
474 }
475 }
476}
477
478impl Referencing for RenderPipelineBinaryFunctionsDescriptor {
479 #[inline]
480 fn as_ptr(&self) -> *const c_void {
481 self.0.as_ptr()
482 }
483}
484
485unsafe impl Send for RenderPipelineBinaryFunctionsDescriptor {}
486unsafe impl Sync for RenderPipelineBinaryFunctionsDescriptor {}
487
488#[repr(transparent)]
496pub struct RenderPipelineDescriptor(NonNull<c_void>);
497
498impl RenderPipelineDescriptor {
499 #[inline]
501 pub unsafe fn from_raw(ptr: *mut c_void) -> Option<Self> {
502 NonNull::new(ptr).map(Self)
503 }
504
505 #[inline]
507 pub fn as_raw(&self) -> *mut c_void {
508 self.0.as_ptr()
509 }
510
511 pub fn new() -> Option<Self> {
513 unsafe {
514 let class = mtl_sys::Class::get("MTL4RenderPipelineDescriptor")?;
515 let ptr: *mut c_void = msg_send_0(class.as_ptr(), sel!(alloc));
516 if ptr.is_null() {
517 return None;
518 }
519 let ptr: *mut c_void = msg_send_0(ptr, sel!(init));
520 Self::from_raw(ptr)
521 }
522 }
523
524 pub fn label(&self) -> Option<String> {
528 unsafe {
529 let ns_string: *mut c_void = msg_send_0(self.as_ptr(), sel!(label));
530 if ns_string.is_null() {
531 return None;
532 }
533 let c_str: *const i8 = msg_send_0(ns_string, sel!(UTF8String));
534 if c_str.is_null() {
535 return None;
536 }
537 Some(
538 std::ffi::CStr::from_ptr(c_str)
539 .to_string_lossy()
540 .into_owned(),
541 )
542 }
543 }
544
545 pub fn set_label(&self, label: &str) {
547 if let Some(ns_label) = mtl_foundation::String::from_str(label) {
548 unsafe {
549 let _: () = msg_send_1(self.as_ptr(), sel!(setLabel:), ns_label.as_ptr());
550 }
551 }
552 }
553
554 pub fn options(&self) -> Option<PipelineOptions> {
556 unsafe {
557 let ptr: *mut c_void = msg_send_0(self.as_ptr(), sel!(options));
558 PipelineOptions::from_raw(ptr)
559 }
560 }
561
562 pub fn set_options(&self, options: &PipelineOptions) {
564 unsafe {
565 let _: () = msg_send_1(self.as_ptr(), sel!(setOptions:), options.as_ptr());
566 }
567 }
568
569 pub fn vertex_function_descriptor(&self) -> Option<FunctionDescriptor> {
573 unsafe {
574 let ptr: *mut c_void = msg_send_0(self.as_ptr(), sel!(vertexFunctionDescriptor));
575 FunctionDescriptor::from_raw(ptr)
576 }
577 }
578
579 pub fn set_vertex_function_descriptor(&self, descriptor: &FunctionDescriptor) {
581 unsafe {
582 let _: () = msg_send_1(
583 self.as_ptr(),
584 sel!(setVertexFunctionDescriptor:),
585 descriptor.as_ptr(),
586 );
587 }
588 }
589
590 pub fn vertex_static_linking_descriptor(&self) -> Option<StaticLinkingDescriptor> {
592 unsafe {
593 let ptr: *mut c_void = msg_send_0(self.as_ptr(), sel!(vertexStaticLinkingDescriptor));
594 StaticLinkingDescriptor::from_raw(ptr)
595 }
596 }
597
598 pub fn set_vertex_static_linking_descriptor(&self, descriptor: &StaticLinkingDescriptor) {
600 unsafe {
601 let _: () = msg_send_1(
602 self.as_ptr(),
603 sel!(setVertexStaticLinkingDescriptor:),
604 descriptor.as_ptr(),
605 );
606 }
607 }
608
609 pub fn fragment_function_descriptor(&self) -> Option<FunctionDescriptor> {
613 unsafe {
614 let ptr: *mut c_void = msg_send_0(self.as_ptr(), sel!(fragmentFunctionDescriptor));
615 FunctionDescriptor::from_raw(ptr)
616 }
617 }
618
619 pub fn set_fragment_function_descriptor(&self, descriptor: &FunctionDescriptor) {
621 unsafe {
622 let _: () = msg_send_1(
623 self.as_ptr(),
624 sel!(setFragmentFunctionDescriptor:),
625 descriptor.as_ptr(),
626 );
627 }
628 }
629
630 pub fn fragment_static_linking_descriptor(&self) -> Option<StaticLinkingDescriptor> {
632 unsafe {
633 let ptr: *mut c_void = msg_send_0(self.as_ptr(), sel!(fragmentStaticLinkingDescriptor));
634 StaticLinkingDescriptor::from_raw(ptr)
635 }
636 }
637
638 pub fn set_fragment_static_linking_descriptor(&self, descriptor: &StaticLinkingDescriptor) {
640 unsafe {
641 let _: () = msg_send_1(
642 self.as_ptr(),
643 sel!(setFragmentStaticLinkingDescriptor:),
644 descriptor.as_ptr(),
645 );
646 }
647 }
648
649 pub fn color_attachments(&self) -> Option<RenderPipelineColorAttachmentDescriptorArray> {
653 unsafe {
654 let ptr: *mut c_void = msg_send_0(self.as_ptr(), sel!(colorAttachments));
655 RenderPipelineColorAttachmentDescriptorArray::from_raw(ptr)
656 }
657 }
658
659 pub fn color_attachment_mapping_state(&self) -> LogicalToPhysicalColorAttachmentMappingState {
661 unsafe { msg_send_0(self.as_ptr(), sel!(colorAttachmentMappingState)) }
662 }
663
664 pub fn set_color_attachment_mapping_state(
666 &self,
667 state: LogicalToPhysicalColorAttachmentMappingState,
668 ) {
669 unsafe {
670 let _: () = msg_send_1(self.as_ptr(), sel!(setColorAttachmentMappingState:), state);
671 }
672 }
673
674 pub fn is_rasterization_enabled(&self) -> bool {
678 unsafe { msg_send_0(self.as_ptr(), sel!(isRasterizationEnabled)) }
679 }
680
681 pub fn set_rasterization_enabled(&self, enabled: bool) {
683 unsafe {
684 let _: () = msg_send_1(self.as_ptr(), sel!(setRasterizationEnabled:), enabled);
685 }
686 }
687
688 pub fn raster_sample_count(&self) -> UInteger {
690 unsafe { msg_send_0(self.as_ptr(), sel!(rasterSampleCount)) }
691 }
692
693 pub fn set_raster_sample_count(&self, count: UInteger) {
695 unsafe {
696 let _: () = msg_send_1(self.as_ptr(), sel!(setRasterSampleCount:), count);
697 }
698 }
699
700 pub fn alpha_to_coverage_state(&self) -> AlphaToCoverageState {
704 unsafe { msg_send_0(self.as_ptr(), sel!(alphaToCoverageState)) }
705 }
706
707 pub fn set_alpha_to_coverage_state(&self, state: AlphaToCoverageState) {
709 unsafe {
710 let _: () = msg_send_1(self.as_ptr(), sel!(setAlphaToCoverageState:), state);
711 }
712 }
713
714 pub fn alpha_to_one_state(&self) -> AlphaToOneState {
716 unsafe { msg_send_0(self.as_ptr(), sel!(alphaToOneState)) }
717 }
718
719 pub fn set_alpha_to_one_state(&self, state: AlphaToOneState) {
721 unsafe {
722 let _: () = msg_send_1(self.as_ptr(), sel!(setAlphaToOneState:), state);
723 }
724 }
725
726 pub fn vertex_descriptor_raw(&self) -> *mut c_void {
730 unsafe { msg_send_0(self.as_ptr(), sel!(vertexDescriptor)) }
731 }
732
733 pub fn set_vertex_descriptor_raw(&self, descriptor: *const c_void) {
735 unsafe {
736 let _: () = msg_send_1(self.as_ptr(), sel!(setVertexDescriptor:), descriptor);
737 }
738 }
739
740 pub fn input_primitive_topology(&self) -> PrimitiveTopologyClass {
744 unsafe { msg_send_0(self.as_ptr(), sel!(inputPrimitiveTopology)) }
745 }
746
747 pub fn set_input_primitive_topology(&self, topology: PrimitiveTopologyClass) {
749 unsafe {
750 let _: () = msg_send_1(self.as_ptr(), sel!(setInputPrimitiveTopology:), topology);
751 }
752 }
753
754 pub fn max_vertex_amplification_count(&self) -> UInteger {
758 unsafe { msg_send_0(self.as_ptr(), sel!(maxVertexAmplificationCount)) }
759 }
760
761 pub fn set_max_vertex_amplification_count(&self, count: UInteger) {
763 unsafe {
764 let _: () = msg_send_1(self.as_ptr(), sel!(setMaxVertexAmplificationCount:), count);
765 }
766 }
767
768 pub fn support_vertex_binary_linking(&self) -> bool {
772 unsafe { msg_send_0(self.as_ptr(), sel!(supportVertexBinaryLinking)) }
773 }
774
775 pub fn set_support_vertex_binary_linking(&self, support: bool) {
777 unsafe {
778 let _: () = msg_send_1(self.as_ptr(), sel!(setSupportVertexBinaryLinking:), support);
779 }
780 }
781
782 pub fn support_fragment_binary_linking(&self) -> bool {
784 unsafe { msg_send_0(self.as_ptr(), sel!(supportFragmentBinaryLinking)) }
785 }
786
787 pub fn set_support_fragment_binary_linking(&self, support: bool) {
789 unsafe {
790 let _: () = msg_send_1(
791 self.as_ptr(),
792 sel!(setSupportFragmentBinaryLinking:),
793 support,
794 );
795 }
796 }
797
798 pub fn support_indirect_command_buffers(&self) -> IndirectCommandBufferSupportState {
802 unsafe { msg_send_0(self.as_ptr(), sel!(supportIndirectCommandBuffers)) }
803 }
804
805 pub fn set_support_indirect_command_buffers(&self, state: IndirectCommandBufferSupportState) {
807 unsafe {
808 let _: () = msg_send_1(
809 self.as_ptr(),
810 sel!(setSupportIndirectCommandBuffers:),
811 state,
812 );
813 }
814 }
815
816 pub fn reset(&self) {
818 unsafe {
819 let _: () = msg_send_0(self.as_ptr(), sel!(reset));
820 }
821 }
822}
823
824impl Clone for RenderPipelineDescriptor {
825 fn clone(&self) -> Self {
826 unsafe {
827 mtl_sys::msg_send_0::<*mut c_void>(self.as_ptr(), mtl_sys::sel!(retain));
828 }
829 Self(self.0)
830 }
831}
832
833impl Drop for RenderPipelineDescriptor {
834 fn drop(&mut self) {
835 unsafe {
836 mtl_sys::msg_send_0::<()>(self.as_ptr(), mtl_sys::sel!(release));
837 }
838 }
839}
840
841impl Referencing for RenderPipelineDescriptor {
842 #[inline]
843 fn as_ptr(&self) -> *const c_void {
844 self.0.as_ptr()
845 }
846}
847
848unsafe impl Send for RenderPipelineDescriptor {}
849unsafe impl Sync for RenderPipelineDescriptor {}
850
851impl std::fmt::Debug for RenderPipelineDescriptor {
852 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
853 f.debug_struct("RenderPipelineDescriptor")
854 .field("label", &self.label())
855 .field("raster_sample_count", &self.raster_sample_count())
856 .field("is_rasterization_enabled", &self.is_rasterization_enabled())
857 .finish()
858 }
859}
860
861#[cfg(test)]
862mod tests {
863 use super::*;
864
865 #[test]
866 fn test_render_pipeline_color_attachment_descriptor_size() {
867 assert_eq!(
868 std::mem::size_of::<RenderPipelineColorAttachmentDescriptor>(),
869 std::mem::size_of::<*mut c_void>()
870 );
871 }
872
873 #[test]
874 fn test_render_pipeline_color_attachment_descriptor_array_size() {
875 assert_eq!(
876 std::mem::size_of::<RenderPipelineColorAttachmentDescriptorArray>(),
877 std::mem::size_of::<*mut c_void>()
878 );
879 }
880
881 #[test]
882 fn test_render_pipeline_binary_functions_descriptor_size() {
883 assert_eq!(
884 std::mem::size_of::<RenderPipelineBinaryFunctionsDescriptor>(),
885 std::mem::size_of::<*mut c_void>()
886 );
887 }
888
889 #[test]
890 fn test_render_pipeline_descriptor_size() {
891 assert_eq!(
892 std::mem::size_of::<RenderPipelineDescriptor>(),
893 std::mem::size_of::<*mut c_void>()
894 );
895 }
896}