Skip to content

Commit 7c23ad6

Browse files
taublastmattleibow
andauthored
Hotfix metal for ios 15 and lower (#3293)
* Hotfix metal for ios 15 and lower * Update SKMetalView.cs --------- Co-authored-by: Matthew Leibowitz <[email protected]>
1 parent 080e31c commit 7c23ad6

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

source/SkiaSharp.Views/SkiaSharp.Views/Platform/Apple/SKMetalView.cs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,22 @@ private void Initialize()
9292

9393
ColorPixelFormat = MTLPixelFormat.BGRA8Unorm;
9494
DepthStencilPixelFormat = MTLPixelFormat.Depth32Float_Stencil8;
95-
if (DepthStencilModePrivate)
96-
{
97-
DepthStencilStorageMode = MTLStorageMode.Private;
98-
SampleCount = 4;
99-
}
100-
else
95+
nuint sampling = 1;
96+
#if __IOS__ || __TVOS__
97+
if (UIKit.UIDevice.CurrentDevice.CheckSystemVersion(16, 0))
10198
{
102-
DepthStencilStorageMode = MTLStorageMode.Shared;
103-
SampleCount = 2;
99+
if (DepthStencilModePrivate)
100+
{
101+
DepthStencilStorageMode = MTLStorageMode.Private;
102+
sampling = 4;
103+
}
104+
else
105+
{
106+
DepthStencilStorageMode = MTLStorageMode.Shared;
107+
}
104108
}
109+
#endif
110+
SampleCount = sampling;
105111
FramebufferOnly = false;
106112
Device = device;
107113
backendContext = new GRMtlBackendContext

0 commit comments

Comments
 (0)