OSD: Add option to show descriptor usage in D3D12

This commit is contained in:
TheLastRar
2026-03-29 11:28:00 -04:00
committed by Ty
parent a291936bf8
commit 1edc304453
8 changed files with 140 additions and 74 deletions
+10 -1
View File
@@ -61,6 +61,7 @@ OSDSettingsWidget::OSDSettingsWidget(SettingsWindow* settings_dialog, QWidget* p
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showGSStats, "EmuCore/GS", "OsdShowGSStats", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showUsageCPU, "EmuCore/GS", "OsdShowCPU", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showUsageGPU, "EmuCore/GS", "OsdShowGPU", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showDebugGPU, "EmuCore/GS", "OsdShowGPUDebug", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showStatusIndicators, "EmuCore/GS", "OsdShowIndicators", true);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showFrameTimes, "EmuCore/GS", "OsdShowFrameTimes", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showHardwareInfo, "EmuCore/GS", "OsdShowHardwareInfo", false);
@@ -74,6 +75,11 @@ OSDSettingsWidget::OSDSettingsWidget(SettingsWindow* settings_dialog, QWidget* p
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.showTextureReplacements, "EmuCore/GS", "OsdShowTextureReplacements", false);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.warnAboutUnsafeSettings, "EmuCore", "OsdWarnAboutUnsafeSettings", true);
#ifndef _WIN32
// Currently DX12 only
m_ui.showDebugGPU->deleteLater();
#endif
connect(m_ui.showSettings, &QCheckBox::checkStateChanged, this, &OSDSettingsWidget::onOsdShowSettingsToggled);
//////////////////////////////////////////////////////////////////////////
@@ -117,7 +123,10 @@ OSDSettingsWidget::OSDSettingsWidget(SettingsWindow* settings_dialog, QWidget* p
dialog()->registerWidgetHelp(m_ui.showStatusIndicators, tr("Show Status Indicators"), tr("Checked"),
tr("Shows icon indicators for emulation states such as Pausing, Turbo, Fast-Forward, and Slow-Motion."));
#ifdef _WIN32
dialog()->registerWidgetHelp(m_ui.showDebugGPU, tr("Show GPU Debug Info"),
tr("Unchecked"), tr("Shows debug information about the renderer."));
#endif
dialog()->registerWidgetHelp(m_ui.showFrameTimes, tr("Show Frame Times"), tr("Unchecked"),
tr("Displays a graph showing the average frametimes."));
+80 -73
View File
@@ -321,7 +321,7 @@
</layout>
</item>
<item row="9" column="0" colspan="2">
<layout class="QGridLayout" name="optionLayout" rowstretch="0,0,0,0,0,0,0,0,0,0">
<layout class="QGridLayout" name="optionLayout" rowstretch="0,0,0,0,0,0,0,0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
</property>
@@ -331,34 +331,6 @@
<property name="spacing">
<number>7</number>
</property>
<item row="1" column="0">
<widget class="QCheckBox" name="showFrameTimes">
<property name="text">
<string>Show Frame Times</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="showUsageCPU">
<property name="text">
<string>Show CPU Usage</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="showResolution">
<property name="text">
<string>Show Resolution</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="showVPS">
<property name="text">
<string>Show VPS</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="showUsageGPU">
<property name="text">
@@ -366,31 +338,17 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="showSpeedPercentages">
<item row="1" column="0">
<widget class="QCheckBox" name="showFrameTimes">
<property name="text">
<string>Show Speed Percentages</string>
<string>Show Frame Times</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="showGSStats">
<item row="7" column="2">
<widget class="QLabel" name="warningLabel">
<property name="text">
<string>Show GS Statistics</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QCheckBox" name="showStatusIndicators">
<property name="text">
<string>Show Status Indicators</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="showFPS">
<property name="text">
<string>Show FPS</string>
<string>Messages</string>
</property>
</widget>
</item>
@@ -401,20 +359,6 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="Column1_SystemInformation">
<property name="text">
<string>System Information</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="Column2_SettingsAndInputs">
<property name="text">
<string>Settings &amp; Inputs</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="showHardwareInfo">
<property name="text">
@@ -429,13 +373,6 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="showSettings">
<property name="text">
<string>Show Settings</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="showPatches">
<property name="text">
@@ -443,6 +380,20 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="showResolution">
<property name="text">
<string>Show Resolution</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="showUsageCPU">
<property name="text">
<string>Show CPU Usage</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="showInputs">
<property name="text">
@@ -471,10 +422,17 @@
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="warningLabel">
<item row="6" column="0">
<widget class="QCheckBox" name="showGSStats">
<property name="text">
<string>Messages</string>
<string>Show GS Statistics</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QCheckBox" name="showStatusIndicators">
<property name="text">
<string>Show Status Indicators</string>
</property>
</widget>
</item>
@@ -485,6 +443,55 @@
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="showFPS">
<property name="text">
<string>Show FPS</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="Column1_SystemInformation">
<property name="text">
<string>System Information</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="showSpeedPercentages">
<property name="text">
<string>Show Speed Percentages</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QCheckBox" name="showSettings">
<property name="text">
<string>Show Settings</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="showVPS">
<property name="text">
<string>Show VPS</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="Column2_SettingsAndInputs">
<property name="text">
<string>Settings &amp; Inputs</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="showDebugGPU">
<property name="text">
<string>Show GPU Debug Info</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
+1
View File
@@ -772,6 +772,7 @@ struct Pcsx2Config
OsdShowGSStats : 1,
OsdShowCPU : 1,
OsdShowGPU : 1,
OsdShowGPUDebug : 1,
OsdShowIndicators : 1,
OsdShowFrameTimes : 1,
OsdShowHardwareInfo : 1,
@@ -102,6 +102,18 @@ void D3D12DescriptorHeapManager::Free(D3D12DescriptorHandle* handle)
handle->Clear();
}
u32 D3D12DescriptorHeapManager::GetAllocatedDescriptors()
{
u32 ret = 0;
for (u32 group = 0; group < m_free_slots.size(); group++)
{
BitSetType& bs = m_free_slots[group];
ret += BITSET_SIZE - bs.count();
}
return ret;
}
D3D12DescriptorAllocator::D3D12DescriptorAllocator() = default;
D3D12DescriptorAllocator::~D3D12DescriptorAllocator() = default;
@@ -62,6 +62,9 @@ public:
void Free(D3D12DescriptorHandle* handle);
void Free(u32 index);
u32 GetNumDescriptors() const { return m_num_descriptors; }
u32 GetAllocatedDescriptors();
private:
wil::com_ptr_nothrow<ID3D12DescriptorHeap> m_descriptor_heap;
u32 m_num_descriptors = 0;
+4
View File
@@ -3386,6 +3386,10 @@ void FullscreenUI::DrawOSDSettingsPage()
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_PLAY, "Show Status Indicators"),
FSUI_CSTR("Shows indicators when fast forwarding, pausing, and other abnormal states are active."), "EmuCore/GS",
"OsdShowIndicators", true);
#ifdef _WIN32
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_BUG, "Show GPU Debug Info"),
FSUI_CSTR("Shows debug information about the renderer."), "EmuCore/GS", "OsdShowGPUDebug", false);
#endif
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_PF_HEARTBEAT_ALT, "Show Frame Times"),
FSUI_CSTR("Shows a visual history of frame times."), "EmuCore/GS", "OsdShowFrameTimes", false);
DrawToggleSetting(bsi, FSUI_ICONSTR(ICON_FA_SLIDERS, "Show Settings"),
+28
View File
@@ -8,6 +8,9 @@
#include "GS/GSCapture.h"
#include "GS/GSVector.h"
#include "GS/Renderers/Common/GSDevice.h"
#ifdef _WIN32
#include "GS/Renderers/DX12/GSDevice12.h"
#endif
#include "GS/Renderers/HW/GSTextureReplacements.h"
#include "Host.h"
#include "IconsFontAwesome.h"
@@ -66,6 +69,7 @@ SmallString s_cpu_usage_vu_line;
std::vector<SmallString> s_software_thread_lines;
SmallString s_capture_line;
SmallString s_gpu_usage_line;
SmallString s_gpu_debug_info_line;
SmallString s_speed_icon;
constexpr ImU32 white_color = IM_COL32(255, 255, 255, 255);
@@ -482,6 +486,22 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
FormatProcessorStat(s_gpu_usage_line, PerformanceMetrics::GetGPUUsage(), PerformanceMetrics::GetGPUAverageTime());
DRAW_LINE(osd_font, font_size, s_gpu_usage_line.c_str(), white_color);
}
if (GSConfig.OsdShowGPUDebug)
{
#ifdef _WIN32
if (g_gs_device->GetRenderAPI() == RenderAPI::D3D12)
{
GSDevice12* dev12 = static_cast<GSDevice12*>(g_gs_device.get());
s_gpu_debug_info_line.format("D3D12 Descriptor Heaps | SRV/UAV: {}/{} | RTV: {}/{} | DSV {}/{}",
dev12->GetDescriptorHeapManager().GetAllocatedDescriptors(), dev12->GetDescriptorHeapManager().GetNumDescriptors(),
dev12->GetRTVHeapManager().GetAllocatedDescriptors(), dev12->GetRTVHeapManager().GetNumDescriptors(),
dev12->GetDSVHeapManager().GetAllocatedDescriptors(), dev12->GetDSVHeapManager().GetNumDescriptors());
DRAW_LINE(osd_font, font_size, s_gpu_debug_info_line.c_str(), white_color);
}
#endif
}
}
// No refresh yet. Display cached lines.
else
@@ -526,6 +546,14 @@ __ri void ImGuiManager::DrawPerformanceOverlay(float& position_y, float scale, f
if (GSConfig.OsdShowGPU)
DRAW_LINE(osd_font, font_size, s_gpu_usage_line.c_str(), white_color);
if (GSConfig.OsdShowGPUDebug)
{
#ifdef _WIN32
if (g_gs_device->GetRenderAPI() == RenderAPI::D3D12)
DRAW_LINE(osd_font, font_size, s_gpu_debug_info_line.c_str(), white_color);
#endif
}
}
// Check every OSD frame because this is an animation.
+2
View File
@@ -732,6 +732,7 @@ Pcsx2Config::GSOptions::GSOptions()
OsdShowGSStats = false;
OsdShowCPU = false;
OsdShowGPU = false;
OsdShowGPUDebug = false;
OsdShowIndicators = true;
OsdShowFrameTimes = false;
OsdShowHardwareInfo = false;
@@ -957,6 +958,7 @@ void Pcsx2Config::GSOptions::LoadSave(SettingsWrapper& wrap)
SettingsWrapBitBool(OsdShowVPS);
SettingsWrapBitBool(OsdShowCPU);
SettingsWrapBitBool(OsdShowGPU);
SettingsWrapBitBool(OsdShowGPUDebug);
SettingsWrapBitBool(OsdShowResolution);
SettingsWrapBitBool(OsdShowGSStats);
SettingsWrapBitBool(OsdShowIndicators);