Debian Codegraph @

Source/Core/VideoBackends/Metal/MTLPerfQuery.h

raw symbols SCIP
1 // Copyright 2022 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include <condition_variable>
7 #include <mutex>
8
9 #include "VideoCommon/PerfQueryBase.h"
10
11 namespace Metal
12 {
13 class PerfQuery final : public PerfQueryBase
14 {
15 public:
16 void EnableQuery(PerfQueryGroup type) override;
17 void DisableQuery(PerfQueryGroup type) override;
18 void ResetQuery() override;
19 u32 GetQueryResult(PerfQueryType type) override;
20 void FlushResults() override;
21 bool IsFlushed() const override;
22
23 /// Notify PerfQuery of a new pending encoder
24 /// One call to ReturnResults should be made for every call to IncCount
25 void IncCount() { m_query_count.fetch_add(1, std::memory_order_relaxed); }
26 /// May be called from any thread
27 void ReturnResults(const u64* data, const PerfQueryGroup* groups, size_t count, u32 query_id);
28
29 private:
30 u32 m_current_query = 0;
31 std::mutex m_results_mtx;
32 std::condition_variable m_cv;
33 };
34 } // namespace Metal