aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Vulkan/PipelineFull.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2023-01-24 16:32:56 +0000
committerGitHub <noreply@github.com>2023-01-24 13:32:56 -0300
commite7cf4e6eaf528aa72e27f6ba86259c00813bc776 (patch)
tree2d0a0c70a4e1cf20032b1b614452c7996e8f2dc8 /Ryujinx.Graphics.Vulkan/PipelineFull.cs
parenta1a4771ac1de95f2410c7fb8dfaf4a5986e5ebc6 (diff)
Vulkan: Reset queries on same command buffer (#4329)1.1.595
* Reset queries on same command buffer Vulkan seems to complain when the queries are reset on another command buffer. No idea why, the spec really could be written better in this regard. This fixes complaints, and hopefully any implementations that care extensively about them. This change _guesses_ how many queries need to be reset and resets as many as possible at the same time to avoid splitting render passes. If it resets too many queries, we didn't waste too much time - if it runs out of resets it will batch reset 10 more. The number of queries reset is the maximum number of queries in the last 3 frames. This has been worked into the AutoFlushCounter so that it only resets up to 32 if it is yet to force a command buffer submission in this attachment. This is only done for samples passed queries right now, as they have by far the most resets. * Address Feedback
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/PipelineFull.cs')
-rw-r--r--Ryujinx.Graphics.Vulkan/PipelineFull.cs30
1 files changed, 7 insertions, 23 deletions
diff --git a/Ryujinx.Graphics.Vulkan/PipelineFull.cs b/Ryujinx.Graphics.Vulkan/PipelineFull.cs
index 5b4f4a6e..94fd2441 100644
--- a/Ryujinx.Graphics.Vulkan/PipelineFull.cs
+++ b/Ryujinx.Graphics.Vulkan/PipelineFull.cs
@@ -14,7 +14,6 @@ namespace Ryujinx.Graphics.Vulkan
private CounterQueueEvent _activeConditionalRender;
private readonly List<BufferedQuery> _pendingQueryCopies;
- private readonly List<BufferedQuery> _pendingQueryResets;
private ulong _byteWeight;
@@ -22,7 +21,6 @@ namespace Ryujinx.Graphics.Vulkan
{
_activeQueries = new List<QueryPool>();
_pendingQueryCopies = new();
- _pendingQueryResets = new List<BufferedQuery>();
CommandBuffer = (Cbs = gd.CommandBufferPool.Rent()).CommandBuffer;
}
@@ -34,16 +32,6 @@ namespace Ryujinx.Graphics.Vulkan
query.PoolCopy(Cbs);
}
- lock (_pendingQueryResets)
- {
- foreach (var query in _pendingQueryResets)
- {
- query.PoolReset(CommandBuffer);
- }
-
- _pendingQueryResets.Clear();
- }
-
_pendingQueryCopies.Clear();
}
@@ -238,10 +226,12 @@ namespace Ryujinx.Graphics.Vulkan
Gd.Api.CmdBeginQuery(CommandBuffer, queryPool, 0, Gd.Capabilities.SupportsPreciseOcclusionQueries ? QueryControlFlags.PreciseBit : 0);
}
+ Gd.ResetCounterPool();
+
Restore();
}
- public void BeginQuery(BufferedQuery query, QueryPool pool, bool needsReset)
+ public void BeginQuery(BufferedQuery query, QueryPool pool, bool needsReset, bool fromSamplePool)
{
if (needsReset)
{
@@ -249,9 +239,11 @@ namespace Ryujinx.Graphics.Vulkan
Gd.Api.CmdResetQueryPool(CommandBuffer, pool, 0, 1);
- lock (_pendingQueryResets)
+ if (fromSamplePool)
{
- _pendingQueryResets.Remove(query); // Might be present on here.
+ // Try reset some additional queries in advance.
+
+ Gd.ResetFutureCounters(CommandBuffer, AutoFlush.GetRemainingQueries());
}
}
@@ -267,14 +259,6 @@ namespace Ryujinx.Graphics.Vulkan
_activeQueries.Remove(pool);
}
- public void ResetQuery(BufferedQuery query)
- {
- lock (_pendingQueryResets)
- {
- _pendingQueryResets.Add(query);
- }
- }
-
public void CopyQueryResults(BufferedQuery query)
{
_pendingQueryCopies.Add(query);