1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-04 16:24:29 +01:00

[dxgi, d3d11] Remove support for legacy IWineDXGISwapChainFactory interface

vkd3d-proton 2.8 released last year with support for the new swapchain
interface.

No need to keep support for this legacy interface hanging around when
it complicates adding DxgiOptions support to the swapchain.
This commit is contained in:
Joshua Ashton 2023-01-16 02:31:36 +00:00 committed by Philip Rebohle
parent af05265cb6
commit 9010f11adf
5 changed files with 1 additions and 154 deletions

View File

@ -3019,85 +3019,6 @@ namespace dxvk {
WineDXGISwapChainFactory::WineDXGISwapChainFactory(
D3D11DXGIDevice* pContainer,
D3D11Device* pDevice)
: m_container(pContainer), m_device(pDevice) {
}
ULONG STDMETHODCALLTYPE WineDXGISwapChainFactory::AddRef() {
return m_device->AddRef();
}
ULONG STDMETHODCALLTYPE WineDXGISwapChainFactory::Release() {
return m_device->Release();
}
HRESULT STDMETHODCALLTYPE WineDXGISwapChainFactory::QueryInterface(
REFIID riid,
void** ppvObject) {
return m_device->QueryInterface(riid, ppvObject);
}
HRESULT STDMETHODCALLTYPE WineDXGISwapChainFactory::CreateSwapChainForHwnd(
IDXGIFactory* pFactory,
HWND hWnd,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) {
InitReturnPtr(ppSwapChain);
if (!ppSwapChain || !pDesc || !hWnd)
return DXGI_ERROR_INVALID_CALL;
// Make sure the back buffer size is not zero
DXGI_SWAP_CHAIN_DESC1 desc = *pDesc;
wsi::getWindowSize(hWnd,
desc.Width ? nullptr : &desc.Width,
desc.Height ? nullptr : &desc.Height);
// If necessary, set up a default set of
// fullscreen parameters for the swap chain
DXGI_SWAP_CHAIN_FULLSCREEN_DESC fsDesc;
if (pFullscreenDesc) {
fsDesc = *pFullscreenDesc;
} else {
fsDesc.RefreshRate = { 0, 0 };
fsDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
fsDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
fsDesc.Windowed = TRUE;
}
try {
auto vki = m_device->GetDXVKDevice()->adapter()->vki();
// Create surface factory for the window
Com<IDXGIVkSurfaceFactory> surfaceFactory = new DxgiSurfaceFactory(vki->getLoaderProc(), hWnd);
// Create presenter for the device
Com<D3D11SwapChain> presenter = new D3D11SwapChain(
m_container, m_device, surfaceFactory.ptr(), &desc);
// Create the actual swap chain
*ppSwapChain = ref(new DxgiSwapChain(
pFactory, presenter.ptr(), hWnd, &desc, &fsDesc));
return S_OK;
} catch (const DxvkError& e) {
Logger::err(e.message());
return E_INVALIDARG;
}
}
DXGIDXVKDevice::DXGIDXVKDevice(D3D11DXGIDevice* pContainer)
: m_container(pContainer), m_apiVersion(11) {
@ -3149,8 +3070,7 @@ namespace dxvk {
m_d3d11Interop (this, &m_d3d11Device),
m_d3d11Video (this, &m_d3d11Device),
m_metaDevice (this),
m_dxvkFactory (this, &m_d3d11Device),
m_wineFactory (this, &m_d3d11Device) {
m_dxvkFactory (this, &m_d3d11Device) {
}
@ -3215,11 +3135,6 @@ namespace dxvk {
return S_OK;
}
if (riid == __uuidof(IWineDXGISwapChainFactory)) {
*ppvObject = ref(&m_wineFactory);
return S_OK;
}
if (riid == __uuidof(ID3D11VideoDevice)) {
*ppvObject = ref(&m_d3d11Video);
return S_OK;

View File

@ -722,41 +722,6 @@ namespace dxvk {
};
/**
* \brief DXGI swap chain factory
*/
class WineDXGISwapChainFactory : public IWineDXGISwapChainFactory {
public:
WineDXGISwapChainFactory(
D3D11DXGIDevice* pContainer,
D3D11Device* pDevice);
ULONG STDMETHODCALLTYPE AddRef();
ULONG STDMETHODCALLTYPE Release();
HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject);
HRESULT STDMETHODCALLTYPE CreateSwapChainForHwnd(
IDXGIFactory* pFactory,
HWND hWnd,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain);
private:
D3D11DXGIDevice* m_container;
D3D11Device* m_device;
};
/**
* \brief D3D11 device metadata shenanigans
*/
@ -884,7 +849,6 @@ namespace dxvk {
DXGIDXVKDevice m_metaDevice;
DXGIVkSwapChainFactory m_dxvkFactory;
WineDXGISwapChainFactory m_wineFactory;
uint32_t m_frameLatency = DefaultFrameLatency;

View File

@ -2,9 +2,6 @@ d3d11_res = wrc_generator.process('version.rc')
dxgi_common_src = [
'../dxgi/dxgi_format.cpp',
'../dxgi/dxgi_monitor.cpp',
'../dxgi/dxgi_surface.cpp',
'../dxgi/dxgi_swapchain.cpp',
]
d3d10_src = [

View File

@ -151,7 +151,6 @@ namespace dxvk {
Com<IDXGISwapChain4> frontendSwapChain;
Com<IDXGIVkSwapChainFactory> dxvkFactory;
Com<IWineDXGISwapChainFactory> wineFactory;
if (SUCCEEDED(pDevice->QueryInterface(IID_PPV_ARGS(&dxvkFactory)))) {
Com<IDXGIVkSurfaceFactory> surfaceFactory = new DxgiSurfaceFactory(
@ -166,14 +165,6 @@ namespace dxvk {
}
frontendSwapChain = new DxgiSwapChain(this, presenter.ptr(), hWnd, &desc, &fsDesc);
} else if (SUCCEEDED(pDevice->QueryInterface(IID_PPV_ARGS(&wineFactory)))) {
HRESULT hr = wineFactory->CreateSwapChainForHwnd(this, hWnd, &desc, &fsDesc,
pRestrictToOutput, reinterpret_cast<IDXGISwapChain1**>(&frontendSwapChain));
if (FAILED(hr)) {
Logger::err(str::format("DXGI: CreateSwapChainForHwnd: Failed to create swap chain, hr ", hr));
return hr;
}
} else {
Logger::err("DXGI: CreateSwapChainForHwnd: Unsupported device type");
return DXGI_ERROR_UNSUPPORTED;

View File

@ -409,24 +409,6 @@ IDXGIVkInteropAdapter : public IUnknown {
};
/**
* \brief IWineDXGISwapChainFactory device interface
*
* Allows a swap chain to be created from a device.
* See include/wine/winedxgi.idl for definition.
*/
MIDL_INTERFACE("53cb4ff0-c25a-4164-a891-0e83db0a7aac")
IWineDXGISwapChainFactory : public IUnknown {
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForHwnd(
IDXGIFactory* pFactory,
HWND hWnd,
const DXGI_SWAP_CHAIN_DESC1* pDesc,
const DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pFullscreenDesc,
IDXGIOutput* pRestrictToOutput,
IDXGISwapChain1** ppSwapChain) = 0;
};
#ifdef _MSC_VER
struct __declspec(uuid("907bf281-ea3c-43b4-a8e4-9f231107b4ff")) IDXGIDXVKAdapter;
struct __declspec(uuid("92a5d77b-b6e1-420a-b260-fdd701272827")) IDXGIDXVKDevice;
@ -438,7 +420,6 @@ struct __declspec(uuid("5546cf8c-77e7-4341-b05d-8d4d5000e77d")) IDXGIVkInteropSu
struct __declspec(uuid("1e7895a1-1bc3-4f9c-a670-290a4bc9581a")) IDXGIVkSurfaceFactory;
struct __declspec(uuid("e4a9059e-b569-46ab-8de7-501bd2bc7f7a")) IDXGIVkSwapChain;
struct __declspec(uuid("e7d6c3ca-23a0-4e08-9f2f-ea5231df6633")) IDXGIVkSwapChainFactory;
struct __declspec(uuid("53cb4ff0-c25a-4164-a891-0e83db0a7aac")) IWineDXGISwapChainFactory;
#else
__CRT_UUID_DECL(IDXGIDXVKAdapter, 0x907bf281,0xea3c,0x43b4,0xa8,0xe4,0x9f,0x23,0x11,0x07,0xb4,0xff);
__CRT_UUID_DECL(IDXGIDXVKDevice, 0x92a5d77b,0xb6e1,0x420a,0xb2,0x60,0xfd,0xf7,0x01,0x27,0x28,0x27);
@ -450,5 +431,4 @@ __CRT_UUID_DECL(IDXGIVkInteropSurface, 0x5546cf8c,0x77e7,0x4341,0xb0,0x5d,0x
__CRT_UUID_DECL(IDXGIVkSurfaceFactory, 0x1e7895a1,0x1bc3,0x4f9c,0xa6,0x70,0x29,0x0a,0x4b,0xc9,0x58,0x1a);
__CRT_UUID_DECL(IDXGIVkSwapChain, 0xe4a9059e,0xb569,0x46ab,0x8d,0xe7,0x50,0x1b,0xd2,0xbc,0x7f,0x7a);
__CRT_UUID_DECL(IDXGIVkSwapChainFactory, 0xe7d6c3ca,0x23a0,0x4e08,0x9f,0x2f,0xea,0x52,0x31,0xdf,0x66,0x33);
__CRT_UUID_DECL(IWineDXGISwapChainFactory, 0x53cb4ff0,0xc25a,0x4164,0xa8,0x91,0x0e,0x83,0xdb,0x0a,0x7a,0xac);
#endif