mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-11-29 19:24:10 +01:00
[d3d11] Introduce COM interface to set and get API version
Allows us to identify DirectX 10 applications correctly.
This commit is contained in:
parent
1e6ad0b372
commit
be16da37d7
@ -47,6 +47,10 @@ extern "C" {
|
||||
d3d11Device->QueryInterface(__uuidof(ID3D10Multithread), reinterpret_cast<void**>(&multithread));
|
||||
multithread->SetMultithreadProtected(!(Flags & D3D10_CREATE_DEVICE_SINGLETHREADED));
|
||||
|
||||
Com<IDXGIDXVKDevice> dxvkDevice;
|
||||
d3d11Device->QueryInterface(__uuidof(IDXGIDXVKDevice), reinterpret_cast<void**>(&dxvkDevice));
|
||||
dxvkDevice->SetAPIVersion(10);
|
||||
|
||||
if (FAILED(d3d11Device->QueryInterface(
|
||||
__uuidof(ID3D10Device), reinterpret_cast<void**>(ppDevice))))
|
||||
return E_FAIL;
|
||||
|
@ -2450,6 +2450,41 @@ namespace dxvk {
|
||||
|
||||
|
||||
|
||||
DXGIDXVKDevice::DXGIDXVKDevice(D3D11DXGIDevice* pContainer)
|
||||
: m_container(pContainer), m_apiVersion(11) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE DXGIDXVKDevice::AddRef() {
|
||||
return m_container->AddRef();
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE DXGIDXVKDevice::Release() {
|
||||
return m_container->Release();
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE DXGIDXVKDevice::QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject) {
|
||||
return m_container->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
|
||||
void STDMETHODCALLTYPE DXGIDXVKDevice::SetAPIVersion(
|
||||
UINT Version) {
|
||||
m_apiVersion = Version;
|
||||
}
|
||||
|
||||
|
||||
UINT STDMETHODCALLTYPE DXGIDXVKDevice::GetAPIVersion() {
|
||||
return m_apiVersion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
D3D11DXGIDevice::D3D11DXGIDevice(
|
||||
IDXGIAdapter* pAdapter,
|
||||
@ -2464,6 +2499,7 @@ namespace dxvk {
|
||||
m_d3d11Device (this, FeatureLevel, FeatureFlags),
|
||||
m_d3d11DeviceExt(this, &m_d3d11Device),
|
||||
m_d3d11Interop (this, &m_d3d11Device),
|
||||
m_metaDevice (this),
|
||||
m_wineFactory (this, &m_d3d11Device) {
|
||||
|
||||
}
|
||||
@ -2517,6 +2553,11 @@ namespace dxvk {
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (riid == __uuidof(IDXGIDXVKDevice)) {
|
||||
*ppvObject = ref(&m_metaDevice);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (riid == __uuidof(IWineDXGISwapChainFactory)) {
|
||||
*ppvObject = ref(&m_wineFactory);
|
||||
return S_OK;
|
||||
|
@ -552,6 +552,36 @@ namespace dxvk {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief D3D11 device metadata shenanigans
|
||||
*/
|
||||
class DXGIDXVKDevice : public IDXGIDXVKDevice {
|
||||
|
||||
public:
|
||||
|
||||
DXGIDXVKDevice(D3D11DXGIDevice* pContainer);
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef();
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject);
|
||||
|
||||
void STDMETHODCALLTYPE SetAPIVersion(
|
||||
UINT Version);
|
||||
|
||||
UINT STDMETHODCALLTYPE GetAPIVersion();
|
||||
|
||||
private:
|
||||
|
||||
D3D11DXGIDevice* m_container;
|
||||
UINT m_apiVersion;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief D3D11 device container
|
||||
*
|
||||
@ -645,6 +675,7 @@ namespace dxvk {
|
||||
D3D11Device m_d3d11Device;
|
||||
D3D11DeviceExt m_d3d11DeviceExt;
|
||||
D3D11VkInterop m_d3d11Interop;
|
||||
DXGIDXVKDevice m_metaDevice;
|
||||
|
||||
WineDXGISwapChainFactory m_wineFactory;
|
||||
|
||||
|
@ -98,6 +98,21 @@ IDXGIDXVKAdapter : public IDXGIAdapter3 {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Private DXGI device interface
|
||||
*/
|
||||
MIDL_INTERFACE("92a5d77b-b6e1-420a-b260-fdd701272827")
|
||||
IDXGIDXVKDevice : public IUnknown {
|
||||
static const GUID guid;
|
||||
|
||||
virtual void STDMETHODCALLTYPE SetAPIVersion(
|
||||
UINT Version) = 0;
|
||||
|
||||
virtual UINT STDMETHODCALLTYPE GetAPIVersion() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Private DXGI monitor info interface
|
||||
*
|
||||
@ -329,6 +344,7 @@ IWineDXGISwapChainFactory : public IUnknown {
|
||||
|
||||
#ifdef _MSC_VER
|
||||
struct __declspec(uuid("907bf281-ea3c-43b4-a8e4-9f231107b4ff")) IDXGIDXVKAdapter;
|
||||
struct __declspec(uuid("92a5d77b-b6e1-420a-b260-fdd701272827")) IDXGIDXVKDevice;
|
||||
struct __declspec(uuid("c06a236f-5be3-448a-8943-89c611c0c2c1")) IDXGIVkMonitorInfo;
|
||||
struct __declspec(uuid("3a6d8f2c-b0e8-4ab4-b4dc-4fd24891bfa5")) IDXGIVkInteropAdapter;
|
||||
struct __declspec(uuid("e2ef5fa5-dc21-4af7-90c4-f67ef6a09323")) IDXGIVkInteropDevice;
|
||||
@ -337,6 +353,7 @@ struct __declspec(uuid("104001a6-7f36-4957-b932-86ade9567d91")) IDXGIVkSwapChain
|
||||
struct __declspec(uuid("53cb4ff0-c25a-4164-a891-0e83db0a7aac")) IWineDXGISwapChainFactory;
|
||||
#else
|
||||
DXVK_DEFINE_GUID(IDXGIDXVKAdapter);
|
||||
DXVK_DEFINE_GUID(IDXGIDXVKDevice);
|
||||
DXVK_DEFINE_GUID(IDXGIVkMonitorInfo);
|
||||
DXVK_DEFINE_GUID(IDXGIVkInteropAdapter);
|
||||
DXVK_DEFINE_GUID(IDXGIVkInteropDevice);
|
||||
|
@ -7,6 +7,7 @@
|
||||
const GUID ID3D11VkExtDevice::guid = {0x8a6e3c42,0xf74c,0x45b7,{0x82,0x65,0xa2,0x31,0xb6,0x77,0xca,0x17}};
|
||||
const GUID ID3D11VkExtContext::guid = {0xfd0bca13,0x5cb6,0x4c3a,{0x98,0x7e,0x47,0x50,0xde,0x2c,0xa7,0x91}};
|
||||
const GUID IDXGIDXVKAdapter::guid = {0x907bf281,0xea3c,0x43b4,{0xa8,0xe4,0x9f,0x23,0x11,0x07,0xb4,0xff}};
|
||||
const GUID IDXGIDXVKDevice::guid = {0x92a5d77b,0xb6e1,0x420a,{0xb2,0x60,0xfd,0xf7,0x01,0x27,0x28,0x27}};
|
||||
const GUID IDXGIVkMonitorInfo::guid = {0xc06a236f,0x5be3,0x448a,{0x89,0x43,0x89,0xc6,0x11,0xc0,0xc2,0xc1}};
|
||||
const GUID IDXGIVkInteropAdapter::guid = {0x3a6d8f2c,0xb0e8,0x4ab4,{0xb4,0xdc,0x4f,0xd2,0x48,0x91,0xbf,0xa5}};
|
||||
const GUID IDXGIVkInteropDevice::guid = {0xe2ef5fa5,0xdc21,0x4af7,{0x90,0xc4,0xf6,0x7e,0xf6,0xa0,0x93,0x23}};
|
||||
|
Loading…
Reference in New Issue
Block a user