From a6be0d13086398de418b5c0620b93254fae2facb Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Wed, 26 Jun 2024 20:10:36 -0400 Subject: [PATCH 1/3] Revert "Merge pull request #17013 from unoplatform/dev/spouliot/workaround-pink-acrylicbrush" This reverts commit 3d13a85fdf4261644ed51b90060a00e0fd956549, reversing changes made to ef403a8455c1fb89944994ec152365f39c23483e. --- src/Uno.UI/UI/Xaml/Media/AcrylicBrush/AcrylicBrush.skia.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Uno.UI/UI/Xaml/Media/AcrylicBrush/AcrylicBrush.skia.cs b/src/Uno.UI/UI/Xaml/Media/AcrylicBrush/AcrylicBrush.skia.cs index e706d99c1f49..07e1768ec010 100644 --- a/src/Uno.UI/UI/Xaml/Media/AcrylicBrush/AcrylicBrush.skia.cs +++ b/src/Uno.UI/UI/Xaml/Media/AcrylicBrush/AcrylicBrush.skia.cs @@ -2,7 +2,6 @@ using System; using System.IO; -using System.Runtime.InteropServices; using Windows.UI; using Microsoft.UI; using Microsoft.UI.Composition; @@ -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(false /* useCrossFadeEffect */, true /* forceCreateAcrylicBrush */); } } From 75b7da3296efb6e69e79ca27bd44519977d070f4 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Wed, 26 Jun 2024 20:12:34 -0400 Subject: [PATCH 2/3] fix(macOS): Let the Metal texture be used for sampling --- .../UnoNativeMac/UnoNativeMac/UNOMetalViewDelegate.m | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOMetalViewDelegate.m b/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOMetalViewDelegate.m index 7f0231e0ad9b..b1502cbfc1e2 100644 --- a/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOMetalViewDelegate.m +++ b/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOMetalViewDelegate.m @@ -22,6 +22,7 @@ - (nonnull instancetype)initWithMetalKitView:(nonnull MTKView *)mtkView mtkView.colorPixelFormat = MTLPixelFormatBGRA8Unorm; mtkView.depthStencilPixelFormat = MTLPixelFormatDepth32Float_Stencil8; mtkView.sampleCount = 1; + mtkView.framebufferOnly = false; #if DEBUG NSLog(@"initWithMetalKitView: paused %s enableSetNeedsDisplay %s", mtkView.paused ? "true" : "false", mtkView.enableSetNeedsDisplay ? "true" : "false"); #endif From 776908dba27ff445789a1adca768b7e41816c87d Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Thu, 27 Jun 2024 09:58:48 -0400 Subject: [PATCH 3/3] chore: update PR with reviewers comments --- .../UnoNativeMac/UnoNativeMac/UNOMetalViewDelegate.m | 1 + src/Uno.UI/UI/Xaml/Media/AcrylicBrush/AcrylicBrush.skia.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOMetalViewDelegate.m b/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOMetalViewDelegate.m index b1502cbfc1e2..c8985eae251a 100644 --- a/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOMetalViewDelegate.m +++ b/src/Uno.UI.Runtime.Skia.MacOS/UnoNativeMac/UnoNativeMac/UNOMetalViewDelegate.m @@ -22,6 +22,7 @@ - (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"); diff --git a/src/Uno.UI/UI/Xaml/Media/AcrylicBrush/AcrylicBrush.skia.cs b/src/Uno.UI/UI/Xaml/Media/AcrylicBrush/AcrylicBrush.skia.cs index 07e1768ec010..b51f78e30d86 100644 --- a/src/Uno.UI/UI/Xaml/Media/AcrylicBrush/AcrylicBrush.skia.cs +++ b/src/Uno.UI/UI/Xaml/Media/AcrylicBrush/AcrylicBrush.skia.cs @@ -81,7 +81,7 @@ 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(false /* useCrossFadeEffect */, true /* forceCreateAcrylicBrush */); + CreateAcrylicBrush(useCrossFadeEffect: false, forceCreateAcrylicBrush: true); } }