Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/doitsujin/dxvk.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgofman <gofmanp@gmail.com>2023-08-07 18:23:32 +0300
committerGitHub <noreply@github.com>2023-08-07 18:23:32 +0300
commitcbda22a0405c4eddc01f27455aaa8e02ee0d2076 (patch)
treec86a7753a803bcfc71c386f2a61d1b30367c6abf
parent549bd86f03d1f80d16264199d65f8822671503c9 (diff)
[d3d11] Add stub IDXGIKeyedMutex interface. (#3601)
Partially based on a patch by Derek Lesho. Co-authored-by: Paul Gofman <pgofman@codeweavers.com>
-rw-r--r--src/d3d11/d3d11_resource.cpp100
-rw-r--r--src/d3d11/d3d11_resource.h61
-rw-r--r--src/d3d11/d3d11_texture.cpp13
3 files changed, 170 insertions, 4 deletions
diff --git a/src/d3d11/d3d11_resource.cpp b/src/d3d11/d3d11_resource.cpp
index 975e16b0..ba252692 100644
--- a/src/d3d11/d3d11_resource.cpp
+++ b/src/d3d11/d3d11_resource.cpp
@@ -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) {
diff --git a/src/d3d11/d3d11_resource.h b/src/d3d11/d3d11_resource.h
index db45a96c..0c459ca3 100644
--- a/src/d3d11/d3d11_resource.h
+++ b/src/d3d11/d3d11_resource.h
@@ -23,6 +23,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
*/
class D3D11DXGIResource : public IDXGIResource1 {
@@ -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 {
};
-} \ No newline at end of file
+}
diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp
index 9302b1d3..7a8c6043 100644
--- a/src/d3d11/d3d11_texture.cpp
+++ b/src/d3d11/d3d11_texture.cpp
@@ -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;