#pragma once #include "../dxvk_device.h" #include "../util/util_env.h" #include "dxvk_hud_devinfo.h" #include "dxvk_hud_fps.h" #include "dxvk_hud_text.h" namespace dxvk::hud { 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: explicit Hud( const Rc& device); ~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 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 createHud( const Rc& device); private: const Rc m_device; const Rc m_context; HudTextRenderer m_textRenderer; VkExtent2D m_surfaceSize = { 0, 0 }; Rc m_uniformBuffer; Rc m_renderTarget; Rc m_renderTargetView; Rc m_renderTargetFbo; HudDeviceInfo m_hudDeviceInfo; HudFps m_hudFps; void renderText(); Rc createUniformBuffer(); void updateUniformBuffer(); void beginRenderPass(bool initFbo); void endRenderPass(); void setupFramebuffer(VkExtent2D size); void setupConstantState(); }; }