mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-04 16:24:29 +01:00
[d3d11] Add stub IDXGIKeyedMutex interface. (#3601)
Partially based on a patch by Derek Lesho. Co-authored-by: Paul Gofman <pgofman@codeweavers.com>
This commit is contained in:
parent
549bd86f03
commit
cbda22a040
@ -6,9 +6,97 @@
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
D3D11DXGIKeyedMutex::D3D11DXGIKeyedMutex(
|
||||
ID3D11Resource* pResource)
|
||||
: m_resource(pResource) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
D3D11DXGIKeyedMutex::~D3D11DXGIKeyedMutex() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE D3D11DXGIKeyedMutex::AddRef() {
|
||||
return m_resource->AddRef();
|
||||
}
|
||||
|
||||
|
||||
ULONG STDMETHODCALLTYPE D3D11DXGIKeyedMutex::Release() {
|
||||
return m_resource->Release();
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11DXGIKeyedMutex::QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject) {
|
||||
return m_resource->QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11DXGIKeyedMutex::GetPrivateData(
|
||||
REFGUID Name,
|
||||
UINT* pDataSize,
|
||||
void* pData) {
|
||||
return m_resource->GetPrivateData(Name, pDataSize, pData);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11DXGIKeyedMutex::SetPrivateData(
|
||||
REFGUID Name,
|
||||
UINT DataSize,
|
||||
const void* pData) {
|
||||
return m_resource->SetPrivateData(Name, DataSize, pData);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11DXGIKeyedMutex::SetPrivateDataInterface(
|
||||
REFGUID Name,
|
||||
const IUnknown* pUnknown) {
|
||||
return m_resource->SetPrivateDataInterface(Name, pUnknown);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11DXGIKeyedMutex::GetParent(
|
||||
REFIID riid,
|
||||
void** ppParent) {
|
||||
return GetDevice(riid, ppParent);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11DXGIKeyedMutex::GetDevice(
|
||||
REFIID riid,
|
||||
void** ppDevice) {
|
||||
Com<ID3D11Device> device;
|
||||
m_resource->GetDevice(&device);
|
||||
return device->QueryInterface(riid, ppDevice);
|
||||
}
|
||||
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11DXGIKeyedMutex::AcquireSync(
|
||||
UINT64 Key,
|
||||
DWORD dwMilliseconds) {
|
||||
if (!m_warned) {
|
||||
m_warned = true;
|
||||
Logger::err("D3D11DXGIKeyedMutex::AcquireSync: Stub");
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT STDMETHODCALLTYPE D3D11DXGIKeyedMutex::ReleaseSync(
|
||||
UINT64 Key) {
|
||||
if (!m_warned) {
|
||||
m_warned = true;
|
||||
Logger::err("D3D11DXGIKeyedMutex::AcquireSync: Stub");
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
D3D11DXGIResource::D3D11DXGIResource(
|
||||
ID3D11Resource* pResource)
|
||||
: m_resource(pResource) {
|
||||
: m_resource(pResource),
|
||||
m_keyedMutex(pResource) {
|
||||
|
||||
}
|
||||
|
||||
@ -176,6 +264,16 @@ namespace dxvk {
|
||||
}
|
||||
|
||||
|
||||
HRESULT D3D11DXGIResource::GetKeyedMutex(
|
||||
void **ppvObject) {
|
||||
auto texture = GetCommonTexture(m_resource);
|
||||
if (texture == nullptr || !(texture->Desc()->MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX))
|
||||
return E_NOINTERFACE;
|
||||
*ppvObject = ref(&m_keyedMutex);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT GetResource11on12Info(
|
||||
ID3D11Resource* pResource,
|
||||
D3D11_ON_12_RESOURCE_INFO* p11on12Info) {
|
||||
|
@ -22,6 +22,62 @@ namespace dxvk {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief IDXGIKeyedMutex implementation
|
||||
*/
|
||||
class D3D11DXGIKeyedMutex : public IDXGIKeyedMutex {
|
||||
|
||||
public:
|
||||
|
||||
D3D11DXGIKeyedMutex(
|
||||
ID3D11Resource* pResource);
|
||||
|
||||
~D3D11DXGIKeyedMutex();
|
||||
|
||||
ULONG STDMETHODCALLTYPE AddRef();
|
||||
|
||||
ULONG STDMETHODCALLTYPE Release();
|
||||
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(
|
||||
REFIID riid,
|
||||
void** ppvObject);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetPrivateData(
|
||||
REFGUID Name,
|
||||
UINT* pDataSize,
|
||||
void* pData);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateData(
|
||||
REFGUID Name,
|
||||
UINT DataSize,
|
||||
const void* pData);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE SetPrivateDataInterface(
|
||||
REFGUID Name,
|
||||
const IUnknown* pUnknown);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetParent(
|
||||
REFIID riid,
|
||||
void** ppParent);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE GetDevice(
|
||||
REFIID riid,
|
||||
void** ppDevice);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE AcquireSync(
|
||||
UINT64 Key,
|
||||
DWORD dwMilliseconds);
|
||||
|
||||
HRESULT STDMETHODCALLTYPE ReleaseSync(
|
||||
UINT64 Key);
|
||||
|
||||
private:
|
||||
|
||||
ID3D11Resource* m_resource;
|
||||
bool m_warned = false;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief IDXGIResource implementation for D3D11 resources
|
||||
*/
|
||||
@ -86,9 +142,12 @@ namespace dxvk {
|
||||
UINT index,
|
||||
IDXGISurface2** ppSurface);
|
||||
|
||||
HRESULT GetKeyedMutex(void **ppvObject);
|
||||
|
||||
private:
|
||||
|
||||
ID3D11Resource* m_resource;
|
||||
D3D11DXGIKeyedMutex m_keyedMutex;
|
||||
|
||||
};
|
||||
|
||||
@ -272,4 +331,4 @@ namespace dxvk {
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1146,7 +1146,10 @@ namespace dxvk {
|
||||
*ppvObject = ref(&m_resource);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
if (riid == __uuidof(IDXGIKeyedMutex))
|
||||
return m_resource.GetKeyedMutex(ppvObject);
|
||||
|
||||
if (riid == __uuidof(IDXGIVkInteropSurface)) {
|
||||
*ppvObject = ref(&m_interop);
|
||||
return S_OK;
|
||||
@ -1307,6 +1310,9 @@ namespace dxvk {
|
||||
*ppvObject = ref(&m_resource);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
if (riid == __uuidof(IDXGIKeyedMutex))
|
||||
return m_resource.GetKeyedMutex(ppvObject);
|
||||
|
||||
if (riid == __uuidof(IDXGIVkInteropSurface)) {
|
||||
*ppvObject = ref(&m_interop);
|
||||
@ -1418,7 +1424,10 @@ namespace dxvk {
|
||||
*ppvObject = ref(&m_resource);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
if (riid == __uuidof(IDXGIKeyedMutex))
|
||||
return m_resource.GetKeyedMutex(ppvObject);
|
||||
|
||||
if (riid == __uuidof(IDXGIVkInteropSurface)) {
|
||||
*ppvObject = ref(&m_interop);
|
||||
return S_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user