Fix resolution scale setting in shader panels
このコミットが含まれているのは:
1 親
d430fbc4dc
コミット
cb975e552a
2ファイル変更
+16
-10
検索条件に一致するファイルはありません
@@ -44,6 +44,7 @@ partial class SwapChainManager<TOwner>
|
||||
this.renderCancellationTokenSource = new CancellationTokenSource();
|
||||
this.renderThread = newRenderThread;
|
||||
this.renderSemaphore = new SemaphoreSlim(0, 1);
|
||||
this.isResizePending = true;
|
||||
|
||||
newRenderThread.Start(this);
|
||||
}
|
||||
@@ -85,6 +86,7 @@ partial class SwapChainManager<TOwner>
|
||||
this.renderThread = newRenderThread;
|
||||
this.renderSemaphore = new SemaphoreSlim(0, 1);
|
||||
this.isDynamicResolutionEnabled = isDynamicResolutionEnabled;
|
||||
this.isResizePending = true;
|
||||
|
||||
newRenderThread.Start(this);
|
||||
}
|
||||
@@ -149,14 +151,12 @@ partial class SwapChainManager<TOwner>
|
||||
|
||||
if (this.isDynamicResolutionEnabled)
|
||||
{
|
||||
this.targetResolutionScale = 1.0f;
|
||||
this.dynamicResolutionScale = this.resolutionScale;
|
||||
|
||||
RenderLoopWithDynamicResolution();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.targetResolutionScale = this.resolutionScale;
|
||||
|
||||
RenderLoop();
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ partial class SwapChainManager<TOwner>
|
||||
OnPresent();
|
||||
|
||||
// Evaluate the dynamic resolution frame time step
|
||||
if (frameTimeWatcher.Advance(frameStopwatch.ElapsedTicks, ref this.targetResolutionScale))
|
||||
if (frameTimeWatcher.Advance(frameStopwatch.ElapsedTicks, ref this.dynamicResolutionScale))
|
||||
{
|
||||
this.isResizePending = true;
|
||||
}
|
||||
|
||||
@@ -166,9 +166,9 @@ internal sealed unsafe partial class SwapChainManager<TOwner> : NativeObject
|
||||
private volatile float resolutionScale;
|
||||
|
||||
/// <summary>
|
||||
/// The resolution scale used to render frames, in either render mode.
|
||||
/// The dynamic resolution scale used to render frames.
|
||||
/// </summary>
|
||||
private volatile float targetResolutionScale;
|
||||
private volatile float dynamicResolutionScale;
|
||||
|
||||
/// <summary>
|
||||
/// Whether dynamic resolution is currently enabled.
|
||||
@@ -327,8 +327,14 @@ internal sealed unsafe partial class SwapChainManager<TOwner> : NativeObject
|
||||
/// </summary>
|
||||
private unsafe void ApplyResize()
|
||||
{
|
||||
uint resizedWidth = (uint)Math.Max(Math.Ceiling(this.width * this.compositionScaleX * this.targetResolutionScale), 1.0);
|
||||
uint resizeHeight = (uint)Math.Max(Math.Ceiling(this.height * this.compositionScaleY * this.targetResolutionScale), 1.0);
|
||||
// The target resolution scale is either the dynamic resolution scale, being updated by the render thread,
|
||||
// or the fixed resolution scale set by the user. If dynamic resolution is enabled, the latter is ignored.
|
||||
float targetResolutionScale = this.isDynamicResolutionEnabled
|
||||
? this.dynamicResolutionScale
|
||||
: this.resolutionScale;
|
||||
|
||||
uint resizedWidth = (uint)Math.Max(Math.Ceiling(this.width * this.compositionScaleX * targetResolutionScale), 1.0);
|
||||
uint resizeHeight = (uint)Math.Max(Math.Ceiling(this.height * this.compositionScaleY * targetResolutionScale), 1.0);
|
||||
|
||||
if (this.texture is null ||
|
||||
this.texture.Width != resizedWidth ||
|
||||
@@ -355,8 +361,8 @@ internal sealed unsafe partial class SwapChainManager<TOwner> : NativeObject
|
||||
|
||||
// Apply the necessary scale transform
|
||||
DXGI_MATRIX_3X2_F transformMatrix = default;
|
||||
transformMatrix._11 = (1 / this.compositionScaleX) * (1 / this.targetResolutionScale);
|
||||
transformMatrix._22 = (1 / this.compositionScaleY) * (1 / this.targetResolutionScale);
|
||||
transformMatrix._11 = (1 / this.compositionScaleX) * (1 / targetResolutionScale);
|
||||
transformMatrix._22 = (1 / this.compositionScaleY) * (1 / targetResolutionScale);
|
||||
|
||||
this.dxgiSwapChain3.Get()->SetMatrixTransform(&transformMatrix).Assert();
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする