This repository was archived by the owner on Feb 25, 2025. It is now read-only.
  
  
  
  
    
    
    
      
    
  
  
    
File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed 
impeller/renderer/backend/metal Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ constexpr PixelFormat FromMTLPixelFormat(MTLPixelFormat format) {
5252  return  PixelFormat::kUnknown ;
5353}
5454
55+ // / Safe accessor for MTLPixelFormatDepth24Unorm_Stencil8.
56+ // / Returns PixelFormat::kUnknown if MTLPixelFormatDepth24Unorm_Stencil8 isn't
57+ // / supported.
58+ MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8 ();
59+ 
5560// / Safe accessor for MTLPixelFormatBGR10_XR_sRGB.
5661// / Returns PixelFormat::kUnknown if MTLPixelFormatBGR10_XR_sRGB isn't
5762// / supported.
@@ -90,7 +95,7 @@ constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format) {
9095    case  PixelFormat::kS8UInt :
9196      return  MTLPixelFormatStencil8;
9297    case  PixelFormat::kD24UnormS8Uint :
93-       return  MTLPixelFormatDepth24Unorm_Stencil8 ;
98+       return  SafeMTLPixelFormatDepth24Unorm_Stencil8 () ;
9499    case  PixelFormat::kD32FloatS8UInt :
95100      return  MTLPixelFormatDepth32Float_Stencil8;
96101    case  PixelFormat::kB10G10R10XRSRGB :
Original file line number Diff line number Diff line change 33//  found in the LICENSE file.
44
55#include  " impeller/renderer/backend/metal/formats_mtl.h" 
6+ #include  < Metal/Metal.h> 
67
78#include  < memory> 
89
109110  return  mtl_desc;
110111}
111112
113+ MTLPixelFormat  SafeMTLPixelFormatDepth24Unorm_Stencil8 () {
114+   if  (@available (macOS 10.11 , *)) {
115+     return  MTLPixelFormatDepth24Unorm_Stencil8 ;
116+   }
117+   return  MTLPixelFormatInvalid ;
118+ }
119+ 
112120MTLPixelFormat  SafeMTLPixelFormatBGR10_XR_sRGB () {
113121  if  (@available (iOS 11 , macOS 11.0 , *)) {
114122    return  MTLPixelFormatBGR10_XR_sRGB;
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments