1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 16:24:12 +01:00

[d3d9] Add SWVP HUD item

This commit is contained in:
Robin Kertels 2024-09-19 16:28:17 +02:00 committed by Philip Rebohle
parent 033104f335
commit 04ad98690b
5 changed files with 70 additions and 3 deletions

View File

@ -62,6 +62,8 @@ The `DXVK_HUD` environment variable controls a HUD which can display the framera
- `cs`: Shows worker thread statistics. - `cs`: Shows worker thread statistics.
- `compiler`: Shows shader compiler activity - `compiler`: Shows shader compiler activity
- `samplers`: Shows the current number of sampler pairs used *[D3D9 Only]* - `samplers`: Shows the current number of sampler pairs used *[D3D9 Only]*
- `ffshaders`: Shows the current number of shaders generated from fixed function state *[D3D9 Only]*
- `swvp`: Shows whether or not the device is running in software vertex processing mode *[D3D9 Only]*
- `scale=x`: Scales the HUD by a factor of `x` (e.g. `1.5`) - `scale=x`: Scales the HUD by a factor of `x` (e.g. `1.5`)
- `opacity=y`: Adjusts the HUD opacity by a factor of `y` (e.g. `0.5`, `1.0` being fully opaque). - `opacity=y`: Adjusts the HUD opacity by a factor of `y` (e.g. `0.5`, `1.0` being fully opaque).

View File

@ -1026,6 +1026,10 @@ namespace dxvk {
return m_behaviorFlags & (D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING); return m_behaviorFlags & (D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING);
} }
bool IsSWVP() const {
return m_isSWVP;
}
UINT GetFixedFunctionVSCount() const { UINT GetFixedFunctionVSCount() const {
return m_ffModules.GetVSCount(); return m_ffModules.GetVSCount();
} }

View File

@ -125,4 +125,45 @@ namespace dxvk::hud {
return position; return position;
} }
HudSWVPState::HudSWVPState(D3D9DeviceEx* device)
: m_device (device)
, m_isSWVPText ("") {}
void HudSWVPState::update(dxvk::high_resolution_clock::time_point time) {
if (m_device->IsSWVP()) {
if (m_device->CanOnlySWVP()) {
m_isSWVPText = "SWVP";
} else {
m_isSWVPText = "SWVP (Mixed)";
}
} else {
if (m_device->CanSWVP()) {
m_isSWVPText = "HWVP (Mixed)";
} else {
m_isSWVPText = "HWVP";
}
}
}
HudPos HudSWVPState::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 },
"Vertex Processing:");
renderer.drawText(16.0f,
{ position.x + 240.0f, position.y },
{ 1.0f, 1.0f, 1.0f, 1.0f },
m_isSWVPText);
position.y += 8.0f;
return position;
}
} }

View File

@ -78,11 +78,30 @@ namespace dxvk::hud {
D3D9DeviceEx* m_device; D3D9DeviceEx* m_device;
dxvk::high_resolution_clock::time_point m_lastUpdate
= dxvk::high_resolution_clock::now();
std::string m_ffShaderCount; std::string m_ffShaderCount;
}; };
/**
* \brief HUD item to whether or not we're in SWVP mode
*/
class HudSWVPState : public HudItem {
public:
HudSWVPState(D3D9DeviceEx* device);
void update(dxvk::high_resolution_clock::time_point time);
HudPos render(
HudRenderer& renderer,
HudPos position);
private:
D3D9DeviceEx* m_device;
std::string m_isSWVPText;
};
} }

View File

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