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:
@@ -2189,6 +2189,7 @@ public static class bgfx
|
||||
public int64 cpuTimeEnd;
|
||||
public int64 gpuTimeBegin;
|
||||
public int64 gpuTimeEnd;
|
||||
public uint32 gpuFrameNum;
|
||||
}
|
||||
|
||||
[CRepr]
|
||||
@@ -2214,6 +2215,7 @@ public static class bgfx
|
||||
public uint32 numCompute;
|
||||
public uint32 numBlit;
|
||||
public uint32 maxGpuLatency;
|
||||
public uint32 gpuFrameNum;
|
||||
public uint16 numDynamicIndexBuffers;
|
||||
public uint16 numDynamicVertexBuffers;
|
||||
public uint16 numFrameBuffers;
|
||||
|
||||
@@ -2157,6 +2157,7 @@ public static partial class bgfx
|
||||
public long cpuTimeEnd;
|
||||
public long gpuTimeBegin;
|
||||
public long gpuTimeEnd;
|
||||
public uint gpuFrameNum;
|
||||
}
|
||||
|
||||
public unsafe struct EncoderStats
|
||||
@@ -2180,6 +2181,7 @@ public static partial class bgfx
|
||||
public uint numCompute;
|
||||
public uint numBlit;
|
||||
public uint maxGpuLatency;
|
||||
public uint gpuFrameNum;
|
||||
public ushort numDynamicIndexBuffers;
|
||||
public ushort numDynamicVertexBuffers;
|
||||
public ushort numFrameBuffers;
|
||||
|
||||
@@ -1030,6 +1030,7 @@ struct bgfx_view_stats_t
|
||||
long cpuTimeEnd; /// CPU (submit) end time.
|
||||
long gpuTimeBegin; /// GPU begin time.
|
||||
long gpuTimeEnd; /// GPU end time.
|
||||
uint gpuFrameNum; /// Frame which generated gpuTimeBegin, gpuTimeEnd.
|
||||
}
|
||||
|
||||
/// Encoder stats.
|
||||
@@ -1059,6 +1060,7 @@ struct bgfx_stats_t
|
||||
uint numCompute; /// Number of compute calls submitted.
|
||||
uint numBlit; /// Number of blit calls submitted.
|
||||
uint maxGpuLatency; /// GPU driver latency.
|
||||
uint gpuFrameNum; /// Frame which generated gpuTimeBegin, gpuTimeEnd.
|
||||
ushort numDynamicIndexBuffers; /// Number of used dynamic index buffers.
|
||||
ushort numDynamicVertexBuffers; /// Number of used dynamic vertex buffers.
|
||||
ushort numFrameBuffers; /// Number of used frame buffers.
|
||||
|
||||
@@ -1417,6 +1417,7 @@ pub const Init = extern struct {
|
||||
cpuTimeEnd: i64,
|
||||
gpuTimeBegin: i64,
|
||||
gpuTimeEnd: i64,
|
||||
gpuFrameNum: u32,
|
||||
};
|
||||
|
||||
pub const EncoderStats = extern struct {
|
||||
@@ -1438,6 +1439,7 @@ pub const Init = extern struct {
|
||||
numCompute: u32,
|
||||
numBlit: u32,
|
||||
maxGpuLatency: u32,
|
||||
gpuFrameNum: u32,
|
||||
numDynamicIndexBuffers: u16,
|
||||
numDynamicVertexBuffers: u16,
|
||||
numFrameBuffers: u16,
|
||||
|
||||
Reference in New Issue
Block a user