1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-08 10:46:09 +01:00
dxvk/src/dxgi/dxgi_swapchain.h

137 lines
3.8 KiB
C
Raw Normal View History

2017-10-11 16:22:13 +02:00
#pragma once
#include <memory>
#include <mutex>
#include <dxvk_surface.h>
#include <dxvk_swapchain.h>
2017-10-11 16:22:13 +02:00
#include "dxgi_interfaces.h"
#include "dxgi_object.h"
#include "dxgi_presenter.h"
2017-10-11 16:22:13 +02:00
#include "../d3d11/d3d11_interfaces.h"
#include "../spirv/spirv_module.h"
2017-10-11 16:22:13 +02:00
namespace dxvk {
class DxgiDevice;
2017-10-11 16:22:13 +02:00
class DxgiFactory;
class DxgiOutput;
2017-10-11 16:22:13 +02:00
class DxgiSwapChain : public DxgiObject<IDXGISwapChain> {
public:
DxgiSwapChain(
2018-04-14 12:02:55 +02:00
DxgiFactory* factory,
IUnknown* pDevice,
DXGI_SWAP_CHAIN_DESC* pDesc);
2017-10-11 16:22:13 +02:00
~DxgiSwapChain();
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE QueryInterface(
2018-04-14 12:02:55 +02:00
REFIID riid,
void** ppvObject) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE GetParent(
2018-04-14 12:02:55 +02:00
REFIID riid,
void** ppParent) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE GetDevice(
2018-04-14 12:02:55 +02:00
REFIID riid,
void** ppDevice) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE GetBuffer(
2018-04-14 12:02:55 +02:00
UINT Buffer,
REFIID riid,
void** ppSurface) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE GetContainingOutput(
2018-04-14 12:02:55 +02:00
IDXGIOutput** ppOutput) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE GetDesc(
2018-04-14 12:02:55 +02:00
DXGI_SWAP_CHAIN_DESC* pDesc) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE GetFrameStatistics(
2018-04-14 12:02:55 +02:00
DXGI_FRAME_STATISTICS* pStats) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE GetFullscreenState(
2018-04-14 12:02:55 +02:00
BOOL* pFullscreen,
IDXGIOutput** ppTarget) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE GetLastPresentCount(
2018-04-14 12:02:55 +02:00
UINT* pLastPresentCount) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE Present(
2018-04-14 12:02:55 +02:00
UINT SyncInterval,
UINT Flags) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE ResizeBuffers(
2018-04-14 12:02:55 +02:00
UINT BufferCount,
UINT Width,
UINT Height,
DXGI_FORMAT NewFormat,
UINT SwapChainFlags) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE ResizeTarget(
2018-04-14 12:02:55 +02:00
const DXGI_MODE_DESC* pNewTargetParameters) final;
2017-10-11 16:22:13 +02:00
2017-12-12 12:50:52 +01:00
HRESULT STDMETHODCALLTYPE SetFullscreenState(
2018-04-14 12:02:55 +02:00
BOOL Fullscreen,
IDXGIOutput* pTarget) final;
HRESULT SetGammaControl(
2018-04-14 12:02:55 +02:00
const DXGI_GAMMA_CONTROL* pGammaControl);
HRESULT SetDefaultGammaControl();
2017-10-11 16:22:13 +02:00
private:
struct WindowState {
uint32_t style = 0;
uint32_t exstyle = 0;
RECT rect = { 0, 0, 0, 0 };
};
std::recursive_mutex m_mutex;
Com<DxgiFactory> m_factory;
Com<DxgiAdapter> m_adapter;
Com<DxgiDevice> m_device;
Com<IDXGIVkPresenter> m_presentDevice;
2017-10-11 16:22:13 +02:00
DXGI_SWAP_CHAIN_DESC m_desc;
DXGI_FRAME_STATISTICS m_stats;
Rc<DxgiVkPresenter> m_presenter;
Com<IDXGIVkBackBuffer> m_backBuffer;
HMONITOR m_monitor;
WindowState m_windowState;
HRESULT CreatePresenter();
HRESULT CreateBackBuffer();
VkExtent2D GetWindowSize() const;
HRESULT EnterFullscreenMode(
IDXGIOutput *pTarget);
HRESULT LeaveFullscreenMode();
HRESULT ChangeDisplayMode(
IDXGIOutput* pOutput,
const DXGI_MODE_DESC* pDisplayMode);
HRESULT RestoreDisplayMode(
IDXGIOutput* pOutput);
HRESULT GetSampleCount(
UINT Count,
VkSampleCountFlagBits* pCount) const;
2017-10-11 16:22:13 +02:00
};
}