#pragma once #include #include #include #include "dxgi_include.h" #include "../spirv/spirv_module.h" namespace dxvk { /** * \brief DXGI presenter * * Renders the back buffer from the * \ref DxgiSwapChain to the Vulkan * swap chain. */ class DxgiPresenter : public RcObject { public: DxgiPresenter( const Rc& device, HWND window, uint32_t bufferWidth, uint32_t bufferHeight, DXGI_FORMAT bufferFormat); ~DxgiPresenter(); /** * \brief Initializes back buffer image * \param [in] image Back buffer image */ void initBackBuffer( const Rc& image); /** * \brief Renders back buffer to the screen */ void presentImage(); /** * \brief Sets new back buffer * * Recreates internal structures when * the back buffer image was replaced. * \param [in] image Back buffer image */ void updateBackBuffer( const Rc& image); /** * \brief Renders image to the screen * \param [in] view Source image view */ void recreateSwapchain( uint32_t bufferWidth, uint32_t bufferHeight, DXGI_FORMAT bufferFormat); private: enum BindingIds : uint32_t { Sampler = 0, Texture = 1, }; Rc m_device; Rc m_context; Rc m_surface; Rc m_swapchain; Rc m_sampler; Rc m_backBuffer; Rc m_backBufferResolve; Rc m_backBufferView; VkSurfaceFormatKHR pickFormat(DXGI_FORMAT fmt) const; Rc createVertexShader(); Rc createFragmentShader(); }; }