core: Define VK_USE_PLATFORM_XCB_KHR before including vkd3d_utils.h.
[vkmodelviewer.git] / Core / EngineProfiling.h
blob0e2504cba6265e9ca9fa9b2028b7e5421dc4cbaf
1 //
2 // Copyright (c) Microsoft. All rights reserved.
3 // This code is licensed under the MIT License (MIT).
4 // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
5 // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
6 // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
7 // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
8 //
9 // Developed by Minigraph
11 // Author: James Stanard
14 #pragma once
16 #include <string>
17 #include "TextRenderer.h"
19 class CommandContext;
21 namespace EngineProfiling
23 void Update();
25 void BeginBlock(const std::wstring& name, CommandContext* Context = nullptr);
26 void EndBlock(CommandContext* Context = nullptr);
28 void DisplayFrameRate(TextContext& Text);
29 void DisplayPerfGraph(GraphicsContext& Text);
30 void Display(TextContext& Text, float x, float y, float w, float h);
31 bool IsPaused();
34 #ifdef RELEASE
35 class ScopedTimer
37 public:
38 ScopedTimer(const std::wstring&) {}
39 ScopedTimer(const std::wstring&, CommandContext&) {}
41 #else
42 class ScopedTimer
44 public:
45 ScopedTimer( const std::wstring& name ) : m_Context(nullptr)
47 EngineProfiling::BeginBlock(name);
49 ScopedTimer( const std::wstring& name, CommandContext& Context ) : m_Context(&Context)
51 EngineProfiling::BeginBlock(name, m_Context);
53 ~ScopedTimer()
55 EngineProfiling::EndBlock(m_Context);
58 private:
59 CommandContext* m_Context;
61 #endif