mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-21 16:43:35 +00:00
Flush queries on attachment change rather than program change
Occlusion queries are usually used in a depth only pass so the attachments changing is a better indication of the query block ending. Write mask changes are also considered since some games do depth only pass by setting 0 write mask on all the colour targets.
This commit is contained in:
parent
d4b9a6378f
commit
2000070330
2 changed files with 16 additions and 3 deletions
|
@ -45,6 +45,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
protected FramebufferParams FramebufferParams;
|
protected FramebufferParams FramebufferParams;
|
||||||
private Auto<DisposableFramebuffer> _framebuffer;
|
private Auto<DisposableFramebuffer> _framebuffer;
|
||||||
private Auto<DisposableRenderPass> _renderPass;
|
private Auto<DisposableRenderPass> _renderPass;
|
||||||
|
private int _writtenAttachmentCount;
|
||||||
private bool _renderPassActive;
|
private bool _renderPassActive;
|
||||||
|
|
||||||
private readonly DescriptorSetUpdater _descriptorSetUpdater;
|
private readonly DescriptorSetUpdater _descriptorSetUpdater;
|
||||||
|
@ -598,10 +599,9 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
stages.CopyTo(_newState.Stages.ToSpan().Slice(0, stages.Length));
|
stages.CopyTo(_newState.Stages.ToSpan().Slice(0, stages.Length));
|
||||||
|
|
||||||
SignalStateChange();
|
SignalStateChange();
|
||||||
SignalProgramChange();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void SignalProgramChange()
|
protected virtual void SignalAttachmentChange()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,15 +614,27 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
public void SetRenderTargetColorMasks(ReadOnlySpan<uint> componentMask)
|
public void SetRenderTargetColorMasks(ReadOnlySpan<uint> componentMask)
|
||||||
{
|
{
|
||||||
int count = Math.Min(Constants.MaxRenderTargets, componentMask.Length);
|
int count = Math.Min(Constants.MaxRenderTargets, componentMask.Length);
|
||||||
|
int writtenAttachments = 0;
|
||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
ref var vkBlend = ref _newState.Internal.ColorBlendAttachmentState[i];
|
ref var vkBlend = ref _newState.Internal.ColorBlendAttachmentState[i];
|
||||||
|
|
||||||
vkBlend.ColorWriteMask = (ColorComponentFlags)componentMask[i];
|
vkBlend.ColorWriteMask = (ColorComponentFlags)componentMask[i];
|
||||||
|
|
||||||
|
if (componentMask[i] != 0)
|
||||||
|
{
|
||||||
|
writtenAttachments++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SignalStateChange();
|
SignalStateChange();
|
||||||
|
|
||||||
|
if (writtenAttachments != _writtenAttachmentCount)
|
||||||
|
{
|
||||||
|
SignalAttachmentChange();
|
||||||
|
_writtenAttachmentCount = writtenAttachments;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRenderTargets(ITexture[] colors, ITexture depthStencil)
|
public void SetRenderTargets(ITexture[] colors, ITexture depthStencil)
|
||||||
|
@ -631,6 +643,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
CreateFramebuffer(colors, depthStencil);
|
CreateFramebuffer(colors, depthStencil);
|
||||||
CreateRenderPass();
|
CreateRenderPass();
|
||||||
SignalStateChange();
|
SignalStateChange();
|
||||||
|
SignalAttachmentChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRenderTargetScale(float scale)
|
public void SetRenderTargetScale(float scale)
|
||||||
|
|
|
@ -384,7 +384,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||||
_hasPendingQuery = true;
|
_hasPendingQuery = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void SignalProgramChange()
|
protected override void SignalAttachmentChange()
|
||||||
{
|
{
|
||||||
FlushPendingQuery();
|
FlushPendingQuery();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue