mirror of
https://github.com/GreemDev/Ryujinx.git
synced 2024-12-20 22:05:53 +01:00
6e9bd4de13
* GPU: Scale counter results before addition Counter results were being scaled on ReportCounter, which meant that the _total_ value of the counter was being scaled. Not only could this result in very large numbers and weird overflows if the game doesn't clear the counter, but it also caused the result to change drastically. This PR changes scaling to be done when the value is added to the counter on the backend. This should evaluate the scale at the same time as before, on report counter, but avoiding the issue with scaling the total. Fixes scaling in Warioware, at least in the demo, where it seems to compare old/new counters and broke down when scaling was enabled. * Fix issues when result is partially uploaded. Drivers tend to write the low half first, then the high half. Retry if the high half is FFFFFFFF.
57 lines
1.4 KiB
C#
57 lines
1.4 KiB
C#
using Ryujinx.Graphics.GAL;
|
|
using System;
|
|
|
|
namespace Ryujinx.Graphics.OpenGL.Queries
|
|
{
|
|
class Counters : IDisposable
|
|
{
|
|
private CounterQueue[] _counterQueues;
|
|
|
|
public Counters()
|
|
{
|
|
int count = Enum.GetNames<CounterType>().Length;
|
|
|
|
_counterQueues = new CounterQueue[count];
|
|
}
|
|
|
|
public void Initialize(Pipeline pipeline)
|
|
{
|
|
for (int index = 0; index < _counterQueues.Length; index++)
|
|
{
|
|
CounterType type = (CounterType)index;
|
|
_counterQueues[index] = new CounterQueue(pipeline, type);
|
|
}
|
|
}
|
|
|
|
public CounterQueueEvent QueueReport(CounterType type, EventHandler<ulong> resultHandler, ulong lastDrawIndex, bool hostReserved)
|
|
{
|
|
return _counterQueues[(int)type].QueueReport(resultHandler, lastDrawIndex, hostReserved);
|
|
}
|
|
|
|
public void QueueReset(CounterType type)
|
|
{
|
|
_counterQueues[(int)type].QueueReset();
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
foreach (var queue in _counterQueues)
|
|
{
|
|
queue.Flush(false);
|
|
}
|
|
}
|
|
|
|
public void Flush(CounterType type)
|
|
{
|
|
_counterQueues[(int)type].Flush(true);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
foreach (var queue in _counterQueues)
|
|
{
|
|
queue.Dispose();
|
|
}
|
|
}
|
|
}
|
|
} |