Add virtual Initialize() to PerfQueryBase

Both DX12 and Vulkan already had one.
This commit is contained in:
Scott Mansell 2023-01-29 23:57:37 +13:00
parent 3c73707dfe
commit 8bc8e43dd6
5 changed files with 9 additions and 18 deletions

View File

@ -17,7 +17,7 @@ public:
static PerfQuery* GetInstance() { return static_cast<PerfQuery*>(g_perf_query.get()); } static PerfQuery* GetInstance() { return static_cast<PerfQuery*>(g_perf_query.get()); }
bool Initialize(); bool Initialize() override;
void ResolveQueries(); void ResolveQueries();
void EnableQuery(PerfQueryGroup group) override; void EnableQuery(PerfQueryGroup group) override;

View File

@ -239,19 +239,8 @@ bool VideoBackend::Initialize(const WindowSystemInfo& wsi)
auto perf_query = std::make_unique<PerfQuery>(); auto perf_query = std::make_unique<PerfQuery>();
auto bounding_box = std::make_unique<VKBoundingBox>(); auto bounding_box = std::make_unique<VKBoundingBox>();
if (!InitializeShared(std::move(gfx), std::move(vertex_manager), std::move(perf_query), return !InitializeShared(std::move(gfx), std::move(vertex_manager), std::move(perf_query),
std::move(bounding_box))) std::move(bounding_box));
{
return false;
}
if (!PerfQuery::GetInstance()->Initialize())
{
PanicAlertFmt("Failed to initialize PerfQuery");
return false;
}
return true;
} }
void VideoBackend::Shutdown() void VideoBackend::Shutdown()

View File

@ -20,7 +20,7 @@ public:
static PerfQuery* GetInstance() { return static_cast<PerfQuery*>(g_perf_query.get()); } static PerfQuery* GetInstance() { return static_cast<PerfQuery*>(g_perf_query.get()); }
bool Initialize(); bool Initialize() override;
void EnableQuery(PerfQueryGroup group) override; void EnableQuery(PerfQueryGroup group) override;
void DisableQuery(PerfQueryGroup group) override; void DisableQuery(PerfQueryGroup group) override;

View File

@ -34,6 +34,8 @@ public:
PerfQueryBase() : m_query_count(0) {} PerfQueryBase() : m_query_count(0) {}
virtual ~PerfQueryBase() {} virtual ~PerfQueryBase() {}
virtual bool Initialize() { return true; }
// Checks if performance queries are enabled in the gameini configuration. // Checks if performance queries are enabled in the gameini configuration.
// NOTE: Called from CPU+GPU thread // NOTE: Called from CPU+GPU thread
static bool ShouldEmulate(); static bool ShouldEmulate();

View File

@ -371,9 +371,9 @@ bool VideoBackendBase::InitializeShared(std::unique_ptr<AbstractGfx> gfx,
TMEM::Init(); TMEM::Init();
if (!g_vertex_manager->Initialize() || !g_shader_cache->Initialize() || if (!g_vertex_manager->Initialize() || !g_shader_cache->Initialize() ||
!g_renderer->Initialize() || !g_presenter->Initialize() || !g_perf_query->Initialize() || !g_renderer->Initialize() ||
!g_framebuffer_manager->Initialize() || !g_texture_cache->Initialize() || !g_presenter->Initialize() || !g_framebuffer_manager->Initialize() ||
!g_bounding_box->Initialize()) !g_texture_cache->Initialize() || !g_bounding_box->Initialize())
{ {
PanicAlertFmtT("Failed to initialize renderer classes"); PanicAlertFmtT("Failed to initialize renderer classes");
Shutdown(); Shutdown();