mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Cleanup.
This commit is contained in:
parent
21e78cf7b0
commit
e21e840001
4 changed files with 48 additions and 22 deletions
|
@ -91,8 +91,8 @@ struct AviWriter
|
||||||
bx::write(&m_writer, UINT16_C(0) ); // wPriority
|
bx::write(&m_writer, UINT16_C(0) ); // wPriority
|
||||||
bx::write(&m_writer, UINT16_C(0) ); // wLanguage
|
bx::write(&m_writer, UINT16_C(0) ); // wLanguage
|
||||||
bx::write(&m_writer, UINT32_C(0) ); // dwInitialFrames
|
bx::write(&m_writer, UINT32_C(0) ); // dwInitialFrames
|
||||||
bx::write(&m_writer, UINT32_C(1000) ); // dwScale
|
bx::write(&m_writer, UINT32_C(1) ); // dwScale
|
||||||
bx::write(&m_writer, 1000*_fps); // dwRate
|
bx::write(&m_writer, _fps); // dwRate
|
||||||
bx::write(&m_writer, UINT32_C(0) ); // dwStart
|
bx::write(&m_writer, UINT32_C(0) ); // dwStart
|
||||||
|
|
||||||
m_lengthOffset = m_writer.seek();
|
m_lengthOffset = m_writer.seek();
|
||||||
|
@ -137,19 +137,24 @@ struct AviWriter
|
||||||
{
|
{
|
||||||
int64_t pos = m_writer.seek();
|
int64_t pos = m_writer.seek();
|
||||||
m_writer.seek(m_moviListOffset, bx::Whence::Begin);
|
m_writer.seek(m_moviListOffset, bx::Whence::Begin);
|
||||||
bx::write(&m_writer, uint32_t(pos-m_moviListOffset+4) );
|
bx::write(&m_writer, uint32_t(pos-m_moviListOffset-4) );
|
||||||
m_writer.seek(pos, bx::Whence::Begin);
|
m_writer.seek(pos, bx::Whence::Begin);
|
||||||
|
|
||||||
bx::write(&m_writer, BX_MAKEFOURCC('i', 'd', 'x', '1') );
|
bx::write(&m_writer, BX_MAKEFOURCC('i', 'd', 'x', '1') );
|
||||||
bx::write(&m_writer, UINT32_C(16) );
|
bx::write(&m_writer, m_numFrames*16);
|
||||||
|
|
||||||
|
for (uint32_t ii = 0, offset = 4; ii < m_numFrames; ++ii)
|
||||||
|
{
|
||||||
bx::write(&m_writer, BX_MAKEFOURCC('0', '0', 'd', 'b') );
|
bx::write(&m_writer, BX_MAKEFOURCC('0', '0', 'd', 'b') );
|
||||||
bx::write(&m_writer, UINT32_C(16) );
|
bx::write(&m_writer, UINT32_C(16) );
|
||||||
bx::write(&m_writer, UINT32_C(4) );
|
bx::write(&m_writer, offset);
|
||||||
bx::write(&m_writer, m_frameSize);
|
bx::write(&m_writer, m_frameSize);
|
||||||
|
offset += m_frameSize + 8;
|
||||||
|
}
|
||||||
|
|
||||||
pos = m_writer.seek();
|
pos = m_writer.seek();
|
||||||
m_writer.seek(m_riffSizeOffset, bx::Whence::Begin);
|
m_writer.seek(m_riffSizeOffset, bx::Whence::Begin);
|
||||||
bx::write(&m_writer, uint32_t(pos-m_riffSizeOffset+4) );
|
bx::write(&m_writer, uint32_t(pos-m_riffSizeOffset-4) );
|
||||||
|
|
||||||
m_writer.seek(m_totalFramesOffset, bx::Whence::Begin);
|
m_writer.seek(m_totalFramesOffset, bx::Whence::Begin);
|
||||||
bx::write(&m_writer, m_numFrames);
|
bx::write(&m_writer, m_numFrames);
|
||||||
|
|
|
@ -1924,6 +1924,9 @@ namespace bgfx
|
||||||
|
|
||||||
s_renderCtx.updateResolution(m_render->m_resolution);
|
s_renderCtx.updateResolution(m_render->m_resolution);
|
||||||
|
|
||||||
|
int64_t elapsed = -bx::getHPCounter();
|
||||||
|
int64_t captureElapsed = 0;
|
||||||
|
|
||||||
if (0 < m_render->m_iboffset)
|
if (0 < m_render->m_iboffset)
|
||||||
{
|
{
|
||||||
TransientIndexBuffer* ib = m_render->m_transientIb;
|
TransientIndexBuffer* ib = m_render->m_transientIb;
|
||||||
|
@ -1966,8 +1969,6 @@ namespace bgfx
|
||||||
uint32_t statsNumInstances = 0;
|
uint32_t statsNumInstances = 0;
|
||||||
uint32_t statsNumPrimsRendered = 0;
|
uint32_t statsNumPrimsRendered = 0;
|
||||||
|
|
||||||
int64_t elapsed = -bx::getHPCounter();
|
|
||||||
|
|
||||||
if (0 == (m_render->m_debug&BGFX_DEBUG_IFH) )
|
if (0 == (m_render->m_debug&BGFX_DEBUG_IFH) )
|
||||||
{
|
{
|
||||||
for (uint32_t item = 0, numItems = m_render->m_num; item < numItems; ++item)
|
for (uint32_t item = 0, numItems = m_render->m_num; item < numItems; ++item)
|
||||||
|
@ -2380,6 +2381,13 @@ namespace bgfx
|
||||||
statsNumPrimsRendered += numPrimsRendered;
|
statsNumPrimsRendered += numPrimsRendered;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (0 < m_render->m_num)
|
||||||
|
{
|
||||||
|
captureElapsed = -bx::getHPCounter();
|
||||||
|
s_renderCtx.capture();
|
||||||
|
captureElapsed += bx::getHPCounter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t now = bx::getHPCounter();
|
int64_t now = bx::getHPCounter();
|
||||||
|
@ -2407,7 +2415,6 @@ namespace bgfx
|
||||||
next = now + bx::getHPFrequency();
|
next = now + bx::getHPFrequency();
|
||||||
double freq = double(bx::getHPFrequency() );
|
double freq = double(bx::getHPFrequency() );
|
||||||
double toMs = 1000.0/freq;
|
double toMs = 1000.0/freq;
|
||||||
double elapsedCpuMs = double(elapsed)*toMs;
|
|
||||||
|
|
||||||
tvm.clear();
|
tvm.clear();
|
||||||
uint16_t pos = 10;
|
uint16_t pos = 10;
|
||||||
|
@ -2418,6 +2425,8 @@ namespace bgfx
|
||||||
, double(max)*toMs
|
, double(max)*toMs
|
||||||
, freq/frameTime
|
, freq/frameTime
|
||||||
);
|
);
|
||||||
|
|
||||||
|
double elapsedCpuMs = double(elapsed)*toMs;
|
||||||
tvm.printf(10, pos++, 0x8e, " Draw calls: %4d / CPU %3.4f [ms]"
|
tvm.printf(10, pos++, 0x8e, " Draw calls: %4d / CPU %3.4f [ms]"
|
||||||
, m_render->m_num
|
, m_render->m_num
|
||||||
, elapsedCpuMs
|
, elapsedCpuMs
|
||||||
|
@ -2427,6 +2436,9 @@ namespace bgfx
|
||||||
, statsNumInstances
|
, statsNumInstances
|
||||||
, statsNumPrimsSubmitted
|
, statsNumPrimsSubmitted
|
||||||
);
|
);
|
||||||
|
|
||||||
|
double captureMs = double(captureElapsed)*toMs;
|
||||||
|
tvm.printf(10, pos++, 0x8e, " Capture: %3.4f [ms]", captureMs);
|
||||||
tvm.printf(10, pos++, 0x8e, " Indices: %7d", statsNumIndices);
|
tvm.printf(10, pos++, 0x8e, " Indices: %7d", statsNumIndices);
|
||||||
tvm.printf(10, pos++, 0x8e, " DVB size: %7d", m_render->m_vboffset);
|
tvm.printf(10, pos++, 0x8e, " DVB size: %7d", m_render->m_vboffset);
|
||||||
tvm.printf(10, pos++, 0x8e, " DIB size: %7d", m_render->m_iboffset);
|
tvm.printf(10, pos++, 0x8e, " DIB size: %7d", m_render->m_iboffset);
|
||||||
|
|
|
@ -1997,6 +1997,9 @@ namespace bgfx
|
||||||
|
|
||||||
s_renderCtx.updateResolution(m_render->m_resolution);
|
s_renderCtx.updateResolution(m_render->m_resolution);
|
||||||
|
|
||||||
|
int64_t elapsed = -bx::getHPCounter();
|
||||||
|
int64_t captureElapsed = 0;
|
||||||
|
|
||||||
device->BeginScene();
|
device->BeginScene();
|
||||||
|
|
||||||
if (0 < m_render->m_iboffset)
|
if (0 < m_render->m_iboffset)
|
||||||
|
@ -2038,8 +2041,6 @@ namespace bgfx
|
||||||
uint32_t statsNumInstances = 0;
|
uint32_t statsNumInstances = 0;
|
||||||
uint32_t statsNumPrimsRendered = 0;
|
uint32_t statsNumPrimsRendered = 0;
|
||||||
|
|
||||||
int64_t elapsed = -bx::getHPCounter();
|
|
||||||
|
|
||||||
if (0 == (m_render->m_debug&BGFX_DEBUG_IFH) )
|
if (0 == (m_render->m_debug&BGFX_DEBUG_IFH) )
|
||||||
{
|
{
|
||||||
for (uint32_t item = 0, numItems = m_render->m_num; item < numItems; ++item)
|
for (uint32_t item = 0, numItems = m_render->m_num; item < numItems; ++item)
|
||||||
|
@ -2586,15 +2587,18 @@ namespace bgfx
|
||||||
}
|
}
|
||||||
|
|
||||||
PIX_ENDEVENT();
|
PIX_ENDEVENT();
|
||||||
|
|
||||||
|
if (0 < m_render->m_num)
|
||||||
|
{
|
||||||
|
captureElapsed = -bx::getHPCounter();
|
||||||
|
s_renderCtx.capture();
|
||||||
|
captureElapsed += bx::getHPCounter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t now = bx::getHPCounter();
|
int64_t now = bx::getHPCounter();
|
||||||
elapsed += now;
|
elapsed += now;
|
||||||
|
|
||||||
int64_t captureElapsed = -bx::getHPCounter();
|
|
||||||
s_renderCtx.capture();
|
|
||||||
captureElapsed += bx::getHPCounter();
|
|
||||||
|
|
||||||
static int64_t last = now;
|
static int64_t last = now;
|
||||||
int64_t frameTime = now - last;
|
int64_t frameTime = now - last;
|
||||||
last = now;
|
last = now;
|
||||||
|
|
|
@ -2352,6 +2352,8 @@ namespace bgfx
|
||||||
s_renderCtx.updateResolution(m_render->m_resolution);
|
s_renderCtx.updateResolution(m_render->m_resolution);
|
||||||
|
|
||||||
int64_t elapsed = -bx::getHPCounter();
|
int64_t elapsed = -bx::getHPCounter();
|
||||||
|
int64_t captureElapsed = 0;
|
||||||
|
|
||||||
#if BGFX_CONFIG_RENDERER_OPENGL
|
#if BGFX_CONFIG_RENDERER_OPENGL
|
||||||
if (m_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
|
if (m_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
|
||||||
{
|
{
|
||||||
|
@ -2972,15 +2974,18 @@ namespace bgfx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (0 < m_render->m_num)
|
||||||
|
{
|
||||||
|
captureElapsed = -bx::getHPCounter();
|
||||||
|
s_renderCtx.capture();
|
||||||
|
captureElapsed += bx::getHPCounter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t now = bx::getHPCounter();
|
int64_t now = bx::getHPCounter();
|
||||||
elapsed += now;
|
elapsed += now;
|
||||||
|
|
||||||
int64_t captureElapsed = -bx::getHPCounter();
|
|
||||||
s_renderCtx.capture();
|
|
||||||
captureElapsed += bx::getHPCounter();
|
|
||||||
|
|
||||||
static int64_t last = now;
|
static int64_t last = now;
|
||||||
int64_t frameTime = now - last;
|
int64_t frameTime = now - last;
|
||||||
last = now;
|
last = now;
|
||||||
|
|
Loading…
Reference in a new issue