mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-13 19:29:14 +01:00
[hud] Implement Vulkan device info as a HUD item
This commit is contained in:
parent
e4bc5c2aee
commit
0da5aac357
@ -36,6 +36,7 @@ namespace dxvk::hud {
|
||||
|
||||
addItem<HudVersionItem>("version");
|
||||
addItem<HudClientApiItem>("api", m_device);
|
||||
addItem<HudDeviceInfoItem>("devinfo", m_device);
|
||||
}
|
||||
|
||||
|
||||
@ -91,9 +92,6 @@ namespace dxvk::hud {
|
||||
|
||||
HudPos position = { 8.0f, 24.0f };
|
||||
|
||||
if (m_config.elements.test(HudElement::DeviceInfo))
|
||||
position = m_hudDeviceInfo.render(m_renderer, position);
|
||||
|
||||
position = m_hudFramerate.render(m_renderer, position);
|
||||
position = m_hudStats .render(m_renderer, position);
|
||||
}
|
||||
|
@ -101,4 +101,50 @@ namespace dxvk::hud {
|
||||
return position;
|
||||
}
|
||||
|
||||
|
||||
HudDeviceInfoItem::HudDeviceInfoItem(const Rc<DxvkDevice>& device) {
|
||||
VkPhysicalDeviceProperties props = device->adapter()->deviceProperties();
|
||||
|
||||
m_deviceName = props.deviceName;
|
||||
m_driverVer = str::format("Driver: ",
|
||||
VK_VERSION_MAJOR(props.driverVersion), ".",
|
||||
VK_VERSION_MINOR(props.driverVersion), ".",
|
||||
VK_VERSION_PATCH(props.driverVersion));
|
||||
m_vulkanVer = str::format("Vulkan: ",
|
||||
VK_VERSION_MAJOR(props.apiVersion), ".",
|
||||
VK_VERSION_MINOR(props.apiVersion), ".",
|
||||
VK_VERSION_PATCH(props.apiVersion));
|
||||
}
|
||||
|
||||
|
||||
HudDeviceInfoItem::~HudDeviceInfoItem() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
HudPos HudDeviceInfoItem::render(
|
||||
HudRenderer& renderer,
|
||||
HudPos position) {
|
||||
position.y += 16.0f;
|
||||
renderer.drawText(16.0f,
|
||||
{ position.x, position.y },
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f },
|
||||
m_deviceName);
|
||||
|
||||
position.y += 24.0f;
|
||||
renderer.drawText(16.0f,
|
||||
{ position.x, position.y },
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f },
|
||||
m_driverVer);
|
||||
|
||||
position.y += 20.0f;
|
||||
renderer.drawText(16.0f,
|
||||
{ position.x, position.y },
|
||||
{ 1.0f, 1.0f, 1.0f, 1.0f },
|
||||
m_vulkanVer);
|
||||
|
||||
position.y += 8.0f;
|
||||
return position;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -136,4 +136,28 @@ namespace dxvk::hud {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief HUD item to display device info
|
||||
*/
|
||||
class HudDeviceInfoItem : public HudItem {
|
||||
|
||||
public:
|
||||
|
||||
HudDeviceInfoItem(const Rc<DxvkDevice>& device);
|
||||
|
||||
~HudDeviceInfoItem();
|
||||
|
||||
HudPos render(
|
||||
HudRenderer& renderer,
|
||||
HudPos position);
|
||||
|
||||
private:
|
||||
|
||||
std::string m_deviceName;
|
||||
std::string m_driverVer;
|
||||
std::string m_vulkanVer;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user