diff --git a/src/dxvk/hud/dxvk_hud_item.cpp b/src/dxvk/hud/dxvk_hud_item.cpp index d676202a0..19d7f29e1 100644 --- a/src/dxvk/hud/dxvk_hud_item.cpp +++ b/src/dxvk/hud/dxvk_hud_item.cpp @@ -112,7 +112,7 @@ namespace dxvk::hud { HudClientApiItem::HudClientApiItem(std::string api) - : m_api(api) { + : m_api(std::move(api)) { } @@ -122,12 +122,20 @@ namespace dxvk::hud { } + void HudClientApiItem::setApiName(std::string api) { + std::lock_guard lock(m_mutex); + m_api = std::move(api); + } + + HudPos HudClientApiItem::render( const DxvkContextObjects& ctx, const HudPipelineKey& key, const HudOptions& options, HudRenderer& renderer, HudPos position) { + std::lock_guard lock(m_mutex); + position.y += 16; renderer.drawText(16, position, 0xffffffffu, m_api); diff --git a/src/dxvk/hud/dxvk_hud_item.h b/src/dxvk/hud/dxvk_hud_item.h index 749c12172..de5eb1917 100644 --- a/src/dxvk/hud/dxvk_hud_item.h +++ b/src/dxvk/hud/dxvk_hud_item.h @@ -163,6 +163,8 @@ namespace dxvk::hud { ~HudClientApiItem(); + void setApiName(std::string api); + HudPos render( const DxvkContextObjects& ctx, const HudPipelineKey& key, @@ -172,7 +174,8 @@ namespace dxvk::hud { private: - std::string m_api; + sync::Spinlock m_mutex; + std::string m_api; };