Add IDisposable interface to compute shader panels
このコミットが含まれているのは:
1 親
12f451977a
コミット
77503542aa
3ファイル変更
+22
-6
検索条件に一致するファイルはありません
@@ -1,4 +1,5 @@
|
||||
#if WINDOWS_UWP
|
||||
using System;
|
||||
#if WINDOWS_UWP
|
||||
using ComputeSharp.Uwp.Helpers;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
@@ -23,7 +24,7 @@ namespace ComputeSharp.WinUI;
|
||||
/// This panel will always render new frames at the current display refresh rate, automatically.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public sealed partial class AnimatedComputeShaderPanel : SwapChainPanel
|
||||
public sealed partial class AnimatedComputeShaderPanel : SwapChainPanel, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="SwapChainManager{TOwner}"/> instance handling rendering.
|
||||
@@ -76,4 +77,10 @@ public sealed partial class AnimatedComputeShaderPanel : SwapChainPanel
|
||||
{
|
||||
this.swapChainManager.QueueCompositionScaleChange(CompositionScaleX, CompositionScaleY);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
this.swapChainManager.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
#if WINDOWS_UWP
|
||||
using System;
|
||||
#if WINDOWS_UWP
|
||||
using ComputeSharp.Uwp.Helpers;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
@@ -23,7 +24,7 @@ namespace ComputeSharp.WinUI;
|
||||
/// This panel accepts a custom <see cref="IFrameRequestQueue"/> instance to customize frame requests.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public sealed partial class ComputeShaderPanel : SwapChainPanel
|
||||
public sealed partial class ComputeShaderPanel : SwapChainPanel, IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="SwapChainManager{TOwner}"/> instance handling rendering.
|
||||
@@ -76,4 +77,10 @@ public sealed partial class ComputeShaderPanel : SwapChainPanel
|
||||
{
|
||||
this.swapChainManager.QueueCompositionScaleChange(CompositionScaleX, CompositionScaleY);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Dispose()
|
||||
{
|
||||
this.swapChainManager.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -55,8 +55,10 @@ partial class SwapChainManager<TOwner>
|
||||
/// </summary>
|
||||
public async void StopRenderLoop()
|
||||
{
|
||||
using var _0 = GetReferenceTracker().GetLease();
|
||||
|
||||
// Stopping the render loop doesn't use a reference tracking lease on purpose.
|
||||
// This is to allow callers to stop the render loop even after disposing without
|
||||
// the method throwing an exception. Stopping a loop doesn't actually access any
|
||||
// native objects anyway, as it's just cancelling the cancellation token source.
|
||||
using (await this.setupSemaphore.LockAsync())
|
||||
{
|
||||
this.renderCancellationTokenSource?.Cancel();
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする