|
|
@@ -626,6 +626,8 @@ namespace bgfx { namespace d3d12
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
|
+ m_presentElapsed = 0;
|
|
|
+
|
|
|
{
|
|
|
m_resolution.m_width = BGFX_DEFAULT_WIDTH;
|
|
|
m_resolution.m_height = BGFX_DEFAULT_HEIGHT;
|
|
|
@@ -923,7 +925,7 @@ namespace bgfx { namespace d3d12
|
|
|
{
|
|
|
if (NULL != m_swapChain)
|
|
|
{
|
|
|
- int64_t elapsed = -bx::getHPCounter();
|
|
|
+ int64_t start = bx::getHPCounter();
|
|
|
|
|
|
HRESULT hr = 0;
|
|
|
uint32_t syncInterval = !!(m_flags & BGFX_RESET_VSYNC);
|
|
|
@@ -939,14 +941,7 @@ namespace bgfx { namespace d3d12
|
|
|
}
|
|
|
|
|
|
int64_t now = bx::getHPCounter();
|
|
|
- elapsed += now;
|
|
|
-
|
|
|
- double freq = double(bx::getHPFrequency() );
|
|
|
- double toMs = 1000.0 / freq;
|
|
|
- double elapsedCpuMs = double(elapsed)*toMs;
|
|
|
- BX_UNUSED(elapsedCpuMs);
|
|
|
-
|
|
|
- //BX_TRACE("%f ms", elapsedCpuMs);
|
|
|
+ m_presentElapsed = now - start;
|
|
|
|
|
|
if (FAILED(hr)
|
|
|
&& isLost(hr) )
|
|
|
@@ -2262,6 +2257,7 @@ data.NumQualityLevels = 0;
|
|
|
IDXGIFactory1* m_factory;
|
|
|
|
|
|
IDXGISwapChain* m_swapChain;
|
|
|
+ int64_t m_presentElapsed;
|
|
|
uint16_t m_lost;
|
|
|
uint16_t m_numWindows;
|
|
|
FrameBufferHandle m_windows[BGFX_CONFIG_MAX_FRAME_BUFFERS];
|
|
|
@@ -4003,8 +3999,13 @@ data.NumQualityLevels = 0;
|
|
|
|
|
|
static int64_t min = frameTime;
|
|
|
static int64_t max = frameTime;
|
|
|
- min = min > frameTime ? frameTime : min;
|
|
|
- max = max < frameTime ? frameTime : max;
|
|
|
+ min = bx::int64_min(min, frameTime);
|
|
|
+ max = bx::int64_max(max, frameTime);
|
|
|
+
|
|
|
+ static int64_t presentMin = m_presentElapsed;
|
|
|
+ static int64_t presentMax = m_presentElapsed;
|
|
|
+ presentMin = bx::int64_min(presentMin, m_presentElapsed);
|
|
|
+ presentMax = bx::int64_max(presentMax, m_presentElapsed);
|
|
|
|
|
|
if (_render->m_debug & (BGFX_DEBUG_IFH | BGFX_DEBUG_STATS) )
|
|
|
{
|
|
|
@@ -4048,12 +4049,17 @@ data.NumQualityLevels = 0;
|
|
|
);
|
|
|
|
|
|
pos = 10;
|
|
|
- tvm.printf(10, pos++, 0x8e, " Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS "
|
|
|
+ tvm.printf(10, pos++, 0x8e, " Frame: % 7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS"
|
|
|
, double(frameTime)*toMs
|
|
|
, double(min)*toMs
|
|
|
, double(max)*toMs
|
|
|
, freq/frameTime
|
|
|
);
|
|
|
+ tvm.printf(10, pos++, 0x8e, " Present: % 7.3f, % 7.3f \x1f, % 7.3f \x1e [ms]"
|
|
|
+ , double(m_presentElapsed)*toMs
|
|
|
+ , double(presentMin)*toMs
|
|
|
+ , double(presentMax)*toMs
|
|
|
+ );
|
|
|
|
|
|
char hmd[16];
|
|
|
bx::snprintf(hmd, BX_COUNTOF(hmd), ", [%c] HMD ", hmdEnabled ? '\xfe' : ' ');
|