From 66d575965c9081b478c2aaef497e6035d43ee698 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Fri, 28 Jul 2023 13:29:26 -0400 Subject: [PATCH] Spoof Counters --- src/Ryujinx.Graphics.Metal/CounterEvent.cs | 23 +++++++++++++++++++++ src/Ryujinx.Graphics.Metal/MetalRenderer.cs | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 src/Ryujinx.Graphics.Metal/CounterEvent.cs diff --git a/src/Ryujinx.Graphics.Metal/CounterEvent.cs b/src/Ryujinx.Graphics.Metal/CounterEvent.cs new file mode 100644 index 000000000..eec810991 --- /dev/null +++ b/src/Ryujinx.Graphics.Metal/CounterEvent.cs @@ -0,0 +1,23 @@ +using Ryujinx.Graphics.GAL; + +namespace Ryujinx.Graphics.Metal +{ + public class CounterEvent : ICounterEvent + { + + public CounterEvent() + { + Invalid = false; + } + + public bool Invalid { get; set; } + public bool ReserveForHostAccess() + { + return true; + } + + public void Flush() { } + + public void Dispose() { } + } +} diff --git a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs index 787f01c6e..dc6b3d05a 100644 --- a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs +++ b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs @@ -213,7 +213,9 @@ namespace Ryujinx.Graphics.Metal public ICounterEvent ReportCounter(CounterType type, EventHandler resultHandler, float divisor, bool hostReserved) { // https://developer.apple.com/documentation/metal/gpu_counters_and_counter_sample_buffers/creating_a_counter_sample_buffer_to_store_a_gpu_s_counter_data_during_a_pass?language=objc - throw new NotImplementedException(); + var counterEvent = new CounterEvent(); + resultHandler?.Invoke(counterEvent, type == CounterType.SamplesPassed ? (ulong)1 : 0); + return counterEvent; } public void ResetCounter(CounterType type)