mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-20 22:03:12 +01:00
Fixed CPU timer.
This commit is contained in:
@@ -3639,7 +3639,7 @@ VK_DESTROY
|
||||
|
||||
updateResolution(_render->m_resolution);
|
||||
|
||||
int64_t elapsed = -bx::getHPCounter();
|
||||
int64_t timeBegin = bx::getHPCounter();
|
||||
int64_t captureElapsed = 0;
|
||||
|
||||
// m_gpuTimer.begin(m_commandList);
|
||||
@@ -4355,16 +4355,8 @@ BX_UNUSED(currentSamplerStateIdx);
|
||||
// m_batch.end(m_commandList);
|
||||
}
|
||||
|
||||
int64_t now = bx::getHPCounter();
|
||||
elapsed += now;
|
||||
|
||||
static int64_t last = now;
|
||||
|
||||
Stats& perfStats = _render->m_perfStats;
|
||||
perfStats.cpuTimeBegin = last;
|
||||
|
||||
int64_t frameTime = now - last;
|
||||
last = now;
|
||||
int64_t timeEnd = bx::getHPCounter();
|
||||
int64_t frameTime = timeEnd - timeBegin;
|
||||
|
||||
static int64_t min = frameTime;
|
||||
static int64_t max = frameTime;
|
||||
@@ -4394,7 +4386,9 @@ BX_UNUSED(presentMin, presentMax);
|
||||
|
||||
const int64_t timerFreq = bx::getHPFrequency();
|
||||
|
||||
perfStats.cpuTimeEnd = now;
|
||||
Stats& perfStats = _render->m_perfStats;
|
||||
perfStats.cpuTimeBegin = timeBegin;
|
||||
perfStats.cpuTimeEnd = timeEnd;
|
||||
perfStats.cpuTimerFreq = timerFreq;
|
||||
// perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
|
||||
// perfStats.gpuTimeEnd = m_gpuTimer.m_end;
|
||||
@@ -4410,12 +4404,13 @@ BX_UNUSED(presentMin, presentMax);
|
||||
// m_needPresent = true;
|
||||
TextVideoMem& tvm = m_textVideoMem;
|
||||
|
||||
static int64_t next = now;
|
||||
static int64_t next = timeEnd;
|
||||
|
||||
if (now >= next)
|
||||
if (timeEnd >= next)
|
||||
{
|
||||
next = now + bx::getHPFrequency();
|
||||
double freq = double(bx::getHPFrequency() );
|
||||
next = timeEnd + timerFreq;
|
||||
|
||||
double freq = double(timerFreq);
|
||||
double toMs = 1000.0 / freq;
|
||||
|
||||
tvm.clear();
|
||||
@@ -4496,7 +4491,7 @@ BX_UNUSED(presentMin, presentMax);
|
||||
, !!(m_resolution.m_flags&BGFX_RESET_MAXANISOTROPY) ? '\xfe' : ' '
|
||||
);
|
||||
|
||||
double elapsedCpuMs = double(elapsed)*toMs;
|
||||
double elapsedCpuMs = double(timeBegin)*toMs;
|
||||
tvm.printf(10, pos++, 0x8e, " Submitted: %5d (draw %5d, compute %4d) / CPU %7.4f [ms] "
|
||||
, _render->m_num
|
||||
, statsKeyType[0]
|
||||
|
||||
Reference in New Issue
Block a user