Skip to content

Commit

Permalink
Merge pull request #17321 from unoplatform/dev/spouliot/pink-16853
Browse files Browse the repository at this point in the history
fix(macOS): Let the Metal texture be used for sampling
  • Loading branch information
spouliot authored Jun 28, 2024
2 parents 4d032c8 + 776908d commit f2c7afe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ - (nonnull instancetype)initWithMetalKitView:(nonnull MTKView *)mtkView
mtkView.colorPixelFormat = MTLPixelFormatBGRA8Unorm;
mtkView.depthStencilPixelFormat = MTLPixelFormatDepth32Float_Stencil8;
mtkView.sampleCount = 1;
// this property has no effect on x86_64, only on arm64, and is required for sampling (which acrylicbrush does)
mtkView.framebufferOnly = false;
#if DEBUG
NSLog(@"initWithMetalKitView: paused %s enableSetNeedsDisplay %s", mtkView.paused ? "true" : "false", mtkView.enableSetNeedsDisplay ? "true" : "false");
#endif
Expand Down
6 changes: 1 addition & 5 deletions src/Uno.UI/UI/Xaml/Media/AcrylicBrush/AcrylicBrush.skia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

using System;
using System.IO;
using System.Runtime.InteropServices;
using Windows.UI;
using Microsoft.UI;
using Microsoft.UI.Composition;
Expand Down Expand Up @@ -77,15 +76,12 @@ internal override void OnPropertyChanged2(DependencyPropertyChangedEventArgs arg
}
}

// issue specific to macOSarm64 https://github.com/unoplatform/uno/issues/16853
static bool macOSarm64 = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && RuntimeInformation.ProcessArchitecture is Architecture.Arm64;

private void UpdateAcrylicBrush()
{
if (_isConnected)
{
// TODO: Currently we are force recreating the brush even if it exists because Composition animations aren't implemented yet
CreateAcrylicBrush(useCrossFadeEffect: false, forceCreateAcrylicBrush: !macOSarm64);
CreateAcrylicBrush(useCrossFadeEffect: false, forceCreateAcrylicBrush: true);
}
}

Expand Down

0 comments on commit f2c7afe

Please sign in to comment.