From 59cdb512ac5b5e31109c9540d10b3b262c482e44 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 24 Jul 2024 12:01:14 -0700 Subject: [PATCH] Add necessary ifdefs to 'ComputeSharp'Uwp' --- src/ComputeSharp.Core/ComputeSharp.Core.csproj | 1 + .../AnimatedComputeShaderPanel.Properties.cs | 9 +++++++++ .../Controls/AnimatedComputeShaderPanel.cs | 10 ++++++++++ .../Controls/ComputeShaderPanel.Properties.cs | 9 +++++++++ src/ComputeSharp.UI/Controls/ComputeShaderPanel.cs | 10 ++++++++++ .../Controls/RenderingFailedEventArgs.cs | 4 ++++ .../Extensions/IDXGIAdapterExtensions.cs | 4 ++++ .../Extensions/SemaphoreSlimExtensions.cs | 4 ++++ .../Helpers/DynamicResolutionManager.cs | 4 ++++ .../Helpers/SwapChainManager.Rendering.cs | 8 ++++++++ src/ComputeSharp.UI/Helpers/SwapChainManager.cs | 14 ++++++++++++++ src/ComputeSharp.UI/IFrameRequestQueue.cs | 4 ++++ src/ComputeSharp.UI/IShaderRunner.cs | 4 ++++ src/ComputeSharp.UI/ShaderRunner{T}.cs | 4 ++++ src/ComputeSharp.Uwp/ComputeSharp.Uwp.csproj | 3 ++- 15 files changed, 91 insertions(+), 1 deletion(-) diff --git a/src/ComputeSharp.Core/ComputeSharp.Core.csproj b/src/ComputeSharp.Core/ComputeSharp.Core.csproj index 7c525455..d2a615e6 100644 --- a/src/ComputeSharp.Core/ComputeSharp.Core.csproj +++ b/src/ComputeSharp.Core/ComputeSharp.Core.csproj @@ -8,6 +8,7 @@ + diff --git a/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.Properties.cs b/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.Properties.cs index 2bc9e6d8..0b10bab9 100644 --- a/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.Properties.cs +++ b/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.Properties.cs @@ -1,8 +1,17 @@ using System; +#if !WINDOWS_UWP using Microsoft.UI.Xaml; +#endif using Windows.Foundation; +#if WINDOWS_UWP +using Windows.UI.Xaml; +#endif +#if WINDOWS_UWP +namespace ComputeSharp.Uwp; +#else namespace ComputeSharp.WinUI; +#endif /// partial class AnimatedComputeShaderPanel diff --git a/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.cs b/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.cs index d64c7f97..d486235a 100644 --- a/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.cs +++ b/src/ComputeSharp.UI/Controls/AnimatedComputeShaderPanel.cs @@ -1,9 +1,19 @@ using System; +#if WINDOWS_UWP +using ComputeSharp.Uwp.Helpers; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +#else using ComputeSharp.WinUI.Helpers; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +#endif +#if WINDOWS_UWP +namespace ComputeSharp.Uwp; +#else namespace ComputeSharp.WinUI; +#endif /// /// diff --git a/src/ComputeSharp.UI/Controls/ComputeShaderPanel.Properties.cs b/src/ComputeSharp.UI/Controls/ComputeShaderPanel.Properties.cs index aee683e9..1b57b967 100644 --- a/src/ComputeSharp.UI/Controls/ComputeShaderPanel.Properties.cs +++ b/src/ComputeSharp.UI/Controls/ComputeShaderPanel.Properties.cs @@ -1,8 +1,17 @@ using System; +#if !WINDOWS_UWP using Microsoft.UI.Xaml; +#endif using Windows.Foundation; +#if WINDOWS_UWP +using Windows.UI.Xaml; +#endif +#if WINDOWS_UWP +namespace ComputeSharp.Uwp; +#else namespace ComputeSharp.WinUI; +#endif /// partial class ComputeShaderPanel diff --git a/src/ComputeSharp.UI/Controls/ComputeShaderPanel.cs b/src/ComputeSharp.UI/Controls/ComputeShaderPanel.cs index d68db8e9..dfeb8554 100644 --- a/src/ComputeSharp.UI/Controls/ComputeShaderPanel.cs +++ b/src/ComputeSharp.UI/Controls/ComputeShaderPanel.cs @@ -1,9 +1,19 @@ using System; +#if WINDOWS_UWP +using ComputeSharp.Uwp.Helpers; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +#else using ComputeSharp.WinUI.Helpers; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +#endif +#if WINDOWS_UWP +namespace ComputeSharp.Uwp; +#else namespace ComputeSharp.WinUI; +#endif /// /// diff --git a/src/ComputeSharp.UI/Controls/RenderingFailedEventArgs.cs b/src/ComputeSharp.UI/Controls/RenderingFailedEventArgs.cs index c4d38d72..c65ee832 100644 --- a/src/ComputeSharp.UI/Controls/RenderingFailedEventArgs.cs +++ b/src/ComputeSharp.UI/Controls/RenderingFailedEventArgs.cs @@ -1,6 +1,10 @@ using System; +#if WINDOWS_UWP +namespace ComputeSharp.Uwp; +#else namespace ComputeSharp.WinUI; +#endif /// /// The arguments for the and events. diff --git a/src/ComputeSharp.UI/Extensions/IDXGIAdapterExtensions.cs b/src/ComputeSharp.UI/Extensions/IDXGIAdapterExtensions.cs index b818749e..10574ef4 100644 --- a/src/ComputeSharp.UI/Extensions/IDXGIAdapterExtensions.cs +++ b/src/ComputeSharp.UI/Extensions/IDXGIAdapterExtensions.cs @@ -3,7 +3,11 @@ using ComputeSharp.Core.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Win32; +#if WINDOWS_UWP +namespace ComputeSharp.Uwp.Extensions; +#else namespace ComputeSharp.WinUI.Extensions; +#endif /// /// A with extensions for the type. diff --git a/src/ComputeSharp.UI/Extensions/SemaphoreSlimExtensions.cs b/src/ComputeSharp.UI/Extensions/SemaphoreSlimExtensions.cs index 65ba7cf9..1a68f70d 100644 --- a/src/ComputeSharp.UI/Extensions/SemaphoreSlimExtensions.cs +++ b/src/ComputeSharp.UI/Extensions/SemaphoreSlimExtensions.cs @@ -5,7 +5,11 @@ using System.Threading.Tasks; #pragma warning disable CS0618, IDE0290 +#if WINDOWS_UWP +namespace ComputeSharp.Uwp.Extensions; +#else namespace ComputeSharp.WinUI.Extensions; +#endif /// /// A helper type for . diff --git a/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs b/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs index 0f99d50c..fc7d0e55 100644 --- a/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs +++ b/src/ComputeSharp.UI/Helpers/DynamicResolutionManager.cs @@ -2,7 +2,11 @@ using System; using System.Runtime.CompilerServices; using System.Threading; +#if WINDOWS_UWP +namespace ComputeSharp.Uwp.Helpers; +#else namespace ComputeSharp.WinUI.Helpers; +#endif /// /// A helper type that is responsible for applying dynamic resolution changes. diff --git a/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs b/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs index a15b7599..d35d92b4 100644 --- a/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs +++ b/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs @@ -3,9 +3,17 @@ using System.Diagnostics; using System.Runtime.CompilerServices; using System.Threading; using ComputeSharp.Interop; +#if WINDOWS_UWP +using ComputeSharp.Uwp.Extensions; +#else using ComputeSharp.WinUI.Extensions; +#endif +#if WINDOWS_UWP +namespace ComputeSharp.Uwp.Helpers; +#else namespace ComputeSharp.WinUI.Helpers; +#endif #pragma warning disable CS0420 diff --git a/src/ComputeSharp.UI/Helpers/SwapChainManager.cs b/src/ComputeSharp.UI/Helpers/SwapChainManager.cs index d5272ff5..e5322bf4 100644 --- a/src/ComputeSharp.UI/Helpers/SwapChainManager.cs +++ b/src/ComputeSharp.UI/Helpers/SwapChainManager.cs @@ -5,14 +5,28 @@ using System.Threading; using ComputeSharp.Core.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Interop; +#if WINDOWS_UWP +using ComputeSharp.Uwp.Extensions; +#else using ComputeSharp.WinUI.Extensions; +#endif using ComputeSharp.Win32; +#if !WINDOWS_UWP using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml.Controls; +#endif using Windows.Foundation; +#if WINDOWS_UWP +using Windows.System; +using Windows.UI.Xaml.Controls; +#endif using WinRT; +#if WINDOWS_UWP +namespace ComputeSharp.Uwp.Helpers; +#else namespace ComputeSharp.WinUI.Helpers; +#endif /// /// A type managing rendering on a target swap chain object. diff --git a/src/ComputeSharp.UI/IFrameRequestQueue.cs b/src/ComputeSharp.UI/IFrameRequestQueue.cs index 416debd6..59d0ebd6 100644 --- a/src/ComputeSharp.UI/IFrameRequestQueue.cs +++ b/src/ComputeSharp.UI/IFrameRequestQueue.cs @@ -1,6 +1,10 @@ using System.Threading; +#if WINDOWS_UWP +namespace ComputeSharp.Uwp; +#else namespace ComputeSharp.WinUI; +#endif /// /// An interface for a shader runner to be used with . diff --git a/src/ComputeSharp.UI/IShaderRunner.cs b/src/ComputeSharp.UI/IShaderRunner.cs index 95cab2c7..23e7d337 100644 --- a/src/ComputeSharp.UI/IShaderRunner.cs +++ b/src/ComputeSharp.UI/IShaderRunner.cs @@ -1,6 +1,10 @@ using System; +#if WINDOWS_UWP +namespace ComputeSharp.Uwp; +#else namespace ComputeSharp.WinUI; +#endif /// /// An interface for a shader runner to be used with or . diff --git a/src/ComputeSharp.UI/ShaderRunner{T}.cs b/src/ComputeSharp.UI/ShaderRunner{T}.cs index f8a9d82a..04924671 100644 --- a/src/ComputeSharp.UI/ShaderRunner{T}.cs +++ b/src/ComputeSharp.UI/ShaderRunner{T}.cs @@ -1,7 +1,11 @@ using System; using ComputeSharp.Descriptors; +#if WINDOWS_UWP +namespace ComputeSharp.Uwp; +#else namespace ComputeSharp.WinUI; +#endif /// /// A simple implementation powered by a supplied shader type. diff --git a/src/ComputeSharp.Uwp/ComputeSharp.Uwp.csproj b/src/ComputeSharp.Uwp/ComputeSharp.Uwp.csproj index 28a323a8..7ec750fc 100644 --- a/src/ComputeSharp.Uwp/ComputeSharp.Uwp.csproj +++ b/src/ComputeSharp.Uwp/ComputeSharp.Uwp.csproj @@ -1,12 +1,13 @@ net8.0-windows10.0.22621.0 - 10.0.17763.0 + 10.0.18362.0 10.0.22621.37-preview true true x64;ARM64 win-x64;win-arm64 + $(DefineConstants);WINDOWS_UWP