mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Cleanup.
This commit is contained in:
parent
9238fad658
commit
91ac245fd5
1 changed files with 26 additions and 20 deletions
|
@ -626,6 +626,8 @@ namespace bgfx { namespace d3d12
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_presentElapsed = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
m_resolution.m_width = BGFX_DEFAULT_WIDTH;
|
m_resolution.m_width = BGFX_DEFAULT_WIDTH;
|
||||||
m_resolution.m_height = BGFX_DEFAULT_HEIGHT;
|
m_resolution.m_height = BGFX_DEFAULT_HEIGHT;
|
||||||
|
@ -923,7 +925,7 @@ namespace bgfx { namespace d3d12
|
||||||
{
|
{
|
||||||
if (NULL != m_swapChain)
|
if (NULL != m_swapChain)
|
||||||
{
|
{
|
||||||
int64_t elapsed = -bx::getHPCounter();
|
int64_t start = bx::getHPCounter();
|
||||||
|
|
||||||
HRESULT hr = 0;
|
HRESULT hr = 0;
|
||||||
uint32_t syncInterval = !!(m_flags & BGFX_RESET_VSYNC);
|
uint32_t syncInterval = !!(m_flags & BGFX_RESET_VSYNC);
|
||||||
|
@ -939,14 +941,7 @@ namespace bgfx { namespace d3d12
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t now = bx::getHPCounter();
|
int64_t now = bx::getHPCounter();
|
||||||
elapsed += now;
|
m_presentElapsed = now - start;
|
||||||
|
|
||||||
double freq = double(bx::getHPFrequency() );
|
|
||||||
double toMs = 1000.0 / freq;
|
|
||||||
double elapsedCpuMs = double(elapsed)*toMs;
|
|
||||||
BX_UNUSED(elapsedCpuMs);
|
|
||||||
|
|
||||||
//BX_TRACE("%f ms", elapsedCpuMs);
|
|
||||||
|
|
||||||
if (FAILED(hr)
|
if (FAILED(hr)
|
||||||
&& isLost(hr) )
|
&& isLost(hr) )
|
||||||
|
@ -2262,6 +2257,7 @@ data.NumQualityLevels = 0;
|
||||||
IDXGIFactory1* m_factory;
|
IDXGIFactory1* m_factory;
|
||||||
|
|
||||||
IDXGISwapChain* m_swapChain;
|
IDXGISwapChain* m_swapChain;
|
||||||
|
int64_t m_presentElapsed;
|
||||||
uint16_t m_lost;
|
uint16_t m_lost;
|
||||||
uint16_t m_numWindows;
|
uint16_t m_numWindows;
|
||||||
FrameBufferHandle m_windows[BGFX_CONFIG_MAX_FRAME_BUFFERS];
|
FrameBufferHandle m_windows[BGFX_CONFIG_MAX_FRAME_BUFFERS];
|
||||||
|
@ -4003,8 +3999,13 @@ data.NumQualityLevels = 0;
|
||||||
|
|
||||||
static int64_t min = frameTime;
|
static int64_t min = frameTime;
|
||||||
static int64_t max = frameTime;
|
static int64_t max = frameTime;
|
||||||
min = min > frameTime ? frameTime : min;
|
min = bx::int64_min(min, frameTime);
|
||||||
max = max < frameTime ? frameTime : max;
|
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) )
|
if (_render->m_debug & (BGFX_DEBUG_IFH | BGFX_DEBUG_STATS) )
|
||||||
{
|
{
|
||||||
|
@ -4054,6 +4055,11 @@ data.NumQualityLevels = 0;
|
||||||
, double(max)*toMs
|
, double(max)*toMs
|
||||||
, freq/frameTime
|
, 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];
|
char hmd[16];
|
||||||
bx::snprintf(hmd, BX_COUNTOF(hmd), ", [%c] HMD ", hmdEnabled ? '\xfe' : ' ');
|
bx::snprintf(hmd, BX_COUNTOF(hmd), ", [%c] HMD ", hmdEnabled ? '\xfe' : ' ');
|
||||||
|
|
Loading…
Reference in a new issue