Merge UWP and WinUI 3 controls projects

このコミットが含まれているのは:
Sergio Pedri committed 2021-11-20 17:06:48 +01:00
1 親 d8a4a7412d
コミット bad1781f2b
18ファイル変更
+107 -999

検索条件に一致するファイルはありません

+7 -1
ファイルの表示
@@ -1,7 +1,13 @@
using System;
using Microsoft.UI.Xaml;
#if WINDOWS_UWP
using Windows.UI.Xaml;
namespace ComputeSharp.Uwp;
#else
using Microsoft.UI.Xaml;
namespace ComputeSharp.WinUI;
#endif
/// <inheritdoc cref="ComputeShaderPanel"/>
public sealed unsafe partial class ComputeShaderPanel
+26 -5
ファイルの表示
@@ -1,19 +1,32 @@
using System;
using System.Diagnostics;
#if WINDOWS_UWP
using System.Runtime.InteropServices;
#endif
using System.Threading;
using ComputeSharp.Core.Extensions;
using ComputeSharp.Graphics.Helpers;
using ComputeSharp.Interop;
#if WINDOWS_UWP
using ComputeSharp.Uwp.Helpers;
#else
using ComputeSharp.WinUI.Helpers;
#endif
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
using TerraFX.Interop.WinRT;
#if !WINDOWS_UWP
using WinRT;
#endif
using Win32 = TerraFX.Interop.Windows.Windows;
#pragma warning disable CS0420
#if WINDOWS_UWP
namespace ComputeSharp.Uwp;
#else
namespace ComputeSharp.WinUI;
#endif
/// <inheritdoc cref="ComputeShaderPanel"/>
public sealed partial class ComputeShaderPanel
@@ -64,7 +77,7 @@ public sealed partial class ComputeShaderPanel
private ComPtr<IDXGISwapChain3> dxgiSwapChain3;
/// <summary>
/// The awaitable object for <see cref="IDXGISwapChain1.Present"/> calls.
/// The awaitable object for <see cref="IDXGISwapChain3.Present"/> calls.
/// </summary>
private HANDLE frameLatencyWaitableObject;
@@ -94,22 +107,22 @@ public sealed partial class ComputeShaderPanel
private volatile bool isResizePending;
/// <summary>
/// The backing store for <see cref="Microsoft.UI.Xaml.FrameworkElement.ActualWidth"/> for the render thread.
/// The backing store for the actual width for the render thread.
/// </summary>
private volatile float width;
/// <summary>
/// The backing store for <see cref="Microsoft.UI.Xaml.FrameworkElement.ActualHeight"/> for the render thread.
/// The backing store for the actual height for the render thread.
/// </summary>
private volatile float height;
/// <summary>
/// The backing store for <see cref="Microsoft.UI.Xaml.Controls.SwapChainPanel.CompositionScaleX"/> for the render thread.
/// The backing store for the current composition scale on the X axis for the render thread.
/// </summary>
private volatile float compositionScaleX;
/// <summary>
/// The backing store for <see cref="Microsoft.UI.Xaml.Controls.SwapChainPanel.CompositionScaleY"/> for the render thread.
/// The backing store for the current composition scale on the Y axis for the render thread.
/// </summary>
private volatile float compositionScaleY;
@@ -249,12 +262,20 @@ public sealed partial class ComputeShaderPanel
// IDXGISwapChain reference just created and set that as the swap chain panel to use.
using ComPtr<ISwapChainPanelNative> swapChainPanelNative = default;
#if WINDOWS_UWP
IUnknown* swapChainPanel = (IUnknown*)Marshal.GetIUnknownForObject(this);
swapChainPanel->QueryInterface(
Win32.__uuidof<ISwapChainPanelNative>(),
(void**)&swapChainPanelNative).Assert();
#else
IUnknown* swapChainPanel = (IUnknown*)((IWinRTObject)this).NativeObject.ThisPtr;
Guid iSwapChainPanelNativeUuid = new(0x63AAD0B8, 0x7C24, 0x40FF, 0x85, 0xA8, 0x64, 0x0D, 0x94, 0x4C, 0xC3, 0x25);
swapChainPanel->QueryInterface(
&iSwapChainPanelNativeUuid,
(void**)&swapChainPanelNative).Assert();
#endif
using (ComPtr<IDXGISwapChain> idxgiSwapChain = default)
{
+8 -1
ファイルの表示
@@ -1,7 +1,14 @@
using Microsoft.UI.Xaml;
#if WINDOWS_UWP
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace ComputeSharp.Uwp;
#else
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace ComputeSharp.WinUI;
#endif
/// <summary>
/// A custom <see cref="SwapChainPanel"/> that can be used to render animated backgrounds.
+13
ファイルの表示
@@ -1,8 +1,14 @@
using System;
#if !WINDOWS_UWP
using System.Runtime.InteropServices;
#endif
using System.Threading;
#if WINDOWS_UWP
namespace ComputeSharp.Uwp.Helpers;
#else
namespace ComputeSharp.WinUI.Helpers;
#endif
/// <summary>
/// A helper type that is responsible for applying dynamic resolution changes.
@@ -68,7 +74,14 @@ internal unsafe ref struct DynamicResolutionManager
manager.frameTimeOffset = 0;
manager.slidingFrameTimeWindowSum = TargetFrameTimeInTicksFor60fps * SlidingFrameTimeWindowLength;
#if WINDOWS_UWP
fixed (long* p = &manager.frameTimesInTicks[0])
{
new Span<long>(p, SlidingFrameTimeWindowLength).Fill(TargetFrameTimeInTicksFor60fps);
}
#else
MemoryMarshal.CreateSpan(ref manager.frameTimesInTicks[0], SlidingFrameTimeWindowLength).Fill(TargetFrameTimeInTicksFor60fps);
#endif
}
/// <summary>
+4
ファイルの表示
@@ -1,6 +1,10 @@
using System;
#if WINDOWS_UWP
namespace ComputeSharp.Uwp;
#else
namespace ComputeSharp.WinUI;
#endif
/// <summary>
/// An interface for a shader runner to be used with <see cref="ComputeShaderPanel"/>.
+4
ファイルの表示
@@ -1,6 +1,10 @@
using System;
#if WINDOWS_UWP
namespace ComputeSharp.Uwp;
#else
namespace ComputeSharp.WinUI;
#endif
/// <summary>
/// An <see cref="IShaderRunner"/> implementation powered by a supplied shader type.