2017-10-11 16:22:13 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <mutex>
|
|
|
|
|
2017-11-26 18:38:50 +01:00
|
|
|
#include <dxvk_surface.h>
|
|
|
|
#include <dxvk_swapchain.h>
|
|
|
|
|
2017-10-11 16:22:13 +02:00
|
|
|
#include "dxgi_interfaces.h"
|
|
|
|
#include "dxgi_object.h"
|
2017-11-29 21:46:09 +01:00
|
|
|
#include "dxgi_presenter.h"
|
2017-10-11 16:22:13 +02:00
|
|
|
|
2017-11-29 07:55:44 +01:00
|
|
|
#include "../d3d11/d3d11_interfaces.h"
|
|
|
|
|
2017-11-29 21:46:09 +01:00
|
|
|
#include "../spirv/spirv_module.h"
|
|
|
|
|
2017-10-11 16:22:13 +02:00
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
class DxgiFactory;
|
|
|
|
|
|
|
|
class DxgiSwapChain : public DxgiObject<IDXGISwapChain> {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
DxgiSwapChain(
|
|
|
|
DxgiFactory* factory,
|
|
|
|
IUnknown* pDevice,
|
|
|
|
DXGI_SWAP_CHAIN_DESC* pDesc);
|
|
|
|
~DxgiSwapChain();
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(
|
2017-10-11 16:22:13 +02:00
|
|
|
REFIID riid,
|
|
|
|
void** ppvObject) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE GetParent(
|
2017-10-11 16:22:13 +02:00
|
|
|
REFIID riid,
|
|
|
|
void** ppParent) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE GetDevice(
|
2017-10-11 16:22:13 +02:00
|
|
|
REFIID riid,
|
|
|
|
void** ppDevice) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE GetBuffer(
|
2017-10-11 16:22:13 +02:00
|
|
|
UINT Buffer,
|
|
|
|
REFIID riid,
|
|
|
|
void** ppSurface) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE GetContainingOutput(
|
2017-10-11 16:22:13 +02:00
|
|
|
IDXGIOutput **ppOutput) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE GetDesc(
|
2017-10-11 16:22:13 +02:00
|
|
|
DXGI_SWAP_CHAIN_DESC *pDesc) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE GetFrameStatistics(
|
2017-10-11 16:22:13 +02:00
|
|
|
DXGI_FRAME_STATISTICS *pStats) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE GetFullscreenState(
|
2017-10-11 16:22:13 +02:00
|
|
|
BOOL *pFullscreen,
|
|
|
|
IDXGIOutput **ppTarget) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE GetLastPresentCount(
|
2017-10-11 16:22:13 +02:00
|
|
|
UINT *pLastPresentCount) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE Present(
|
2017-10-11 16:22:13 +02:00
|
|
|
UINT SyncInterval,
|
|
|
|
UINT Flags) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE ResizeBuffers(
|
2017-10-11 16:22:13 +02:00
|
|
|
UINT BufferCount,
|
|
|
|
UINT Width,
|
|
|
|
UINT Height,
|
|
|
|
DXGI_FORMAT NewFormat,
|
|
|
|
UINT SwapChainFlags) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE ResizeTarget(
|
2017-10-11 16:22:13 +02:00
|
|
|
const DXGI_MODE_DESC *pNewTargetParameters) final;
|
|
|
|
|
2017-12-12 12:50:52 +01:00
|
|
|
HRESULT STDMETHODCALLTYPE SetFullscreenState(
|
2017-10-11 16:22:13 +02:00
|
|
|
BOOL Fullscreen,
|
|
|
|
IDXGIOutput *pTarget) final;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2017-11-26 15:29:57 +01:00
|
|
|
std::mutex m_mutex;
|
|
|
|
|
2017-11-29 16:23:33 +01:00
|
|
|
Com<DxgiFactory> m_factory;
|
2017-12-04 11:33:04 +01:00
|
|
|
Com<IDXGIAdapterPrivate> m_adapter;
|
|
|
|
Com<IDXGIDevicePrivate> m_device;
|
|
|
|
Com<IDXGIPresentDevicePrivate> m_presentDevice;
|
2017-10-11 16:22:13 +02:00
|
|
|
|
2017-12-31 00:23:34 +01:00
|
|
|
DXGI_SWAP_CHAIN_DESC m_desc;
|
|
|
|
DXGI_FRAME_STATISTICS m_stats;
|
2017-11-26 15:29:57 +01:00
|
|
|
|
2017-12-31 00:23:34 +01:00
|
|
|
Rc<DxgiPresenter> m_presenter;
|
|
|
|
Com<IDXGIPresentBackBuffer> m_backBuffer;
|
2017-12-05 15:20:03 +01:00
|
|
|
|
2017-12-31 00:23:34 +01:00
|
|
|
HRESULT CreatePresenter();
|
|
|
|
HRESULT CreateBackBuffer();
|
2017-11-29 07:55:44 +01:00
|
|
|
|
2017-12-31 00:23:34 +01:00
|
|
|
VkExtent2D GetWindowSize() const;
|
2017-12-12 00:27:49 +01:00
|
|
|
|
|
|
|
HRESULT GetSampleCount(
|
|
|
|
UINT Count,
|
|
|
|
VkSampleCountFlagBits* pCount) const;
|
2017-12-04 22:21:02 +01:00
|
|
|
|
2017-10-11 16:22:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|