GL: Fixed GPU timer frequency.

This commit is contained in:
Branimir Karadžić
2017-09-22 22:26:56 -07:00
parent 4b4b1c31a6
commit 41b29a34a6
2 changed files with 8 additions and 7 deletions

View File

@@ -162,14 +162,15 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText)
#endif // 0
const bgfx::Stats* stats = bgfx::getStats();
const double toMs = 1000.0/stats->cpuTimerFreq;
const double toMsCpu = 1000.0/stats->cpuTimerFreq;
const double toMsGpu = 1000.0/stats->gpuTimerFreq;
ImGui::Text("Frame %0.3f"
, double(stats->cpuTimeFrame)*toMs
, double(stats->cpuTimeFrame)*toMsCpu
);
ImGui::Text("Submit CPU %0.3f, GPU %0.3f (L: %d)"
, double(stats->cpuTimeEnd - stats->cpuTimeBegin)*toMs
, double(stats->gpuTimeEnd - stats->gpuTimeBegin)*toMs
, double(stats->cpuTimeEnd - stats->cpuTimeBegin)*toMsCpu
, double(stats->gpuTimeEnd - stats->gpuTimeBegin)*toMsGpu
, stats->maxGpuLatency
);
@@ -190,8 +191,8 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText)
{
ImGuiListClipper clipper(stats->numViews, itemHeight);
const double toCpuMs = 1000.0/stats->cpuTimerFreq;
const double toGpuMs = 1000.0/stats->gpuTimerFreq;
const double toCpuMs = 1000.0/double(stats->cpuTimerFreq);
const double toGpuMs = 1000.0/double(stats->gpuTimerFreq);
const float scale = 3.0f;
while (clipper.Step() )

View File

@@ -7611,7 +7611,7 @@ namespace bgfx { namespace gl
m_gpuTimer.end(frameQueryIdx);
const TimerQueryGL::Result& result = m_gpuTimer.m_result[BGFX_CONFIG_MAX_VIEWS];
double toGpuMs = 1000.0 / 1e6;
double toGpuMs = 1000.0 / 1e9;
elapsedGpuMs = (result.m_end - result.m_begin) * toGpuMs;
maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed;