Added state cache info to debug panel.

This commit is contained in:
Branimir Karadžić 2014-10-05 00:14:21 -07:00
parent a24cae4254
commit a05acba1ee
5 changed files with 47 additions and 6 deletions

View file

@ -31,7 +31,7 @@ namespace bgfx
{ D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, 3, 1, 2 }, { D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, 3, 1, 2 },
{ D3D11_PRIMITIVE_TOPOLOGY_LINELIST, 2, 2, 0 }, { D3D11_PRIMITIVE_TOPOLOGY_LINELIST, 2, 2, 0 },
{ D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, 1, 1, 0 }, { D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, 1, 1, 0 },
{ D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED, 0, 0, 0 }, { D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED, 0, 0, 0 },
}; };
static const char* s_primName[] = static const char* s_primName[] =
@ -267,7 +267,7 @@ namespace bgfx
}; };
BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attrib) ); BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attrib) );
static const DXGI_FORMAT s_attribType[AttribType::Count][4][2] = static const DXGI_FORMAT s_attribType[][4][2] =
{ {
{ {
{ DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_UNORM }, { DXGI_FORMAT_R8_UINT, DXGI_FORMAT_R8_UNORM },
@ -294,6 +294,7 @@ namespace bgfx
{ DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT }, { DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT },
}, },
}; };
BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) );
static D3D11_INPUT_ELEMENT_DESC* fillVertexDecl(D3D11_INPUT_ELEMENT_DESC* _out, const VertexDecl& _decl) static D3D11_INPUT_ELEMENT_DESC* fillVertexDecl(D3D11_INPUT_ELEMENT_DESC* _out, const VertexDecl& _decl)
{ {
@ -3545,6 +3546,18 @@ RENDERDOC_IMPORT
tvm.printf(10, pos++, 0x8e, " DVB size: %7d", _render->m_vboffset); tvm.printf(10, pos++, 0x8e, " DVB size: %7d", _render->m_vboffset);
tvm.printf(10, pos++, 0x8e, " DIB size: %7d", _render->m_iboffset); tvm.printf(10, pos++, 0x8e, " DIB size: %7d", _render->m_iboffset);
pos++;
tvm.printf(10, pos++, 0x8e, " State cache: ");
tvm.printf(10, pos++, 0x8e, " Blend | DepthS | Input | Raster | Sampler ");
tvm.printf(10, pos++, 0x8e, " %6d | %6d | %6d | %6d | %6d "
, m_blendStateCache.getCount()
, m_depthStencilStateCache.getCount()
, m_inputLayoutCache.getCount()
, m_rasterizerStateCache.getCount()
, m_samplerStateCache.getCount()
);
pos++;
double captureMs = double(captureElapsed)*toMs; double captureMs = double(captureElapsed)*toMs;
tvm.printf(10, pos++, 0x8e, " Capture: %3.4f [ms]", captureMs); tvm.printf(10, pos++, 0x8e, " Capture: %3.4f [ms]", captureMs);

View file

@ -75,6 +75,11 @@ namespace bgfx
m_hashMap.clear(); m_hashMap.clear();
} }
uint32_t getCount() const
{
return uint32_t(m_hashMap.size() );
}
private: private:
typedef stl::unordered_map<uint64_t, Ty*> HashMap; typedef stl::unordered_map<uint64_t, Ty*> HashMap;
HashMap m_hashMap; HashMap m_hashMap;

View file

@ -1801,7 +1801,7 @@ namespace bgfx
}; };
BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attrib)-1); BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attrib)-1);
static const D3DDECLTYPE s_attribType[AttribType::Count][4][2] = static const D3DDECLTYPE s_attribType[][4][2] =
{ {
{ {
{ D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N }, { D3DDECLTYPE_UBYTE4, D3DDECLTYPE_UBYTE4N },
@ -1828,6 +1828,7 @@ namespace bgfx
{ D3DDECLTYPE_FLOAT4, D3DDECLTYPE_FLOAT4 }, { D3DDECLTYPE_FLOAT4, D3DDECLTYPE_FLOAT4 },
}, },
}; };
BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) );
static D3DVERTEXELEMENT9* fillVertexDecl(D3DVERTEXELEMENT9* _out, const VertexDecl& _decl) static D3DVERTEXELEMENT9* fillVertexDecl(D3DVERTEXELEMENT9* _out, const VertexDecl& _decl)
{ {

View file

@ -59,7 +59,7 @@ namespace bgfx
}; };
BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attribName) ); BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attribName) );
static const char* s_instanceDataName[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT] = static const char* s_instanceDataName[] =
{ {
"i_data0", "i_data0",
"i_data1", "i_data1",
@ -67,21 +67,24 @@ namespace bgfx
"i_data3", "i_data3",
"i_data4", "i_data4",
}; };
BX_STATIC_ASSERT(BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT == BX_COUNTOF(s_instanceDataName) );
static const GLenum s_access[Access::Count] = static const GLenum s_access[] =
{ {
GL_READ_ONLY, GL_READ_ONLY,
GL_WRITE_ONLY, GL_WRITE_ONLY,
GL_READ_WRITE, GL_READ_WRITE,
}; };
BX_STATIC_ASSERT(Access::Count == BX_COUNTOF(s_access) );
static const GLenum s_attribType[AttribType::Count] = static const GLenum s_attribType[] =
{ {
GL_UNSIGNED_BYTE, GL_UNSIGNED_BYTE,
GL_SHORT, GL_SHORT,
GL_HALF_FLOAT, GL_HALF_FLOAT,
GL_FLOAT, GL_FLOAT,
}; };
BX_STATIC_ASSERT(AttribType::Count == BX_COUNTOF(s_attribType) );
struct Blend struct Blend
{ {
@ -4904,6 +4907,15 @@ namespace bgfx
tvm.printf(10, pos++, 0x8e, " DVB size: %7d", _render->m_vboffset); tvm.printf(10, pos++, 0x8e, " DVB size: %7d", _render->m_vboffset);
tvm.printf(10, pos++, 0x8e, " DIB size: %7d", _render->m_iboffset); tvm.printf(10, pos++, 0x8e, " DIB size: %7d", _render->m_iboffset);
pos++;
tvm.printf(10, pos++, 0x8e, " State cache: ");
tvm.printf(10, pos++, 0x8e, " VAO | Sampler ");
tvm.printf(10, pos++, 0x8e, " %6d | %6d "
, m_vaoStateCache.getCount()
, m_samplerStateCache.getCount()
);
pos++;
double captureMs = double(captureElapsed)*toMs; double captureMs = double(captureElapsed)*toMs;
tvm.printf(10, pos++, 0x8e, " Capture: %3.4f [ms]", captureMs); tvm.printf(10, pos++, 0x8e, " Capture: %3.4f [ms]", captureMs);

View file

@ -599,6 +599,11 @@ namespace bgfx
m_hashMap.clear(); m_hashMap.clear();
} }
uint32_t getCount() const
{
return uint32_t(m_hashMap.size() );
}
private: private:
typedef stl::unordered_map<uint32_t, GLuint> HashMap; typedef stl::unordered_map<uint32_t, GLuint> HashMap;
HashMap m_hashMap; HashMap m_hashMap;
@ -671,6 +676,11 @@ namespace bgfx
m_hashMap.clear(); m_hashMap.clear();
} }
uint32_t getCount() const
{
return uint32_t(m_hashMap.size() );
}
private: private:
typedef stl::unordered_map<uint32_t, GLuint> HashMap; typedef stl::unordered_map<uint32_t, GLuint> HashMap;
HashMap m_hashMap; HashMap m_hashMap;