mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-08-19 21:52:22 +00:00
Vulkan: Enumerate Query Pool properly (#6167)
Turns out that ElementAt for Queue<T> runs the default implementation as it doesn't implement IList, which enumerates elements of the queue up to the given index. This code was creating `count` enumerators and iterating way more queue items than it needed to at higher counts. The solution is just to use one enumerator and break out of the loop when we get the count that we need. 3.5% of backend time was being spent _just_ enumerating at the usual spot in SMO.
This commit is contained in:
parent
9a28ba72b1
commit
6575952432
|
@ -67,9 +67,18 @@ namespace Ryujinx.Graphics.Vulkan.Queries
|
||||||
lock (_queryPool)
|
lock (_queryPool)
|
||||||
{
|
{
|
||||||
count = Math.Min(count, _queryPool.Count);
|
count = Math.Min(count, _queryPool.Count);
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
_queryPool.ElementAt(i).PoolReset(cmd, ResetSequence);
|
foreach (BufferedQuery query in _queryPool)
|
||||||
|
{
|
||||||
|
query.PoolReset(cmd, ResetSequence);
|
||||||
|
|
||||||
|
if (--count == 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue