Added resource stats.

This commit is contained in:
Branimir Karadžić 2017-12-03 19:42:06 -08:00
parent c1ffcf65c0
commit 6adb0090d0
5 changed files with 83 additions and 24 deletions

View File

@ -151,6 +151,8 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText)
const char* items[bgfx::RendererType::Count];
int32_t current = 0;
for (uint8_t ii = 0; ii < num; ++ii)
{
items[ii] = bgfx::getRendererName(supportedRenderers[ii]);
@ -218,6 +220,26 @@ void showExampleDialog(entry::AppI* _app, const char* _errorText)
ImGui::Text("GPU mem: %s / %s", tmp0, tmp1);
}
if (ImGui::CollapsingHeader("Resources") )
{
const bgfx::Caps* caps = bgfx::getCaps();
ImGui::PushFont(ImGui::Font::Mono);
ImGui::Text("Res: Num / Max");
ImGui::Text("DIB: %4d / %4d", stats->numDynamicIndexBuffers, caps->limits.maxDynamicIndexBuffers);
ImGui::Text("DVB: %4d / %4d", stats->numDynamicVertexBuffers, caps->limits.maxDynamicVertexBuffers);
ImGui::Text(" FB: %4d / %4d", stats->numFrameBuffers, caps->limits.maxFrameBuffers);
ImGui::Text(" IB: %4d / %4d", stats->numIndexBuffers, caps->limits.maxIndexBuffers);
ImGui::Text(" OQ: %4d / %4d", stats->numOcclusionQueries, caps->limits.maxOcclusionQueries);
ImGui::Text(" P: %4d / %4d", stats->numPrograms, caps->limits.maxPrograms);
ImGui::Text(" S: %4d / %4d", stats->numShaders, caps->limits.maxShaders);
ImGui::Text(" T: %4d / %4d", stats->numTextures, caps->limits.maxTextures);
ImGui::Text(" U: %4d / %4d", stats->numUniforms, caps->limits.maxUniforms);
ImGui::Text(" VB: %4d / %4d", stats->numVertexBuffers, caps->limits.maxVertexBuffers);
ImGui::Text(" VD: %4d / %4d", stats->numVertexDecls, caps->limits.maxVertexDecls);
ImGui::PopFont();
}
if (0 != stats->numViews)
{
if (ImGui::CollapsingHeader(ICON_FA_CLOCK_O " Profiler") )

View File

@ -822,6 +822,18 @@ namespace bgfx
uint32_t numCompute; //!< Number of compute calls submitted.
uint32_t maxGpuLatency; //!< GPU driver latency.
uint16_t numDynamicIndexBuffers; //!<
uint16_t numDynamicVertexBuffers; //!<
uint16_t numFrameBuffers; //!<
uint16_t numIndexBuffers; //!<
uint16_t numOcclusionQueries; //!<
uint16_t numPrograms; //!<
uint16_t numShaders; //!<
uint16_t numTextures; //!<
uint16_t numUniforms; //!<
uint16_t numVertexBuffers; //!<
uint16_t numVertexDecls; //!<
int64_t gpuMemoryMax; //!< Maximum available GPU memory for application.
int64_t gpuMemoryUsed; //!< Amount of GPU memory used.

View File

@ -374,6 +374,18 @@ typedef struct bgfx_stats
uint32_t numCompute;
uint32_t maxGpuLatency;
uint16_t numDynamicIndexBuffers;
uint16_t numDynamicVertexBuffers;
uint16_t numFrameBuffers;
uint16_t numIndexBuffers;
uint16_t numOcclusionQueries;
uint16_t numPrograms;
uint16_t numShaders;
uint16_t numTextures;
uint16_t numUniforms;
uint16_t numVertexBuffers;
uint16_t numVertexDecls;
int64_t gpuMemoryMax;
int64_t gpuMemoryUsed;

View File

@ -6,7 +6,7 @@
#ifndef BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_DEFINES_H_HEADER_GUARD
#define BGFX_API_VERSION UINT32_C(58)
#define BGFX_API_VERSION UINT32_C(59)
/// Color RGB/alpha/depth write. When it's not specified write will be disabled.
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.

View File

@ -2722,6 +2722,19 @@ namespace bgfx
stats.textWidth = tvm->m_width;
stats.textHeight = tvm->m_height;
stats.encoderStats = m_encoderStats;
stats.numDynamicIndexBuffers = m_dynamicIndexBufferHandle.getNumHandles();
stats.numDynamicVertexBuffers = m_dynamicVertexBufferHandle.getNumHandles();
stats.numFrameBuffers = m_frameBufferHandle.getNumHandles();
stats.numIndexBuffers = m_indexBufferHandle.getNumHandles();
stats.numOcclusionQueries = m_occlusionQueryHandle.getNumHandles();
stats.numPrograms = m_programHandle.getNumHandles();
stats.numShaders = m_shaderHandle.getNumHandles();
stats.numTextures = m_textureHandle.getNumHandles();
stats.numUniforms = m_uniformHandle.getNumHandles();
stats.numVertexBuffers = m_vertexBufferHandle.getNumHandles();
stats.numVertexDecls = m_vertexDeclHandle.getNumHandles();
return &stats;
}