2017-11-29 21:46:09 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <dxvk_device.h>
|
|
|
|
#include <dxvk_surface.h>
|
|
|
|
#include <dxvk_swapchain.h>
|
|
|
|
|
2017-12-04 22:21:02 +01:00
|
|
|
#include "dxgi_include.h"
|
|
|
|
|
2017-11-29 21:46:09 +01:00
|
|
|
#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<DxvkDevice>& device,
|
|
|
|
HWND window,
|
2017-12-04 22:21:02 +01:00
|
|
|
uint32_t bufferWidth,
|
|
|
|
uint32_t bufferHeight,
|
|
|
|
DXGI_FORMAT bufferFormat);
|
2017-11-29 21:46:09 +01:00
|
|
|
|
|
|
|
~DxgiPresenter();
|
2017-12-12 00:27:49 +01:00
|
|
|
|
2017-12-02 11:46:25 +01:00
|
|
|
/**
|
|
|
|
* \brief Initializes back buffer image
|
|
|
|
* \param [in] image Back buffer image
|
|
|
|
*/
|
|
|
|
void initBackBuffer(
|
|
|
|
const Rc<DxvkImage>& image);
|
|
|
|
|
2017-11-29 21:46:09 +01:00
|
|
|
/**
|
2017-12-12 00:27:49 +01:00
|
|
|
* \brief Renders back buffer to the screen
|
|
|
|
*/
|
|
|
|
void presentImage();
|
|
|
|
|
|
|
|
/**
|
2017-12-19 16:01:50 +01:00
|
|
|
* \brief Sets new back buffer
|
2017-12-12 00:27:49 +01:00
|
|
|
*
|
2017-12-19 16:01:50 +01:00
|
|
|
* Recreates internal structures when
|
|
|
|
* the back buffer image was replaced.
|
|
|
|
* \param [in] image Back buffer image
|
2017-11-29 21:46:09 +01:00
|
|
|
*/
|
2017-12-19 16:01:50 +01:00
|
|
|
void updateBackBuffer(
|
|
|
|
const Rc<DxvkImage>& image);
|
2017-11-29 21:46:09 +01:00
|
|
|
|
2017-12-04 22:21:02 +01:00
|
|
|
/**
|
|
|
|
* \brief Renders image to the screen
|
|
|
|
* \param [in] view Source image view
|
|
|
|
*/
|
|
|
|
void recreateSwapchain(
|
2017-12-12 00:27:49 +01:00
|
|
|
uint32_t bufferWidth,
|
|
|
|
uint32_t bufferHeight,
|
|
|
|
DXGI_FORMAT bufferFormat);
|
2017-12-04 22:21:02 +01:00
|
|
|
|
2017-11-29 21:46:09 +01:00
|
|
|
private:
|
|
|
|
|
2017-12-03 20:23:26 +01:00
|
|
|
enum BindingIds : uint32_t {
|
|
|
|
Sampler = 0,
|
|
|
|
Texture = 1,
|
|
|
|
};
|
|
|
|
|
2017-11-29 21:46:09 +01:00
|
|
|
Rc<DxvkDevice> m_device;
|
2017-12-01 10:08:49 +01:00
|
|
|
Rc<DxvkContext> m_context;
|
2017-11-29 21:46:09 +01:00
|
|
|
|
|
|
|
Rc<DxvkSurface> m_surface;
|
|
|
|
Rc<DxvkSwapchain> m_swapchain;
|
|
|
|
|
2017-12-03 20:23:26 +01:00
|
|
|
Rc<DxvkSampler> m_sampler;
|
|
|
|
|
2017-12-12 00:27:49 +01:00
|
|
|
Rc<DxvkImage> m_backBuffer;
|
|
|
|
Rc<DxvkImage> m_backBufferResolve;
|
|
|
|
Rc<DxvkImageView> m_backBufferView;
|
|
|
|
|
2017-12-04 22:21:02 +01:00
|
|
|
VkSurfaceFormatKHR pickFormat(DXGI_FORMAT fmt) const;
|
|
|
|
|
2017-11-29 21:46:09 +01:00
|
|
|
Rc<DxvkShader> createVertexShader();
|
|
|
|
Rc<DxvkShader> createFragmentShader();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|