@@ -452,12 +452,16 @@ impl super::PrivateCapabilities {
452452 major : usize ,
453453 minor : usize ,
454454 patch : usize ,
455- is_mac : bool ,
456455 }
457456
458457 impl NSOperatingSystemVersion {
459- fn at_least ( & self , mac_version : ( usize , usize ) , ios_version : ( usize , usize ) ) -> bool {
460- if self . is_mac {
458+ fn at_least (
459+ & self ,
460+ mac_version : ( usize , usize ) ,
461+ ios_version : ( usize , usize ) ,
462+ is_mac : bool ,
463+ ) -> bool {
464+ if is_mac {
461465 self . major > mac_version. 0
462466 || ( self . major == mac_version. 0 && self . minor >= mac_version. 1 )
463467 } else {
@@ -467,15 +471,14 @@ impl super::PrivateCapabilities {
467471 }
468472 }
469473
470- let mut version: NSOperatingSystemVersion = unsafe {
474+ let version: NSOperatingSystemVersion = unsafe {
471475 let process_info: * mut objc:: runtime:: Object =
472476 msg_send ! [ class!( NSProcessInfo ) , processInfo] ;
473477 msg_send ! [ process_info, operatingSystemVersion]
474478 } ;
475479
476480 let os_is_mac = device. supports_feature_set ( MTLFeatureSet :: macOS_GPUFamily1_v1) ;
477- version. is_mac = os_is_mac;
478- let family_check = version. at_least ( ( 10 , 15 ) , ( 13 , 0 ) ) ;
481+ let family_check = version. at_least ( ( 10 , 15 ) , ( 13 , 0 ) , os_is_mac) ;
479482
480483 let mut sample_count_mask = crate :: TextureFormatCapabilities :: MULTISAMPLE_X4 ; // 1 and 4 samples are supported on all devices
481484 if device. supports_texture_sample_count ( 2 ) {
@@ -485,9 +488,9 @@ impl super::PrivateCapabilities {
485488 sample_count_mask |= crate :: TextureFormatCapabilities :: MULTISAMPLE_X8 ;
486489 }
487490
488- let rw_texture_tier = if version. at_least ( ( 10 , 13 ) , ( 11 , 0 ) ) {
491+ let rw_texture_tier = if version. at_least ( ( 10 , 13 ) , ( 11 , 0 ) , os_is_mac ) {
489492 device. read_write_texture_support ( )
490- } else if version. at_least ( ( 10 , 12 ) , OS_NOT_SUPPORT ) {
493+ } else if version. at_least ( ( 10 , 12 ) , OS_NOT_SUPPORT , os_is_mac ) {
491494 if Self :: supports_any ( device, & [ MTLFeatureSet :: macOS_ReadWriteTextureTier2] ) {
492495 MTLReadWriteTextureTier :: Tier2
493496 } else {
@@ -499,25 +502,25 @@ impl super::PrivateCapabilities {
499502
500503 Self {
501504 family_check,
502- msl_version : if version. at_least ( ( 12 , 0 ) , ( 15 , 0 ) ) {
505+ msl_version : if version. at_least ( ( 12 , 0 ) , ( 15 , 0 ) , os_is_mac ) {
503506 MTLLanguageVersion :: V2_4
504- } else if version. at_least ( ( 11 , 0 ) , ( 14 , 0 ) ) {
507+ } else if version. at_least ( ( 11 , 0 ) , ( 14 , 0 ) , os_is_mac ) {
505508 MTLLanguageVersion :: V2_3
506- } else if version. at_least ( ( 10 , 15 ) , ( 13 , 0 ) ) {
509+ } else if version. at_least ( ( 10 , 15 ) , ( 13 , 0 ) , os_is_mac ) {
507510 MTLLanguageVersion :: V2_2
508- } else if version. at_least ( ( 10 , 14 ) , ( 12 , 0 ) ) {
511+ } else if version. at_least ( ( 10 , 14 ) , ( 12 , 0 ) , os_is_mac ) {
509512 MTLLanguageVersion :: V2_1
510- } else if version. at_least ( ( 10 , 13 ) , ( 11 , 0 ) ) {
513+ } else if version. at_least ( ( 10 , 13 ) , ( 11 , 0 ) , os_is_mac ) {
511514 MTLLanguageVersion :: V2_0
512- } else if version. at_least ( ( 10 , 12 ) , ( 10 , 0 ) ) {
515+ } else if version. at_least ( ( 10 , 12 ) , ( 10 , 0 ) , os_is_mac ) {
513516 MTLLanguageVersion :: V1_2
514- } else if version. at_least ( ( 10 , 11 ) , ( 9 , 0 ) ) {
517+ } else if version. at_least ( ( 10 , 11 ) , ( 9 , 0 ) , os_is_mac ) {
515518 MTLLanguageVersion :: V1_1
516519 } else {
517520 MTLLanguageVersion :: V1_0
518521 } ,
519522 // macOS 10.11 doesn't support read-write resources
520- fragment_rw_storage : version. at_least ( ( 10 , 12 ) , ( 8 , 0 ) ) ,
523+ fragment_rw_storage : version. at_least ( ( 10 , 12 ) , ( 8 , 0 ) , os_is_mac ) ,
521524 read_write_texture_tier : rw_texture_tier,
522525 msaa_desktop : os_is_mac,
523526 msaa_apple3 : if family_check {
@@ -534,7 +537,7 @@ impl super::PrivateCapabilities {
534537 MUTABLE_COMPARISON_SAMPLER_SUPPORT ,
535538 ) ,
536539 sampler_clamp_to_border : Self :: supports_any ( device, SAMPLER_CLAMP_TO_BORDER_SUPPORT ) ,
537- sampler_lod_average : { version. at_least ( ( 11 , 0 ) , ( 9 , 0 ) ) } ,
540+ sampler_lod_average : { version. at_least ( ( 11 , 0 ) , ( 9 , 0 ) , os_is_mac ) } ,
538541 base_instance : Self :: supports_any ( device, BASE_INSTANCE_SUPPORT ) ,
539542 base_vertex_instance_drawing : Self :: supports_any ( device, BASE_VERTEX_INSTANCE_SUPPORT ) ,
540543 dual_source_blending : Self :: supports_any ( device, DUAL_SOURCE_BLEND_SUPPORT ) ,
@@ -623,7 +626,7 @@ impl super::PrivateCapabilities {
623626 } ,
624627 max_samplers_per_stage : 16 ,
625628 buffer_alignment : if os_is_mac { 256 } else { 64 } ,
626- max_buffer_size : if version. at_least ( ( 10 , 14 ) , ( 12 , 0 ) ) {
629+ max_buffer_size : if version. at_least ( ( 10 , 14 ) , ( 12 , 0 ) , os_is_mac ) {
627630 // maxBufferLength available on macOS 10.14+ and iOS 12.0+
628631 let buffer_size: mtl:: NSInteger =
629632 unsafe { msg_send ! [ device. as_ref( ) , maxBufferLength] } ;
@@ -707,10 +710,10 @@ impl super::PrivateCapabilities {
707710 supports_binary_archives : family_check
708711 && ( device. supports_family ( MTLGPUFamily :: Apple3 )
709712 || device. supports_family ( MTLGPUFamily :: Mac1 ) ) ,
710- supports_capture_manager : version. at_least ( ( 10 , 13 ) , ( 11 , 0 ) ) ,
711- can_set_maximum_drawables_count : version. at_least ( ( 10 , 14 ) , ( 11 , 2 ) ) ,
712- can_set_display_sync : version. at_least ( ( 10 , 13 ) , OS_NOT_SUPPORT ) ,
713- can_set_next_drawable_timeout : version. at_least ( ( 10 , 13 ) , ( 11 , 0 ) ) ,
713+ supports_capture_manager : version. at_least ( ( 10 , 13 ) , ( 11 , 0 ) , os_is_mac ) ,
714+ can_set_maximum_drawables_count : version. at_least ( ( 10 , 14 ) , ( 11 , 2 ) , os_is_mac ) ,
715+ can_set_display_sync : version. at_least ( ( 10 , 13 ) , OS_NOT_SUPPORT , os_is_mac ) ,
716+ can_set_next_drawable_timeout : version. at_least ( ( 10 , 13 ) , ( 11 , 0 ) , os_is_mac ) ,
714717 supports_arrays_of_textures : Self :: supports_any (
715718 device,
716719 & [
@@ -723,14 +726,14 @@ impl super::PrivateCapabilities {
723726 && ( device. supports_family ( MTLGPUFamily :: Apple6 )
724727 || device. supports_family ( MTLGPUFamily :: Mac1 )
725728 || device. supports_family ( MTLGPUFamily :: MacCatalyst1 ) ) ,
726- supports_mutability : version. at_least ( ( 10 , 13 ) , ( 11 , 0 ) ) ,
729+ supports_mutability : version. at_least ( ( 10 , 13 ) , ( 11 , 0 ) , os_is_mac ) ,
727730 //Depth clipping is supported on all macOS GPU families and iOS family 4 and later
728731 supports_depth_clip_control : os_is_mac
729732 || device. supports_feature_set ( MTLFeatureSet :: iOS_GPUFamily4_v1) ,
730- supports_preserve_invariance : version. at_least ( ( 11 , 0 ) , ( 13 , 0 ) ) ,
733+ supports_preserve_invariance : version. at_least ( ( 11 , 0 ) , ( 13 , 0 ) , os_is_mac ) ,
731734 // Metal 2.2 on mac, 2.3 on iOS.
732- supports_shader_primitive_index : version. at_least ( ( 10 , 15 ) , ( 14 , 0 ) ) ,
733- has_unified_memory : if version. at_least ( ( 10 , 15 ) , ( 13 , 0 ) ) {
735+ supports_shader_primitive_index : version. at_least ( ( 10 , 15 ) , ( 14 , 0 ) , os_is_mac ) ,
736+ has_unified_memory : if version. at_least ( ( 10 , 15 ) , ( 13 , 0 ) , os_is_mac ) {
734737 Some ( device. has_unified_memory ( ) )
735738 } else {
736739 None
0 commit comments