mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-08-02 02:22:26 -07:00
Fix render target clear when sizes mismatch (#2994)
This commit is contained in:
@@ -47,6 +47,16 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
/// </summary>
|
||||
public Target Target { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Texture width.
|
||||
/// </summary>
|
||||
public int Width { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Texture height.
|
||||
/// </summary>
|
||||
public int Height { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Texture information.
|
||||
/// </summary>
|
||||
@@ -926,7 +936,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
FlushTextureDataToGuest(tracked);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets a host texture to use for flushing the texture, at 1x resolution.
|
||||
/// If the HostTexture is already at 1x resolution, it is returned directly.
|
||||
@@ -1322,6 +1332,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
{
|
||||
Info = info;
|
||||
Target = info.Target;
|
||||
Width = info.Width;
|
||||
Height = info.Height;
|
||||
CanForceAnisotropy = CanTextureForceAnisotropy();
|
||||
|
||||
_depth = info.GetDepth();
|
||||
|
@@ -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>
|
||||
@@ -210,6 +213,17 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
return changesScale || ScaleNeedsUpdated(depthStencil);
|
||||
}
|
||||
|
||||
/// <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>
|
||||
@@ -409,6 +423,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.
|
||||
|
Reference in New Issue
Block a user