Fixed rendering pause feature, added sample option

このコミットが含まれているのは:
Sergio Pedri committed 2021-11-20 00:27:59 +01:00
1 親 2d89489e7f
コミット 255db239ea
4ファイル変更
+70 -4

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

+12 -3
ファイルの表示
@@ -113,6 +113,11 @@ namespace ComputeSharp.WinUI
/// </summary>
private bool isCancellationRequested;
/// <summary>
/// The <see cref="Stopwatch"/> instance tracking time since the first rendered frame.
/// </summary>
private Stopwatch? renderTimer;
/// <summary>
/// Initializes the current application.
/// </summary>
@@ -375,12 +380,14 @@ namespace ComputeSharp.WinUI
static void ExecuteRenderLoop(ComputeShaderPanel @this)
{
Stopwatch
startStopwatch = Stopwatch.StartNew(),
startStopwatch = @this.renderTimer ??= new(),
frameStopwatch = Stopwatch.StartNew();
const long targetFrameTimeInTicksFor60fps = 166666;
@this.OnUpdate(startStopwatch.Elapsed);
@this.OnUpdate(TimeSpan.Zero);
startStopwatch.Start();
const long targetFrameTimeInTicksFor60fps = 166666;
while (!@this.isCancellationRequested)
{
@@ -391,6 +398,8 @@ namespace ComputeSharp.WinUI
@this.OnUpdate(startStopwatch.Elapsed);
}
}
startStopwatch.Stop();
}
this.isCancellationRequested = false;