aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-02-08 04:48:09 -0300
committerGitHub <noreply@github.com>2023-02-08 08:48:09 +0100
commit96cf242bcf168b9f9e6a1e27200529466217f396 (patch)
tree01cb6f4aff69aa4019ff613af83e88e8cd124813 /Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
parent59755818ef79f494d87c4e9d2b8372b54b38cb9d (diff)
Handle mismatching texture size with copy dependencies (#4364)1.1.605
* Handle mismatching texture size with copy dependencies * Create copy and render textures with the minimum possible size * Only align width for comparisons, assume that height is always exact * Fix IsExactMatch size check * Allow sampler and copy textures to match textures with larger width * Delete texture ChangeSize related code * Move AdjustSize to TextureInfo and give it a better name, adjust usages * Fix GetMinimumWidthInGob when minimumWidth > width * Only update render targets that are actually cleared for clear Avoids creating textures with incorrect sizes * Delete UpdateRenderTargetState method that is not needed anymore Clears now only ever sets the render targets that will be cleared rather than all of them
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs15
1 files changed, 9 insertions, 6 deletions
diff --git a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
index 9b59009c..9b58e014 100644
--- a/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
+++ b/Ryujinx.Graphics.Gpu/Engine/Threed/StateUpdater.cs
@@ -402,20 +402,23 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
/// </summary>
private void UpdateRenderTargetState()
{
- UpdateRenderTargetState(true);
+ UpdateRenderTargetState(RenderTargetUpdateFlags.UpdateAll);
}
/// <summary>
/// Updates render targets (color and depth-stencil buffers) based on current render target state.
/// </summary>
- /// <param name="useControl">Use draw buffers information from render target control register</param>
- /// <param name="layered">Indicates if the texture is layered</param>
+ /// <param name="updateFlags">Flags indicating which render targets should be updated and how</param>
/// <param name="singleUse">If this is not -1, it indicates that only the given indexed target will be used.</param>
- public void UpdateRenderTargetState(bool useControl, bool layered = false, int singleUse = -1)
+ public void UpdateRenderTargetState(RenderTargetUpdateFlags updateFlags, int singleUse = -1)
{
var memoryManager = _channel.MemoryManager;
var rtControl = _state.State.RtControl;
+ bool useControl = updateFlags.HasFlag(RenderTargetUpdateFlags.UseControl);
+ bool layered = updateFlags.HasFlag(RenderTargetUpdateFlags.Layered);
+ bool singleColor = updateFlags.HasFlag(RenderTargetUpdateFlags.SingleColor);
+
int count = useControl ? rtControl.UnpackCount() : Constants.TotalRenderTargets;
var msaaMode = _state.State.RtMsaaMode;
@@ -438,7 +441,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
var colorState = _state.State.RtColorState[rtIndex];
- if (index >= count || !IsRtEnabled(colorState))
+ if (index >= count || !IsRtEnabled(colorState) || (singleColor && index != singleUse))
{
changedScale |= _channel.TextureManager.SetRenderTargetColor(index, null);
@@ -478,7 +481,7 @@ namespace Ryujinx.Graphics.Gpu.Engine.Threed
Image.Texture depthStencil = null;
- if (dsEnable)
+ if (dsEnable && updateFlags.HasFlag(RenderTargetUpdateFlags.UpdateDepthStencil))
{
var dsState = _state.State.RtDepthStencilState;
var dsSize = _state.State.RtDepthStencilSize;