From cee712105850ac3385cd0091a923438167433f9f Mon Sep 17 00:00:00 2001 From: TSR Berry <20988865+TSRBerry@users.noreply.github.com> Date: Sat, 8 Apr 2023 01:22:00 +0200 Subject: Move solution and projects to src --- src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs | 57 +++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs (limited to 'src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs') diff --git a/src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs b/src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs new file mode 100644 index 00000000..e6c7ab2b --- /dev/null +++ b/src/Ryujinx.Graphics.OpenGL/Queries/Counters.cs @@ -0,0 +1,57 @@ +using Ryujinx.Graphics.GAL; +using System; + +namespace Ryujinx.Graphics.OpenGL.Queries +{ + class Counters : IDisposable + { + private CounterQueue[] _counterQueues; + + public Counters() + { + int count = Enum.GetNames().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 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(); + } + } + } +} \ No newline at end of file -- cgit v1.2.3