#pragma once #include #include #include #include #include "dxgi_interfaces.h" #include "dxgi_object.h" #include "dxgi_presenter.h" #include "../d3d11/d3d11_interfaces.h" #include "../spirv/spirv_module.h" namespace dxvk { class DxgiFactory; class DxgiSwapChain : public DxgiObject { public: DxgiSwapChain( DxgiFactory* factory, IUnknown* pDevice, DXGI_SWAP_CHAIN_DESC* pDesc); ~DxgiSwapChain(); HRESULT QueryInterface( REFIID riid, void** ppvObject) final; HRESULT GetParent( REFIID riid, void** ppParent) final; HRESULT GetDevice( REFIID riid, void** ppDevice) final; HRESULT GetBuffer( UINT Buffer, REFIID riid, void** ppSurface) final; HRESULT GetContainingOutput( IDXGIOutput **ppOutput) final; HRESULT GetDesc( DXGI_SWAP_CHAIN_DESC *pDesc) final; HRESULT GetFrameStatistics( DXGI_FRAME_STATISTICS *pStats) final; HRESULT GetFullscreenState( BOOL *pFullscreen, IDXGIOutput **ppTarget) final; HRESULT GetLastPresentCount( UINT *pLastPresentCount) final; HRESULT Present( UINT SyncInterval, UINT Flags) final; HRESULT ResizeBuffers( UINT BufferCount, UINT Width, UINT Height, DXGI_FORMAT NewFormat, UINT SwapChainFlags) final; HRESULT ResizeTarget( const DXGI_MODE_DESC *pNewTargetParameters) final; HRESULT SetFullscreenState( BOOL Fullscreen, IDXGIOutput *pTarget) final; private: std::mutex m_mutex; Com m_factory; Com m_adapter; Com m_device; Com m_presentDevice; DXGI_SWAP_CHAIN_DESC m_desc; DXGI_FRAME_STATISTICS m_stats; Rc m_context; Rc m_commandList; Rc m_surface; Rc m_swapchain; Rc m_acquireSync; Rc m_presentSync; Rc m_presenter; Rc m_backBuffer; Rc m_backBufferView; Com m_backBufferIface; void createPresenter(); void createBackBuffer(); void createContext(); VkExtent2D getWindowSize() const; }; }