2018-01-13 03:53:33 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../dxvk_device.h"
|
|
|
|
|
|
|
|
#include "../util/util_env.h"
|
|
|
|
|
2018-04-03 12:33:08 +02:00
|
|
|
#include "dxvk_hud_config.h"
|
2018-01-13 03:53:33 +01:00
|
|
|
#include "dxvk_hud_devinfo.h"
|
|
|
|
#include "dxvk_hud_fps.h"
|
2018-04-17 09:20:18 +02:00
|
|
|
#include "dxvk_hud_renderer.h"
|
2018-04-03 14:49:13 +02:00
|
|
|
#include "dxvk_hud_stats.h"
|
2018-01-13 03:53:33 +01:00
|
|
|
|
|
|
|
namespace dxvk::hud {
|
|
|
|
|
2018-04-03 12:33:08 +02:00
|
|
|
/**
|
|
|
|
* \brief HUD uniform data
|
|
|
|
* Shader data for the HUD.
|
|
|
|
*/
|
2018-01-13 03:53:33 +01:00
|
|
|
struct HudUniformData {
|
|
|
|
VkExtent2D surfaceSize;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief DXVK HUD
|
|
|
|
*
|
|
|
|
* Can be used by the presentation backend to
|
|
|
|
* display performance and driver information.
|
|
|
|
*/
|
|
|
|
class Hud : public RcObject {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2018-04-03 12:33:08 +02:00
|
|
|
Hud(
|
|
|
|
const Rc<DxvkDevice>& device,
|
|
|
|
const HudConfig& config);
|
2018-01-13 03:53:33 +01:00
|
|
|
|
|
|
|
~Hud();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Renders the HUD
|
|
|
|
*
|
|
|
|
* Recreates the render targets for the HUD
|
|
|
|
* in case the surface size has changed.
|
|
|
|
* \param [in] size Render target size
|
|
|
|
*/
|
|
|
|
void render(VkExtent2D size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Rendered image
|
|
|
|
*
|
|
|
|
* Returns the rendered image from
|
|
|
|
* the previous call to \ref render.
|
|
|
|
* \returns The image view
|
|
|
|
*/
|
|
|
|
Rc<DxvkImageView> texture() const {
|
|
|
|
return m_renderTargetView;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Creates the HUD
|
|
|
|
*
|
|
|
|
* Creates and initializes the HUD if the
|
|
|
|
* \c DXVK_HUD environment variable is set.
|
|
|
|
* \param [in] device The DXVK device
|
|
|
|
* \returns HUD object, if it was created.
|
|
|
|
*/
|
|
|
|
static Rc<Hud> createHud(
|
|
|
|
const Rc<DxvkDevice>& device);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2018-04-03 12:33:08 +02:00
|
|
|
const HudConfig m_config;
|
|
|
|
|
2018-01-13 03:53:33 +01:00
|
|
|
const Rc<DxvkDevice> m_device;
|
|
|
|
const Rc<DxvkContext> m_context;
|
|
|
|
|
2018-04-17 09:20:18 +02:00
|
|
|
HudRenderer m_renderer;
|
2018-01-13 03:53:33 +01:00
|
|
|
VkExtent2D m_surfaceSize = { 0, 0 };
|
|
|
|
|
|
|
|
Rc<DxvkBuffer> m_uniformBuffer;
|
|
|
|
Rc<DxvkImage> m_renderTarget;
|
|
|
|
Rc<DxvkImageView> m_renderTargetView;
|
2018-04-26 13:24:42 +02:00
|
|
|
DxvkRenderTargets m_renderTargetInfo;
|
2018-01-13 03:53:33 +01:00
|
|
|
|
|
|
|
HudDeviceInfo m_hudDeviceInfo;
|
2018-04-17 12:03:03 +02:00
|
|
|
HudFps m_hudFramerate;
|
2018-04-03 14:49:13 +02:00
|
|
|
HudStats m_hudStats;
|
2018-01-13 03:53:33 +01:00
|
|
|
|
2018-04-17 09:21:40 +02:00
|
|
|
void render();
|
2018-01-13 03:53:33 +01:00
|
|
|
|
|
|
|
Rc<DxvkBuffer> createUniformBuffer();
|
|
|
|
|
|
|
|
void updateUniformBuffer();
|
|
|
|
void beginRenderPass(bool initFbo);
|
|
|
|
void endRenderPass();
|
|
|
|
|
|
|
|
void setupFramebuffer(VkExtent2D size);
|
|
|
|
void setupConstantState();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|