From d15967b92a52a95528952ba955c8e01441fe0a6d Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 9 Jan 2022 10:11:26 +0100 Subject: [PATCH] Improve XML docs --- .../Helpers/SwapChainManager.Rendering.cs | 2 ++ src/ComputeSharp.UI/IFrameRequestQueue.cs | 19 +++++++++++++++++++ src/ComputeSharp.UI/IShaderRunner.cs | 6 +++++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs b/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs index bcacdab2..e99c28d4 100644 --- a/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs +++ b/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs @@ -175,6 +175,7 @@ partial class SwapChainManager /// /// The core render loop. /// + [MethodImpl(MethodImplOptions.NoInlining)] private void RenderLoop() { Stopwatch renderStopwatch = this.renderStopwatch ??= new(); @@ -218,6 +219,7 @@ partial class SwapChainManager /// /// The core render loop with dynamic resolution. /// + [MethodImpl(MethodImplOptions.NoInlining)] private void RenderLoopWithDynamicResolution() { Stopwatch renderStopwatch = this.renderStopwatch ??= new(); diff --git a/src/ComputeSharp.UI/IFrameRequestQueue.cs b/src/ComputeSharp.UI/IFrameRequestQueue.cs index 41a1e719..96677a27 100644 --- a/src/ComputeSharp.UI/IFrameRequestQueue.cs +++ b/src/ComputeSharp.UI/IFrameRequestQueue.cs @@ -16,5 +16,24 @@ public interface IFrameRequestQueue /// /// The input parameter for the frame to render. /// A token to cancel waiting for a new frame. + /// + /// + /// This method should block synchronously until a new frame is available, returning its + /// parameters if any. The parameter should be used to cancel a + /// blocking operation and return immediately, as it's cancelled when rendering is stopped. + /// + /// + /// For instance, if the implementation is internally using a + /// queue and calling + /// to block and wait for + /// a new frame parameter, the + /// overload should be used instead, to enable canceling the operation early if needed. + /// + /// + /// If the runner throws an , this will just be recognized by the + /// in use and result in rendering simply being stopped. If any other exceptions are thrown + /// instead, they will be interpreted as a failure, and will be raised. + /// + /// void Dequeue(out object? parameter, CancellationToken token); } diff --git a/src/ComputeSharp.UI/IShaderRunner.cs b/src/ComputeSharp.UI/IShaderRunner.cs index 63b66582..fbf5c96f 100644 --- a/src/ComputeSharp.UI/IShaderRunner.cs +++ b/src/ComputeSharp.UI/IShaderRunner.cs @@ -7,7 +7,7 @@ namespace ComputeSharp.WinUI; #endif /// -/// An interface for a shader runner to be used with . +/// An interface for a shader runner to be used with or . /// public interface IShaderRunner { @@ -18,5 +18,9 @@ public interface IShaderRunner /// The timespan for the current frame. /// The input parameter for the frame being rendered. /// Whether or not to present the current frame. If , the frame will be skipped. + /// + /// Any exceptions thrown by the runner will result in + /// or to be raised. + /// bool TryExecute(IReadWriteTexture2D texture, TimeSpan timespan, object? parameter); }