aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2022-01-11 16:15:17 -0300
committerGitHub <noreply@github.com>2022-01-11 20:15:17 +0100
commit6e0799580f0d1b473a79471c5d365c6524d97a86 (patch)
tree94df6b825227d6f35c8bf5673c3b25fc8235c47f /Ryujinx.Graphics.Gpu/Image/TextureManager.cs
parentef24c8983dc3971cd906568d337e49be694ee542 (diff)
Fix render target clear when sizes mismatch (#2994)
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureManager.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureManager.cs43
1 files changed, 43 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
index 70cb57d0..90e26442 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs
@@ -19,6 +19,9 @@ namespace Ryujinx.Graphics.Gpu.Image
private Texture _rtDepthStencil;
private ITexture _rtHostDs;
+ public int ClipRegionWidth { get; private set; }
+ public int ClipRegionHeight { get; private set; }
+
/// <summary>
/// The scaling factor applied to all currently bound render targets.
/// </summary>
@@ -211,6 +214,17 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
+ /// Sets the host clip region, which should be the intersection of all render target texture sizes.
+ /// </summary>
+ /// <param name="width">Width of the clip region, defined as the minimum width across all bound textures</param>
+ /// <param name="height">Height of the clip region, defined as the minimum height across all bound textures</param>
+ public void SetClipRegion(int width, int height)
+ {
+ ClipRegionWidth = width;
+ ClipRegionHeight = height;
+ }
+
+ /// <summary>
/// Gets the first available bound colour target, or the depth stencil target if not present.
/// </summary>
/// <returns>The first bound colour target, otherwise the depth stencil target</returns>
@@ -410,6 +424,35 @@ namespace Ryujinx.Graphics.Gpu.Image
}
/// <summary>
+ /// Update host framebuffer attachments based on currently bound render target buffers.
+ /// </summary>
+ /// <remarks>
+ /// All attachments other than <paramref name="index"/> will be unbound.
+ /// </remarks>
+ /// <param name="index">Index of the render target color to be updated</param>
+ public void UpdateRenderTarget(int index)
+ {
+ new Span<ITexture>(_rtHostColors).Fill(null);
+ _rtHostColors[index] = _rtColors[index]?.HostTexture;
+
+ _context.Renderer.Pipeline.SetRenderTargets(_rtHostColors, null);
+ }
+
+ /// <summary>
+ /// Update host framebuffer attachments based on currently bound render target buffers.
+ /// </summary>
+ /// <remarks>
+ /// All color attachments will be unbound.
+ /// </remarks>
+ public void UpdateRenderTargetDepthStencil()
+ {
+ new Span<ITexture>(_rtHostColors).Fill(null);
+ _rtHostDs = _rtDepthStencil?.HostTexture;
+
+ _context.Renderer.Pipeline.SetRenderTargets(_rtHostColors, _rtHostDs);
+ }
+
+ /// <summary>
/// Forces all textures, samplers, images and render targets to be rebound the next time
/// CommitGraphicsBindings is called.
/// </summary>