mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[d3d11] Add COM interface for API-agnostic presenter
This commit is contained in:
parent
64185d9be4
commit
967b276acb
@ -100,5 +100,22 @@ namespace dxvk {
|
|||||||
HRESULT STDMETHODCALLTYPE D3D11Presenter::GetDevice(REFGUID riid, void** ppvDevice) {
|
HRESULT STDMETHODCALLTYPE D3D11Presenter::GetDevice(REFGUID riid, void** ppvDevice) {
|
||||||
return m_device->QueryInterface(riid, ppvDevice);
|
return m_device->QueryInterface(riid, ppvDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE D3D11Presenter::CreateSwapChainForHwnd(
|
||||||
|
HWND hWnd,
|
||||||
|
const DXGI_SWAP_CHAIN_DESC1* pDesc,
|
||||||
|
IDXGIVkSwapChain** ppSwapChain) {
|
||||||
|
InitReturnPtr(ppSwapChain);
|
||||||
|
|
||||||
|
try {
|
||||||
|
*ppSwapChain = ref(new D3D11SwapChain(
|
||||||
|
static_cast<D3D11Device*>(m_device), hWnd, pDesc));
|
||||||
|
return S_OK;
|
||||||
|
} catch (const DxvkError& e) {
|
||||||
|
Logger::err(e.message());
|
||||||
|
return E_FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "../dxgi/dxgi_interfaces.h"
|
#include "../dxgi/dxgi_interfaces.h"
|
||||||
|
|
||||||
#include "d3d11_include.h"
|
#include "d3d11_include.h"
|
||||||
|
#include "d3d11_swapchain.h"
|
||||||
#include "d3d11_texture.h"
|
#include "d3d11_texture.h"
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
@ -63,6 +64,11 @@ namespace dxvk {
|
|||||||
REFGUID riid,
|
REFGUID riid,
|
||||||
void** ppvDevice);
|
void** ppvDevice);
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE CreateSwapChainForHwnd(
|
||||||
|
HWND hWnd,
|
||||||
|
const DXGI_SWAP_CHAIN_DESC1* pDesc,
|
||||||
|
IDXGIVkSwapChain** ppSwapChain);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
IDXGIObject* m_container;
|
IDXGIObject* m_container;
|
||||||
|
@ -39,6 +39,7 @@ d3d11_src = [
|
|||||||
'd3d11_sampler.cpp',
|
'd3d11_sampler.cpp',
|
||||||
'd3d11_shader.cpp',
|
'd3d11_shader.cpp',
|
||||||
'd3d11_state.cpp',
|
'd3d11_state.cpp',
|
||||||
|
'd3d11_swapchain.cpp',
|
||||||
'd3d11_texture.cpp',
|
'd3d11_texture.cpp',
|
||||||
'd3d11_util.cpp',
|
'd3d11_util.cpp',
|
||||||
'd3d11_view_dsv.cpp',
|
'd3d11_view_dsv.cpp',
|
||||||
@ -47,7 +48,7 @@ d3d11_src = [
|
|||||||
'd3d11_view_uav.cpp',
|
'd3d11_view_uav.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
d3d11_dll = shared_library('d3d11'+dll_ext, d3d11_src + d3d10_src,
|
d3d11_dll = shared_library('d3d11'+dll_ext, d3d11_src + d3d10_src, glsl_generator.process(dxgi_shaders),
|
||||||
name_prefix : '',
|
name_prefix : '',
|
||||||
dependencies : [ lib_dxgi, dxbc_dep, dxvk_dep ],
|
dependencies : [ lib_dxgi, dxbc_dep, dxvk_dep ],
|
||||||
include_directories : dxvk_include_path,
|
include_directories : dxvk_include_path,
|
||||||
|
@ -89,7 +89,7 @@ namespace dxvk {
|
|||||||
|
|
||||||
Rc<DxvkDevice> STDMETHODCALLTYPE GetDXVKDevice() final;
|
Rc<DxvkDevice> STDMETHODCALLTYPE GetDXVKDevice() final;
|
||||||
|
|
||||||
Rc<DxvkEvent> STDMETHODCALLTYPE GetFrameSyncEvent();
|
Rc<DxvkEvent> STDMETHODCALLTYPE GetFrameSyncEvent() final;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -10,11 +10,50 @@ namespace dxvk {
|
|||||||
class DxvkAdapter;
|
class DxvkAdapter;
|
||||||
class DxvkBuffer;
|
class DxvkBuffer;
|
||||||
class DxvkDevice;
|
class DxvkDevice;
|
||||||
|
class DxvkEvent;
|
||||||
class DxvkImage;
|
class DxvkImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IDXGIVkInteropDevice;
|
struct IDXGIVkInteropDevice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Private DXGI presenter
|
||||||
|
*
|
||||||
|
* Presenter interface that allows the DXGI swap
|
||||||
|
* chain implementation to remain API-agnostic,
|
||||||
|
* so that common code can stay in one class.
|
||||||
|
*/
|
||||||
|
MIDL_INTERFACE("104001a6-7f36-4957-b932-86ade9567d91")
|
||||||
|
IDXGIVkSwapChain : public IUnknown {
|
||||||
|
static const GUID guid;
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE GetDesc(
|
||||||
|
DXGI_SWAP_CHAIN_DESC1* pDesc) = 0;
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE GetImage(
|
||||||
|
UINT BufferId,
|
||||||
|
REFIID riid,
|
||||||
|
void** ppBuffer) = 0;
|
||||||
|
|
||||||
|
virtual UINT STDMETHODCALLTYPE GetImageIndex() = 0;
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE ChangeProperties(
|
||||||
|
const DXGI_SWAP_CHAIN_DESC1* pDesc) = 0;
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE SetPresentRegion(
|
||||||
|
const RECT* pRegion) = 0;
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE SetGammaControl(
|
||||||
|
UINT NumControlPoints,
|
||||||
|
const DXGI_RGB* pControlPoints) = 0;
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE Present(
|
||||||
|
UINT SyncInterval,
|
||||||
|
UINT PresentFlags,
|
||||||
|
const DXGI_PRESENT_PARAMETERS* pPresentParameters) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Private DXGI device interface
|
* \brief Private DXGI device interface
|
||||||
*
|
*
|
||||||
@ -29,6 +68,8 @@ IDXGIVkDevice : public IDXGIDevice2 {
|
|||||||
virtual ~IDXGIVkDevice() { }
|
virtual ~IDXGIVkDevice() { }
|
||||||
|
|
||||||
virtual dxvk::Rc<dxvk::DxvkDevice> STDMETHODCALLTYPE GetDXVKDevice() = 0;
|
virtual dxvk::Rc<dxvk::DxvkDevice> STDMETHODCALLTYPE GetDXVKDevice() = 0;
|
||||||
|
|
||||||
|
virtual dxvk::Rc<dxvk::DxvkEvent> STDMETHODCALLTYPE GetFrameSyncEvent() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -143,6 +184,11 @@ IDXGIVkPresenter : public IUnknown {
|
|||||||
virtual HRESULT STDMETHODCALLTYPE GetDevice(
|
virtual HRESULT STDMETHODCALLTYPE GetDevice(
|
||||||
REFGUID riid,
|
REFGUID riid,
|
||||||
void** ppDevice) = 0;
|
void** ppDevice) = 0;
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE CreateSwapChainForHwnd(
|
||||||
|
HWND hWnd,
|
||||||
|
const DXGI_SWAP_CHAIN_DESC1* pDesc,
|
||||||
|
IDXGIVkSwapChain** ppSwapChain) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -294,6 +340,7 @@ struct __declspec(uuid("5679becd-8547-4d93-96a1-e61a1ce7ef37")) IDXGIVkBackBuffe
|
|||||||
struct __declspec(uuid("79352328-16f2-4f81-9746-9c2e2ccd43cf")) IDXGIVkPresenter;
|
struct __declspec(uuid("79352328-16f2-4f81-9746-9c2e2ccd43cf")) IDXGIVkPresenter;
|
||||||
struct __declspec(uuid("e2ef5fa5-dc21-4af7-90c4-f67ef6a09323")) IDXGIVkInteropDevice;
|
struct __declspec(uuid("e2ef5fa5-dc21-4af7-90c4-f67ef6a09323")) IDXGIVkInteropDevice;
|
||||||
struct __declspec(uuid("5546cf8c-77e7-4341-b05d-8d4d5000e77d")) IDXGIVkInteropSurface;
|
struct __declspec(uuid("5546cf8c-77e7-4341-b05d-8d4d5000e77d")) IDXGIVkInteropSurface;
|
||||||
|
struct __declspec(uuid("104001a6-7f36-4957-b932-86ade9567d91")) IDXGIVkSwapChain;
|
||||||
#else
|
#else
|
||||||
DXVK_DEFINE_GUID(IDXGIVkAdapter);
|
DXVK_DEFINE_GUID(IDXGIVkAdapter);
|
||||||
DXVK_DEFINE_GUID(IDXGIVkDevice);
|
DXVK_DEFINE_GUID(IDXGIVkDevice);
|
||||||
@ -301,4 +348,5 @@ DXVK_DEFINE_GUID(IDXGIVkBackBuffer);
|
|||||||
DXVK_DEFINE_GUID(IDXGIVkPresenter);
|
DXVK_DEFINE_GUID(IDXGIVkPresenter);
|
||||||
DXVK_DEFINE_GUID(IDXGIVkInteropDevice);
|
DXVK_DEFINE_GUID(IDXGIVkInteropDevice);
|
||||||
DXVK_DEFINE_GUID(IDXGIVkInteropSurface);
|
DXVK_DEFINE_GUID(IDXGIVkInteropSurface);
|
||||||
|
DXVK_DEFINE_GUID(IDXGIVkSwapChain);
|
||||||
#endif
|
#endif
|
@ -10,6 +10,7 @@ const GUID IDXGIVkBackBuffer::guid = {0x5679becd,0x8547,0x4d93,{0x96,0xa1,0
|
|||||||
const GUID IDXGIVkPresenter::guid = {0x79352328,0x16f2,0x4f81,{0x97,0x46,0x9c,0x2e,0x2c,0xcd,0x43,0xcf}};
|
const GUID IDXGIVkPresenter::guid = {0x79352328,0x16f2,0x4f81,{0x97,0x46,0x9c,0x2e,0x2c,0xcd,0x43,0xcf}};
|
||||||
const GUID IDXGIVkInteropDevice::guid = {0xe2ef5fa5,0xdc21,0x4af7,{0x90,0xc4,0xf6,0x7e,0xf6,0xa0,0x93,0x23}};
|
const GUID IDXGIVkInteropDevice::guid = {0xe2ef5fa5,0xdc21,0x4af7,{0x90,0xc4,0xf6,0x7e,0xf6,0xa0,0x93,0x23}};
|
||||||
const GUID IDXGIVkInteropSurface::guid = {0x5546cf8c,0x77e7,0x4341,{0xb0,0x5d,0x8d,0x4d,0x50,0x00,0xe7,0x7d}};
|
const GUID IDXGIVkInteropSurface::guid = {0x5546cf8c,0x77e7,0x4341,{0xb0,0x5d,0x8d,0x4d,0x50,0x00,0xe7,0x7d}};
|
||||||
|
const GUID IDXGIVkSwapChain::guid = {0x104001a6,0x7f36,0x4957,{0xb9,0x32,0x86,0xad,0xe9,0x56,0x7d,0x91}};
|
||||||
|
|
||||||
std::ostream& operator << (std::ostream& os, REFIID guid) {
|
std::ostream& operator << (std::ostream& os, REFIID guid) {
|
||||||
os << std::hex << std::setfill('0')
|
os << std::hex << std::setfill('0')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user