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) {
52
52
return PixelFormat::kUnknown ;
53
53
}
54
54
55
+ // / Safe accessor for MTLPixelFormatDepth24Unorm_Stencil8.
56
+ // / Returns PixelFormat::kUnknown if MTLPixelFormatDepth24Unorm_Stencil8 isn't
57
+ // / supported.
58
+ MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8 ();
59
+
55
60
// / Safe accessor for MTLPixelFormatBGR10_XR_sRGB.
56
61
// / Returns PixelFormat::kUnknown if MTLPixelFormatBGR10_XR_sRGB isn't
57
62
// / supported.
@@ -90,7 +95,7 @@ constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format) {
90
95
case PixelFormat::kS8UInt :
91
96
return MTLPixelFormatStencil8;
92
97
case PixelFormat::kD24UnormS8Uint :
93
- return MTLPixelFormatDepth24Unorm_Stencil8 ;
98
+ return SafeMTLPixelFormatDepth24Unorm_Stencil8 () ;
94
99
case PixelFormat::kD32FloatS8UInt :
95
100
return MTLPixelFormatDepth32Float_Stencil8;
96
101
case PixelFormat::kB10G10R10XRSRGB :
Original file line number Diff line number Diff line change 3
3
// found in the LICENSE file.
4
4
5
5
#include " impeller/renderer/backend/metal/formats_mtl.h"
6
+ #include < Metal/Metal.h>
6
7
7
8
#include < memory>
8
9
109
110
return mtl_desc;
110
111
}
111
112
113
+ MTLPixelFormat SafeMTLPixelFormatDepth24Unorm_Stencil8 () {
114
+ if (@available (macOS 10.11 , *)) {
115
+ return MTLPixelFormatDepth24Unorm_Stencil8 ;
116
+ }
117
+ return MTLPixelFormatInvalid ;
118
+ }
119
+
112
120
MTLPixelFormat SafeMTLPixelFormatBGR10_XR_sRGB () {
113
121
if (@available (iOS 11 , macOS 11.0 , *)) {
114
122
return MTLPixelFormatBGR10_XR_sRGB;
You can’t perform that action at this time.
0 commit comments