Skip to content

Commit

Permalink
[d3d9] Add SWVP HUD item
Browse files Browse the repository at this point in the history
  • Loading branch information
K0bin committed Sep 19, 2024
1 parent ccaf5be commit 491e38a
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/d3d9/d3d9_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -1022,6 +1022,14 @@ namespace dxvk {
return m_behaviorFlags & D3DCREATE_SOFTWARE_VERTEXPROCESSING;
}

bool CanSWVP() const {
return m_behaviorFlags & (D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING);
}

bool IsSWVP() const {
return m_isSWVP;
}

UINT GetFixedFunctionVSCount() const {
return m_ffModules.GetVSCount();
}
Expand Down Expand Up @@ -1063,10 +1071,6 @@ namespace dxvk {
}
}

bool CanSWVP() const {
return m_behaviorFlags & (D3DCREATE_MIXED_VERTEXPROCESSING | D3DCREATE_SOFTWARE_VERTEXPROCESSING);
}

// Device Reset detection for D3D9SwapChainEx::Present
bool IsDeviceReset() {
return std::exchange(m_deviceHasBeenReset, false);
Expand Down
36 changes: 36 additions & 0 deletions src/d3d9/d3d9_hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,40 @@ namespace dxvk::hud {
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 = "Software vertex processing";
} else {
m_isSWVPText = "Mixed vertex processing: SWVP";
}
} else {
if (m_device->CanSWVP()) {
m_isSWVPText = "Mixed vertex processing: HWVP";
} else {
m_isSWVPText = "Hardware Vertex Processing";
}
}
}


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 },
m_isSWVPText);

position.y += 8.0f;
return position;
}

}
25 changes: 22 additions & 3 deletions src/d3d9/d3d9_hud.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,30 @@ namespace dxvk::hud {

D3D9DeviceEx* m_device;

dxvk::high_resolution_clock::time_point m_lastUpdate
= dxvk::high_resolution_clock::now();

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;

};

}
1 change: 1 addition & 0 deletions src/d3d9/d3d9_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,7 @@ namespace dxvk {
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);
m_hud->addItem<hud::HudSWVPState>("swvp", -1, m_parent);

#ifdef D3D9_ALLOW_UNMAPPING
m_hud->addItem<hud::HudTextureMemory>("memory", -1, m_parent);
Expand Down

0 comments on commit 491e38a

Please sign in to comment.