mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-22 00:53:35 +00:00
Do not clear unbound framebuffer color attachments
This commit is contained in:
parent
de87ed3edc
commit
2713703d45
2 changed files with 11 additions and 3 deletions
|
@ -10,12 +10,13 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
private readonly Device _device;
|
||||
private readonly Auto<DisposableImageView>[] _attachments;
|
||||
private uint _validColorAttachments;
|
||||
|
||||
public uint Width { get; }
|
||||
public uint Height { get; }
|
||||
public uint Layers { get; }
|
||||
|
||||
public uint[] AttachmentSamples { get; }
|
||||
public uint[] AttachmentSamples { get; }
|
||||
public VkFormat[] AttachmentFormats { get; }
|
||||
public int[] AttachmentIndices { get; }
|
||||
|
||||
|
@ -34,6 +35,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
_device = device;
|
||||
_attachments = new[] { view };
|
||||
_validColorAttachments = 1u;
|
||||
|
||||
Width = width;
|
||||
Height = height;
|
||||
|
@ -77,6 +79,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
var texture = (TextureView)color;
|
||||
|
||||
_attachments[index] = texture.GetImageViewForAttachment();
|
||||
_validColorAttachments |= 1u << bindIndex;
|
||||
|
||||
AttachmentSamples[index] = (uint)texture.Info.Samples;
|
||||
AttachmentFormats[index] = texture.VkFormat;
|
||||
|
@ -131,6 +134,11 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
return _attachments[index];
|
||||
}
|
||||
|
||||
public bool IsVaidColorAttachment(int bindIndex)
|
||||
{
|
||||
return (uint)bindIndex < Constants.MaxRenderTargets && (_validColorAttachments & (1u << bindIndex)) != 0;
|
||||
}
|
||||
|
||||
private static bool IsValidTextureView(ITexture texture)
|
||||
{
|
||||
return texture is TextureView view && view.Valid;
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
|
||||
public unsafe void ClearRenderTargetColor(int index, ColorF color)
|
||||
{
|
||||
if (_framebuffer == null)
|
||||
if (FramebufferParams == null || !FramebufferParams.IsVaidColorAttachment(index))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
{
|
||||
// TODO: Use stencilMask (fully)
|
||||
|
||||
if (_framebuffer == null || !FramebufferParams.HasDepthStencil)
|
||||
if (FramebufferParams == null || !FramebufferParams.HasDepthStencil)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue