dolphin/Source/Core/VideoBackends/Vulkan/VKPerfQuery.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

60 lines
1.5 KiB
C
Raw Normal View History

2016-08-13 06:57:50 -06:00
// Copyright 2016 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
2016-08-13 06:57:50 -06:00
#pragma once
#include <array>
#include <memory>
#include "Common/CommonTypes.h"
2016-08-13 06:57:50 -06:00
#include "VideoBackends/Vulkan/Constants.h"
#include "VideoCommon/PerfQueryBase.h"
namespace Vulkan
{
class PerfQuery : public PerfQueryBase
{
public:
PerfQuery();
~PerfQuery();
static PerfQuery* GetInstance() { return static_cast<PerfQuery*>(g_perf_query.get()); }
bool Initialize();
2016-08-13 06:57:50 -06:00
void EnableQuery(PerfQueryGroup type) override;
void DisableQuery(PerfQueryGroup type) override;
void ResetQuery() override;
u32 GetQueryResult(PerfQueryType type) override;
void FlushResults() override;
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;
2016-08-13 06:57:50 -06:00
struct ActiveQuery
{
u64 fence_counter;
2016-08-13 06:57:50 -06:00
PerfQueryType query_type;
bool has_value;
2016-08-13 06:57:50 -06:00
};
bool CreateQueryPool();
void ReadbackQueries();
void ReadbackQueries(u32 query_count);
void PartialFlush(bool blocking);
2016-08-13 06:57:50 -06:00
VkQueryPool m_query_pool = VK_NULL_HANDLE;
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 = {};
2016-08-13 06:57:50 -06:00
};
} // namespace Vulkan