Replaced bgfx::setProgram function with bgfx::submit argument. Added bgfx::touch and bgfx::getStats.

This commit is contained in:
Branimir Karadžić
2015-07-22 18:05:11 -07:00
parent 6bdf5c4bad
commit 1fa85ccf27
39 changed files with 320 additions and 360 deletions

View File

@@ -3653,10 +3653,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
int64_t elapsed = -bx::getHPCounter();
int64_t captureElapsed = 0;
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{
m_gpuTimer.begin();
}
m_gpuTimer.begin();
if (0 < _render->m_iboffset)
{
@@ -4442,31 +4439,39 @@ BX_PRAGMA_DIAGNOSTIC_POP();
min = min > frameTime ? frameTime : min;
max = max < frameTime ? frameTime : max;
static uint32_t maxGpuLatency = 0;
static double maxGpuElapsed = 0.0f;
double elapsedGpuMs = 0.0;
m_gpuTimer.end();
while (m_gpuTimer.get() )
{
double toGpuMs = 1000.0 / double(m_gpuTimer.m_frequency);
elapsedGpuMs = m_gpuTimer.m_elapsed * toGpuMs;
maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed;
}
maxGpuLatency = bx::uint32_imax(maxGpuLatency, m_gpuTimer.m_control.available()-1);
const int64_t timerFreq = bx::getHPFrequency();
Stats& perfStats = _render->m_perfStats;
perfStats.cpuTime = frameTime;
perfStats.cpuTimerFreq = timerFreq;
perfStats.gpuTime = m_gpuTimer.m_elapsed;
perfStats.gpuTimerFreq = m_gpuTimer.m_frequency;
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
static uint32_t maxGpuLatency = 0;
static double maxGpuElapsed = 0.0f;
double elapsedGpuMs = 0.0;
m_gpuTimer.end();
while (m_gpuTimer.get() )
{
double toGpuMs = 1000.0 / double(m_gpuTimer.m_frequency);
elapsedGpuMs = m_gpuTimer.m_elapsed * toGpuMs;
maxGpuElapsed = elapsedGpuMs > maxGpuElapsed ? elapsedGpuMs : maxGpuElapsed;
}
maxGpuLatency = bx::uint32_imax(maxGpuLatency, m_gpuTimer.m_control.available()-1);
TextVideoMem& tvm = m_textVideoMem;
static int64_t next = now;
if (now >= next)
{
next = now + bx::getHPFrequency();
next = now + timerFreq;
double freq = double(bx::getHPFrequency() );
double toMs = 1000.0/freq;