Add option to enable v-sync in shader panels

このコミットが含まれているのは:
Sergio Pedri committed 2022-01-20 23:04:41 +01:00
1 親 b1fb409f73
コミット 9bc9c97eaa
6ファイル変更
+76 -2

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

+28
ファイルの表示
@@ -135,6 +135,34 @@ partial class AnimatedComputeShaderPanel
@this.swapChainManager.QueueDynamicResolutionModeChange(isDynamicResolutionEnabled);
}
/// <summary>
/// Gets or sets whether vertical sync is enabled.
/// <para>The default value for this property is <see langword="true"/>.</para>
/// </summary>
public bool IsVerticalSyncEnabled
{
get => (bool)GetValue(IsVerticalSyncEnabledProperty);
set => SetValue(IsVerticalSyncEnabledProperty, value);
}
/// <summary>
/// The <see cref="DependencyProperty"/> backing <see cref="IsVerticalSyncEnabled"/>.
/// </summary>
public static readonly DependencyProperty IsVerticalSyncEnabledProperty = DependencyProperty.Register(
nameof(IsVerticalSyncEnabled),
typeof(bool),
typeof(AnimatedComputeShaderPanel),
new PropertyMetadata(true, OnIsVerticalSyncEnabledPropertyChanged));
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnIsVerticalSyncEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (AnimatedComputeShaderPanel)d;
var isVerticalSyncEnabled = (bool)e.NewValue;
@this.swapChainManager.QueueVerticalSyncModeChange(isVerticalSyncEnabled);
}
/// <summary>
/// Gets or sets whether or not the rendering is paused.
/// </summary>
+1
ファイルの表示
@@ -50,6 +50,7 @@ public sealed partial class AnimatedComputeShaderPanel : SwapChainPanel
this.swapChainManager.QueueCompositionScaleChange(CompositionScaleX, CompositionScaleY);
this.swapChainManager.QueueResolutionScaleChange(ResolutionScale);
this.swapChainManager.QueueDynamicResolutionModeChange(IsDynamicResolutionEnabled);
this.swapChainManager.QueueVerticalSyncModeChange(IsVerticalSyncEnabled);
if (!IsPaused &&
ShaderRunner is IShaderRunner shaderRunner)
+28
ファイルの表示
@@ -169,4 +169,32 @@ partial class ComputeShaderPanel
@this.swapChainManager.QueueDynamicResolutionModeChange(isDynamicResolutionEnabled);
}
/// <summary>
/// Gets or sets whether vertical sync is enabled.
/// <para>The default value for this property is <see langword="true"/>.</para>
/// </summary>
public bool IsVerticalSyncEnabled
{
get => (bool)GetValue(IsVerticalSyncEnabledProperty);
set => SetValue(IsVerticalSyncEnabledProperty, value);
}
/// <summary>
/// The <see cref="DependencyProperty"/> backing <see cref="IsVerticalSyncEnabled"/>.
/// </summary>
public static readonly DependencyProperty IsVerticalSyncEnabledProperty = DependencyProperty.Register(
nameof(IsVerticalSyncEnabled),
typeof(bool),
typeof(ComputeShaderPanel),
new PropertyMetadata(true, OnIsVerticalSyncEnabledPropertyChanged));
/// <inheritdoc cref="DependencyPropertyChangedCallback"/>
private static void OnIsVerticalSyncEnabledPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var @this = (ComputeShaderPanel)d;
var isVerticalSyncEnabled = (bool)e.NewValue;
@this.swapChainManager.QueueVerticalSyncModeChange(isVerticalSyncEnabled);
}
}
+1
ファイルの表示
@@ -50,6 +50,7 @@ public sealed partial class ComputeShaderPanel : SwapChainPanel
this.swapChainManager.QueueCompositionScaleChange(CompositionScaleX, CompositionScaleY);
this.swapChainManager.QueueResolutionScaleChange(ResolutionScale);
this.swapChainManager.QueueDynamicResolutionModeChange(IsDynamicResolutionEnabled);
this.swapChainManager.QueueVerticalSyncModeChange(IsVerticalSyncEnabled);
if (FrameRequestQueue is IFrameRequestQueue frameRequestQueue &&
ShaderRunner is IShaderRunner shaderRunner)