Skip to content

Commit 1901869

Browse files
USD Viewer: print the number of buffer updates
1 parent 764c7e2 commit 1901869

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

Samples/USDViewer/src/USDViewer.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -347,16 +347,17 @@ void USDViewer::Render()
347347

348348
m_Stage.FinalColorTarget->ReleaseTarget();
349349

350-
const auto& CtxStats = m_pImmediateContext->GetStats();
351-
m_Stats.NumDrawCommands = CtxStats.CommandCounters.Draw + CtxStats.CommandCounters.DrawIndexed;
352-
m_Stats.NumPSOChanges = CtxStats.CommandCounters.SetPipelineState;
353-
m_Stats.NumSRBChanges = CtxStats.CommandCounters.CommitShaderResources;
354-
m_Stats.NumVBChanges = CtxStats.CommandCounters.SetVertexBuffers;
355-
m_Stats.NumIBChanges = CtxStats.CommandCounters.SetIndexBuffer;
356-
m_Stats.NumBufferMaps = CtxStats.CommandCounters.MapBuffer;
357-
m_Stats.NumTriangles = CtxStats.GetTotalTriangleCount();
358-
m_Stats.NumLines = CtxStats.GetTotalLineCount();
359-
m_Stats.NumPoints = CtxStats.GetTotalPointCount();
350+
const auto& CtxStats = m_pImmediateContext->GetStats();
351+
m_Stats.NumDrawCommands = CtxStats.CommandCounters.Draw + CtxStats.CommandCounters.DrawIndexed;
352+
m_Stats.NumPSOChanges = CtxStats.CommandCounters.SetPipelineState;
353+
m_Stats.NumSRBChanges = CtxStats.CommandCounters.CommitShaderResources;
354+
m_Stats.NumVBChanges = CtxStats.CommandCounters.SetVertexBuffers;
355+
m_Stats.NumIBChanges = CtxStats.CommandCounters.SetIndexBuffer;
356+
m_Stats.NumBufferMaps = CtxStats.CommandCounters.MapBuffer;
357+
m_Stats.NumBufferUpdates = CtxStats.CommandCounters.UpdateBuffer;
358+
m_Stats.NumTriangles = CtxStats.GetTotalTriangleCount();
359+
m_Stats.NumLines = CtxStats.GetTotalLineCount();
360+
m_Stats.NumPoints = CtxStats.GetTotalPointCount();
360361
}
361362

362363
void USDViewer::PopulateSceneTree(const pxr::UsdPrim& Prim)
@@ -695,7 +696,7 @@ void USDViewer::UpdateUI()
695696
" SRB\n"
696697
" VB\n"
697698
" IB\n"
698-
"Buffer maps\n"
699+
"Buffer M + U\n"
699700
"Memory Usage\n"
700701
" Vertex Pool\n"
701702
" Index Pool\n"
@@ -716,7 +717,7 @@ void USDViewer::UpdateUI()
716717
"%d\n"
717718
"%d\n"
718719
"%d\n"
719-
"%d\n"
720+
"%d + %d\n"
720721
"\n"
721722
"%s / %s (%d allocs, %dK verts)\n"
722723
"%s / %s (%d allocs)\n"
@@ -729,7 +730,7 @@ void USDViewer::UpdateUI()
729730
m_Stats.NumSRBChanges,
730731
m_Stats.NumVBChanges,
731732
m_Stats.NumIBChanges,
732-
m_Stats.NumBufferMaps,
733+
m_Stats.NumBufferMaps, m_Stats.NumBufferUpdates,
733734
VertPoolUsedSizeStr.c_str(), VertPoolCommittedSizeStr.c_str(), MemoryStats.VertexPool.AllocationCount, MemoryStats.VertexPool.AllocatedVertexCount / 1000,
734735
IndPoolUsedSizeStr.c_str(), IndPoolCommittedSizeStr.c_str(), MemoryStats.IndexPool.AllocationCount,
735736
AtlasCommittedSizeStr.c_str(), static_cast<double>(MemoryStats.Atlas.AllocatedTexels) / static_cast<double>(std::max(MemoryStats.Atlas.TotalTexels, Uint64{1})) * 100.0, MemoryStats.Atlas.AllocationCount);

Samples/USDViewer/src/USDViewer.hpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,16 @@ class USDViewer final : public SampleBase
142142

143143
struct RenderStats
144144
{
145-
Uint32 NumDrawCommands = 0;
146-
Uint32 NumPSOChanges = 0;
147-
Uint32 NumSRBChanges = 0;
148-
Uint32 NumVBChanges = 0;
149-
Uint32 NumIBChanges = 0;
150-
Uint32 NumBufferMaps = 0;
151-
Uint32 NumTriangles = 0;
152-
Uint32 NumLines = 0;
153-
Uint32 NumPoints = 0;
145+
Uint32 NumDrawCommands = 0;
146+
Uint32 NumPSOChanges = 0;
147+
Uint32 NumSRBChanges = 0;
148+
Uint32 NumVBChanges = 0;
149+
Uint32 NumIBChanges = 0;
150+
Uint32 NumBufferMaps = 0;
151+
Uint32 NumBufferUpdates = 0;
152+
Uint32 NumTriangles = 0;
153+
Uint32 NumLines = 0;
154+
Uint32 NumPoints = 0;
154155
};
155156
RenderStats m_Stats;
156157

0 commit comments

Comments
 (0)