From a7a3073c8fbe3bc760fd182b0adb7120cd73bb02 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 18 Feb 2023 23:04:42 +0100 Subject: [PATCH] Add shared code to ComputeSharp.D2D1.WinUI --- ComputeSharp.sln | 1 + src/ComputeSharp.Core/ComputeSharp.Core.csproj | 1 + src/ComputeSharp.D2D1.UI/Helpers/ResourceManager.cs | 2 ++ .../PixelShaderEffect{T}.ICanvasImage.cs | 3 +-- ...t{T}.Properties.ResourceTextureManagerCollection.cs | 10 +++++----- ...PixelShaderEffect{T}.Properties.SourceCollection.cs | 10 +++++----- .../ComputeSharp.D2D1.WinUI.csproj | 3 ++- src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj | 1 + 8 files changed, 18 insertions(+), 13 deletions(-) diff --git a/ComputeSharp.sln b/ComputeSharp.sln index 265428f4..7b49c5d0 100644 --- a/ComputeSharp.sln +++ b/ComputeSharp.sln @@ -469,6 +469,7 @@ Global src\TerraFX.Interop.Windows.D2D1\TerraFX.Interop.Windows.D2D1.projitems*{9da1da9f-f8b2-4b25-be80-c21f773029e3}*SharedItemsImports = 13 src\ComputeSharp.NetStandard\ComputeSharp.NetStandard.projitems*{a5997814-d8d2-4541-87ac-c3e53caa67c0}*SharedItemsImports = 13 src\ComputeSharp.UI\ComputeSharp.UI.projitems*{afaafdc9-be42-45d4-8c79-0ee8c8edbf52}*SharedItemsImports = 5 + src\ComputeSharp.D2D1.UI\ComputeSharp.D2D1.UI.projitems*{bd9e6556-357e-4c20-bfcd-fb131f9372fa}*SharedItemsImports = 5 src\ComputeSharp.NetStandard\ComputeSharp.NetStandard.projitems*{bfb003d1-788b-48de-8065-39479c162cb0}*SharedItemsImports = 5 src\ComputeSharp.SourceGeneration\ComputeSharp.SourceGeneration.projitems*{bfb003d1-788b-48de-8065-39479c162cb0}*SharedItemsImports = 5 samples\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems*{c12d7ace-98ed-4813-8118-6667c34f484f}*SharedItemsImports = 5 diff --git a/src/ComputeSharp.Core/ComputeSharp.Core.csproj b/src/ComputeSharp.Core/ComputeSharp.Core.csproj index 52fe9c3d..6a4268e3 100644 --- a/src/ComputeSharp.Core/ComputeSharp.Core.csproj +++ b/src/ComputeSharp.Core/ComputeSharp.Core.csproj @@ -14,6 +14,7 @@ + diff --git a/src/ComputeSharp.D2D1.UI/Helpers/ResourceManager.cs b/src/ComputeSharp.D2D1.UI/Helpers/ResourceManager.cs index bd37235c..ed3b24a0 100644 --- a/src/ComputeSharp.D2D1.UI/Helpers/ResourceManager.cs +++ b/src/ComputeSharp.D2D1.UI/Helpers/ResourceManager.cs @@ -8,6 +8,8 @@ using Windows.Graphics.Effects; namespace ComputeSharp.D2D1.Uwp.Helpers; +using WinRT = TerraFX.Interop.WinRT.WinRT; + /// /// A helper type to replicate Win2D's ResourceManager type. /// diff --git a/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.ICanvasImage.cs b/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.ICanvasImage.cs index d0f24e97..2204fe5a 100644 --- a/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.ICanvasImage.cs +++ b/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.ICanvasImage.cs @@ -3,7 +3,6 @@ using System.Runtime.InteropServices; using ABI.Microsoft.Graphics.Canvas; using ComputeSharp.D2D1.Extensions; using ComputeSharp.Interop; -using Microsoft.Graphics.Canvas; using TerraFX.Interop.Windows; using Windows.Foundation; using ICanvasResourceCreator = Microsoft.Graphics.Canvas.ICanvasResourceCreator; @@ -25,7 +24,7 @@ unsafe partial class PixelShaderEffect return GetBounds(resourceCreator, &transform); } - /// + /// private Rect GetBounds(ICanvasResourceCreator resourceCreator, Matrix3x2* transform) { using ReferenceTracker.Lease _0 = GetReferenceTracker().GetLease(); diff --git a/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs b/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs index e458491f..faac63e3 100644 --- a/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs +++ b/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.ResourceTextureManagerCollection.cs @@ -117,7 +117,7 @@ partial class PixelShaderEffect } /// - int IList.Add(object value) + int IList.Add(object? value) { return default(NotSupportedException).Throw(); } @@ -141,7 +141,7 @@ partial class PixelShaderEffect } /// - bool IList.Contains(object value) + bool IList.Contains(object? value) { return FixedCountList.IndexOf(this, (D2D1ResourceTextureManager?)value) != -1; } @@ -177,7 +177,7 @@ partial class PixelShaderEffect } /// - int IList.IndexOf(object value) + int IList.IndexOf(object? value) { return FixedCountList.IndexOf(this, (D2D1ResourceTextureManager?)value); } @@ -189,7 +189,7 @@ partial class PixelShaderEffect } /// - void IList.Insert(int index, object value) + void IList.Insert(int index, object? value) { default(NotSupportedException).Throw(); } @@ -201,7 +201,7 @@ partial class PixelShaderEffect } /// - void IList.Remove(object value) + void IList.Remove(object? value) { default(NotSupportedException).Throw(); } diff --git a/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.SourceCollection.cs b/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.SourceCollection.cs index 167d43cf..8b146b97 100644 --- a/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.SourceCollection.cs +++ b/src/ComputeSharp.D2D1.UI/PixelShaderEffect{T}.Properties.SourceCollection.cs @@ -103,7 +103,7 @@ partial class PixelShaderEffect } /// - int IList.Add(object value) + int IList.Add(object? value) { return default(NotSupportedException).Throw(); } @@ -127,7 +127,7 @@ partial class PixelShaderEffect } /// - bool IList.Contains(object value) + bool IList.Contains(object? value) { return FixedCountList.IndexOf(this, (IGraphicsEffectSource?)value) != -1; } @@ -163,7 +163,7 @@ partial class PixelShaderEffect } /// - int IList.IndexOf(object value) + int IList.IndexOf(object? value) { return FixedCountList.IndexOf(this, (IGraphicsEffectSource?)value); } @@ -175,7 +175,7 @@ partial class PixelShaderEffect } /// - void IList.Insert(int index, object value) + void IList.Insert(int index, object? value) { default(NotSupportedException).Throw(); } @@ -187,7 +187,7 @@ partial class PixelShaderEffect } /// - void IList.Remove(object value) + void IList.Remove(object? value) { default(NotSupportedException).Throw(); } diff --git a/src/ComputeSharp.D2D1.WinUI/ComputeSharp.D2D1.WinUI.csproj b/src/ComputeSharp.D2D1.WinUI/ComputeSharp.D2D1.WinUI.csproj index c1d01f79..1baee968 100644 --- a/src/ComputeSharp.D2D1.WinUI/ComputeSharp.D2D1.WinUI.csproj +++ b/src/ComputeSharp.D2D1.WinUI/ComputeSharp.D2D1.WinUI.csproj @@ -20,11 +20,12 @@ - + + diff --git a/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj b/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj index c1ce7b65..75c00014 100644 --- a/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj +++ b/src/ComputeSharp.D2D1/ComputeSharp.D2D1.csproj @@ -8,6 +8,7 @@ +