diff --git a/src/dxvk/hud/dxvk_hud.cpp b/src/dxvk/hud/dxvk_hud.cpp index 9cbb4ed9..cf15da2d 100644 --- a/src/dxvk/hud/dxvk_hud.cpp +++ b/src/dxvk/hud/dxvk_hud.cpp @@ -41,6 +41,7 @@ namespace dxvk::hud { addItem("frametimes"); addItem("submissions", device); addItem("drawcalls", device); + addItem("pipelines", device); } diff --git a/src/dxvk/hud/dxvk_hud_item.cpp b/src/dxvk/hud/dxvk_hud_item.cpp index ef742900..415e6b64 100644 --- a/src/dxvk/hud/dxvk_hud_item.cpp +++ b/src/dxvk/hud/dxvk_hud_item.cpp @@ -346,4 +346,46 @@ namespace dxvk::hud { return position; } + + HudPipelineStatsItem::HudPipelineStatsItem(const Rc& device) + : m_device(device) { + + } + + + HudPipelineStatsItem::~HudPipelineStatsItem() { + + } + + + void HudPipelineStatsItem::update(dxvk::high_resolution_clock::time_point time) { + DxvkStatCounters counters = m_device->getStatCounters(); + + m_graphicsPipelines = counters.getCtr(DxvkStatCounter::PipeCountGraphics); + m_computePipelines = counters.getCtr(DxvkStatCounter::PipeCountCompute); + } + + + HudPos HudPipelineStatsItem::render( + HudRenderer& renderer, + HudPos position) { + std::string strGpCount = str::format("Graphics pipelines: ", m_graphicsPipelines); + std::string strCpCount = str::format("Compute pipelines: ", m_computePipelines); + + position.y += 16.0f; + renderer.drawText(16.0f, + { position.x, position.y }, + { 1.0f, 1.0f, 1.0f, 1.0f }, + strGpCount); + + position.y += 20.0f; + renderer.drawText(16.0f, + { position.x, position.y }, + { 1.0f, 1.0f, 1.0f, 1.0f }, + strCpCount); + + position.y += 8.0f; + return position; + } + } diff --git a/src/dxvk/hud/dxvk_hud_item.h b/src/dxvk/hud/dxvk_hud_item.h index 5924614c..419ef595 100644 --- a/src/dxvk/hud/dxvk_hud_item.h +++ b/src/dxvk/hud/dxvk_hud_item.h @@ -269,4 +269,31 @@ namespace dxvk::hud { }; + + /** + * \brief HUD item to display pipeline counts + */ + class HudPipelineStatsItem : public HudItem { + + public: + + HudPipelineStatsItem(const Rc& device); + + ~HudPipelineStatsItem(); + + void update(dxvk::high_resolution_clock::time_point time); + + HudPos render( + HudRenderer& renderer, + HudPos position); + + private: + + Rc m_device; + + uint64_t m_graphicsPipelines = 0; + uint64_t m_computePipelines = 0; + + }; + } \ No newline at end of file