mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Record frame num in view stats (#2908)
* Add 'frameNumber' to Frame struct Previously, the frame number returned from bgfx::frame() was tracked separately in the Context. Now, we store that information in the Frame. This will allow us to attach the frame number to ViewStats. * Add frame number to ViewStats When ViewStats are enabled, we tag each timer query with the current frame number, then include that information in the final results. In this way, clients can correlate specific work that they submitted to specific GPU timing information. NOTE: Some backends not implemented, yet. They will always have 0 for frame number. The ones which are implemented are: * OpenGL * Vulkan * D3D 9,11,12 * Noop
This commit is contained in:
12
src/bgfx_p.h
12
src/bgfx_p.h
@@ -2076,6 +2076,7 @@ namespace bgfx
|
||||
Frame()
|
||||
: m_waitSubmit(0)
|
||||
, m_waitRender(0)
|
||||
, m_frameNum(0)
|
||||
, m_capture(false)
|
||||
{
|
||||
SortKey term;
|
||||
@@ -2109,7 +2110,7 @@ namespace bgfx
|
||||
}
|
||||
|
||||
reset();
|
||||
start();
|
||||
start(0);
|
||||
m_textVideoMem = BX_NEW(g_allocator, TextVideoMem);
|
||||
}
|
||||
|
||||
@@ -2126,12 +2127,12 @@ namespace bgfx
|
||||
|
||||
void reset()
|
||||
{
|
||||
start();
|
||||
start(0);
|
||||
finish();
|
||||
resetFreeHandles();
|
||||
}
|
||||
|
||||
void start()
|
||||
void start(uint32_t frameNum)
|
||||
{
|
||||
m_perfStats.transientVbUsed = m_vboffset;
|
||||
m_perfStats.transientIbUsed = m_iboffset;
|
||||
@@ -2145,6 +2146,7 @@ namespace bgfx
|
||||
m_cmdPost.start();
|
||||
m_capture = false;
|
||||
m_numScreenShots = 0;
|
||||
m_frameNum = frameNum;
|
||||
}
|
||||
|
||||
void finish()
|
||||
@@ -2353,6 +2355,8 @@ namespace bgfx
|
||||
int64_t m_waitSubmit;
|
||||
int64_t m_waitRender;
|
||||
|
||||
uint32_t m_frameNum;
|
||||
|
||||
bool m_capture;
|
||||
};
|
||||
|
||||
@@ -4523,7 +4527,7 @@ namespace bgfx
|
||||
cmdbuf.write(_handle);
|
||||
cmdbuf.write(_data);
|
||||
cmdbuf.write(_mip);
|
||||
return m_frames + 2;
|
||||
return m_submit->m_frameNum + 2;
|
||||
}
|
||||
|
||||
void resizeTexture(TextureHandle _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, uint16_t _numLayers)
|
||||
|
||||
Reference in New Issue
Block a user