Fixing disabled profiling.

This commit is contained in:
Ben Vanik 2014-05-28 21:46:43 -07:00
parent 997f582d1f
commit 328ece538a
2 changed files with 40 additions and 5 deletions

View File

@ -15,9 +15,11 @@ namespace xe {
std::unique_ptr<ProfilerDisplay> Profiler::display_ = nullptr;
#if XE_OPTION_PROFILING
void Profiler::Initialize() {
MicroProfileInit();
MicroProfileSetDisplayMode(2);
MicroProfileSetDisplayMode(1);
}
void Profiler::Dump() {
@ -99,8 +101,29 @@ void Profiler::Present() {
display_->End();
}
#else
void Profiler::Initialize() {}
void Profiler::Dump() {}
void Profiler::Shutdown() {}
uint32_t Profiler::GetColor(const char* str) { return 0; }
void Profiler::ThreadEnter(const char* name) {}
void Profiler::ThreadExit() {}
bool Profiler::OnKeyDown(int key_code) { return false; }
bool Profiler::OnKeyUp(int key_code) { return false; }
void Profiler::OnMouseDown(bool left_button, bool right_button) {}
void Profiler::OnMouseUp() {}
void Profiler::OnMouseMove(int x, int y) {}
void Profiler::OnMouseWheel(int x, int y, int dy) {}
void Profiler::set_display(std::unique_ptr<ProfilerDisplay> display) {}
void Profiler::Present() {}
#endif // XE_OPTION_PROFILING
} // namespace xe
#if XE_OPTION_PROFILING
uint32_t MicroProfileGpuInsertTimeStamp() {
return 0;
}
@ -143,3 +166,5 @@ void MicroProfileDrawText(int nX, int nY, uint32_t nColor, const char* pText, ui
}
display->DrawText(nX, nY, nColor, pText, nLen);
}
#endif // XE_OPTION_PROFILING

View File

@ -81,24 +81,34 @@ namespace xe {
#else
#define DEFINE_profile_cpu(name, group_name, scope_name, color)
#define DEFINE_profile_gpu(name, group_name, scope_name, color)
#define DEFINE_profile_cpu(name, group_name, scope_name)
#define DEFINE_profile_gpu(name, group_name, scope_name)
#define DECLARE_profile_cpu(name)
#define DECLARE_profile_gpu(name)
#define SCOPE_profile_cpu(name) do {} while (false)
#define SCOPE_profile_cpu_i(group_name, scope_name, color) do {} while (false)
#define SCOPE_profile_cpu_f(name) do {} while (false)
#define SCOPE_profile_cpu_i(group_name, scope_name) do {} while (false)
#define SCOPE_profile_gpu(name) do {} while (false)
#define SCOPE_profile_gpu_i(group_name, scope_name, color) do {} while (false)
#define SCOPE_profile_gpu_f(name) do {} while (false)
#define SCOPE_profile_gpu_i(group_name, scope_name) do {} while (false)
#define COUNT_profile_cpu(name, count) do {} while (false)
#define COUNT_profile_gpu(name, count) do {} while (false)
#define MICROPROFILE_TEXT_WIDTH 1
#define MICROPROFILE_TEXT_HEIGHT 1
#endif // XE_OPTION_PROFILING
class ProfilerDisplay {
public:
enum BoxType {
#if XE_OPTION_PROFILING
BOX_TYPE_BAR = MicroProfileBoxTypeBar,
BOX_TYPE_FLAT = MicroProfileBoxTypeFlat,
#else
BOX_TYPE_BAR,
BOX_TYPE_FLAT,
#endif // XE_OPTION_PROFILING
};
virtual uint32_t width() const = 0;