1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-20 19:54:19 +01:00

[d3d9] Add HUD item for FF shaders

This commit is contained in:
Robin Kertels 2024-09-17 17:51:44 +02:00 committed by Philip Rebohle
parent 89e190b771
commit 010738c107
6 changed files with 84 additions and 2 deletions

View File

@ -1022,6 +1022,18 @@ namespace dxvk {
return m_behaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING;
}
UINT GetFixedFunctionVSCount() const {
return m_ffModules.GetVSCount();
}
UINT GetFixedFunctionFSCount() const {
return m_ffModules.GetFSCount();
}
UINT GetSWVPShaderCount() const {
return m_swvpEmulator.GetShaderCount();
}
private:
DxvkCsChunkRef AllocCsChunk() {

View File

@ -9,7 +9,6 @@
#include "../dxso/dxso_isgn.h"
#include <unordered_map>
#include <bitset>
namespace dxvk {
@ -253,6 +252,14 @@ namespace dxvk {
D3D9DeviceEx* pDevice,
const D3D9FFShaderKeyFS& ShaderKey);
UINT GetVSCount() const {
return m_vsModules.size();
}
UINT GetFSCount() const {
return m_fsModules.size();
}
private:
std::unordered_map<

View File

@ -92,4 +92,37 @@ namespace dxvk::hud {
return position;
}
}
HudFixedFunctionShaders::HudFixedFunctionShaders(D3D9DeviceEx* device)
: m_device (device)
, m_ffShaderCount ("") {}
void HudFixedFunctionShaders::update(dxvk::high_resolution_clock::time_point time) {
m_ffShaderCount = str::format(
"VS: ", m_device->GetFixedFunctionVSCount(),
" FS: ", m_device->GetFixedFunctionFSCount(),
" SWVP: ", m_device->GetSWVPShaderCount()
);
}
HudPos HudFixedFunctionShaders::render(
HudRenderer& renderer,
HudPos position) {
position.y += 16.0f;
renderer.drawText(16.0f,
{ position.x, position.y },
{ 0.0f, 1.0f, 0.75f, 1.0f },
"FF Shaders:");
renderer.drawText(16.0f,
{ position.x + 155.0f, position.y },
{ 1.0f, 1.0f, 1.0f, 1.0f },
m_ffShaderCount);
position.y += 8.0f;
return position;
}
}

View File

@ -60,4 +60,29 @@ namespace dxvk::hud {
};
/**
* \brief HUD item to display amount of generated fixed function shaders
*/
class HudFixedFunctionShaders : public HudItem {
public:
HudFixedFunctionShaders(D3D9DeviceEx* device);
void update(dxvk::high_resolution_clock::time_point time);
HudPos render(
HudRenderer& renderer,
HudPos position);
private:
D3D9DeviceEx* m_device;
dxvk::high_resolution_clock::time_point m_lastUpdate
= dxvk::high_resolution_clock::now();
std::string m_ffShaderCount;
};
}

View File

@ -1098,6 +1098,7 @@ namespace dxvk {
if (m_hud != nullptr) {
m_hud->addItem<hud::HudClientApiItem>("api", 1, GetApiName());
m_hud->addItem<hud::HudSamplerCount>("samplers", -1, m_parent);
m_hud->addItem<hud::HudFixedFunctionShaders>("ffshaders", -1, m_parent);
#ifdef D3D9_ALLOW_UNMAPPING
m_hud->addItem<hud::HudTextureMemory>("memory", -1, m_parent);

View File

@ -40,6 +40,10 @@ namespace dxvk {
Rc<DxvkShader> GetShaderModule(D3D9DeviceEx* pDevice, D3D9CompactVertexElements&& elements);
UINT GetShaderCount() const {
return m_modules.size();
}
private:
dxvk::mutex m_mutex;