summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Vulkan/PerfQuery.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Core/VideoBackends/Vulkan/PerfQuery.h')
-rw-r--r--Source/Core/VideoBackends/Vulkan/PerfQuery.h44
1 files changed, 17 insertions, 27 deletions
diff --git a/Source/Core/VideoBackends/Vulkan/PerfQuery.h b/Source/Core/VideoBackends/Vulkan/PerfQuery.h
index 47ccf22a66..8ca91ac658 100644
--- a/Source/Core/VideoBackends/Vulkan/PerfQuery.h
+++ b/Source/Core/VideoBackends/Vulkan/PerfQuery.h
@@ -13,18 +13,15 @@
namespace Vulkan
{
-class StagingBuffer;
-
class PerfQuery : public PerfQueryBase
{
public:
PerfQuery();
~PerfQuery();
- static PerfQuery* GetInstance();
+ static PerfQuery* GetInstance() { return static_cast<PerfQuery*>(g_perf_query.get()); }
bool Initialize();
- void FlushQueries();
void EnableQuery(PerfQueryGroup type) override;
void DisableQuery(PerfQueryGroup type) override;
@@ -34,37 +31,30 @@ public:
bool IsFlushed() const override;
private:
+ // u32 is used for the sample counts.
+ using PerfQueryDataType = u32;
+
+ // when testing in SMS: 64 was too small, 128 was ok
+ // TODO: This should be size_t, but the base class uses u32s
+ static const u32 PERF_QUERY_BUFFER_SIZE = 512;
+
struct ActiveQuery
{
+ u64 fence_counter;
PerfQueryType query_type;
- VkFence pending_fence;
- bool available;
- bool active;
+ bool has_value;
};
bool CreateQueryPool();
- bool CreateReadbackBuffer();
- void QueueCopyQueryResults(u32 start_index, u32 query_count);
- void ProcessResults(u32 start_index, u32 query_count);
-
- void OnCommandBufferQueued(VkCommandBuffer command_buffer, VkFence fence);
- void OnFenceSignaled(VkFence fence);
-
- void NonBlockingPartialFlush();
- void BlockingPartialFlush();
+ void ReadbackQueries();
+ void ReadbackQueries(u32 query_count);
+ void PartialFlush(bool blocking);
- // when testing in SMS: 64 was too small, 128 was ok
- // TODO: This should be size_t, but the base class uses u32s
- using PerfQueryDataType = u32;
- static const u32 PERF_QUERY_BUFFER_SIZE = 512;
- std::array<ActiveQuery, PERF_QUERY_BUFFER_SIZE> m_query_buffer = {};
- u32 m_query_read_pos = 0;
-
- // TODO: Investigate using pipeline statistics to implement other query types
VkQueryPool m_query_pool = VK_NULL_HANDLE;
-
- // Buffer containing query results. Each query is a u32.
- std::unique_ptr<StagingBuffer> m_readback_buffer;
+ u32 m_query_readback_pos = 0;
+ u32 m_query_next_pos = 0;
+ std::array<ActiveQuery, PERF_QUERY_BUFFER_SIZE> m_query_buffer = {};
+ std::array<PerfQueryDataType, PERF_QUERY_BUFFER_SIZE> m_query_result_buffer = {};
};
} // namespace Vulkan