mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-22 06:26:30 +00:00
Update to D3D11.4 interfaces. Refs #864
* This is just a pass-through implementation as fences do not have to be serialised.
This commit is contained in:
@@ -102,11 +102,13 @@ WrappedID3D11DeviceContext::WrappedID3D11DeviceContext(WrappedID3D11Device *real
|
||||
m_pRealContext1 = NULL;
|
||||
m_pRealContext2 = NULL;
|
||||
m_pRealContext3 = NULL;
|
||||
m_pRealContext4 = NULL;
|
||||
if(m_pRealContext)
|
||||
{
|
||||
m_pRealContext->QueryInterface(__uuidof(ID3D11DeviceContext1), (void **)&m_pRealContext1);
|
||||
m_pRealContext->QueryInterface(__uuidof(ID3D11DeviceContext2), (void **)&m_pRealContext2);
|
||||
m_pRealContext->QueryInterface(__uuidof(ID3D11DeviceContext3), (void **)&m_pRealContext3);
|
||||
m_pRealContext->QueryInterface(__uuidof(ID3D11DeviceContext4), (void **)&m_pRealContext4);
|
||||
}
|
||||
|
||||
m_NeedUpdateSubWorkaround = false;
|
||||
@@ -205,6 +207,7 @@ WrappedID3D11DeviceContext::~WrappedID3D11DeviceContext()
|
||||
SAFE_RELEASE(m_pRealContext1);
|
||||
SAFE_RELEASE(m_pRealContext2);
|
||||
SAFE_RELEASE(m_pRealContext3);
|
||||
SAFE_RELEASE(m_pRealContext4);
|
||||
|
||||
SAFE_DELETE(m_DeferredSavedState);
|
||||
|
||||
@@ -1373,6 +1376,19 @@ HRESULT STDMETHODCALLTYPE WrappedID3D11DeviceContext::QueryInterface(REFIID riid
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
else if(riid == __uuidof(ID3D11DeviceContext4))
|
||||
{
|
||||
if(m_pRealContext4)
|
||||
{
|
||||
*ppvObject = (ID3D11DeviceContext4 *)this;
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
else if(riid == __uuidof(ID3D11Multithread))
|
||||
{
|
||||
RDCWARN("ID3D11Multithread is not supported");
|
||||
|
||||
@@ -98,7 +98,7 @@ enum CaptureFailReason
|
||||
CaptureFailed_UncappedCmdlist,
|
||||
};
|
||||
|
||||
class WrappedID3D11DeviceContext : public RefCounter, public ID3D11DeviceContext3
|
||||
class WrappedID3D11DeviceContext : public RefCounter, public ID3D11DeviceContext4
|
||||
{
|
||||
private:
|
||||
friend class WrappedID3D11DeviceContext;
|
||||
@@ -145,6 +145,7 @@ private:
|
||||
|
||||
ID3D11DeviceContext2 *m_pRealContext2;
|
||||
ID3D11DeviceContext3 *m_pRealContext3;
|
||||
ID3D11DeviceContext4 *m_pRealContext4;
|
||||
|
||||
bool m_NeedUpdateSubWorkaround;
|
||||
|
||||
@@ -888,4 +889,11 @@ public:
|
||||
virtual void STDMETHODCALLTYPE SetHardwareProtectionState(BOOL HwProtectionEnable);
|
||||
|
||||
virtual void STDMETHODCALLTYPE GetHardwareProtectionState(BOOL *pHwProtectionEnable);
|
||||
|
||||
//////////////////////////////
|
||||
// implement ID3D11DeviceContext4
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE Signal(ID3D11Fence *pFence, UINT64 Value);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE Wait(ID3D11Fence *pFence, UINT64 Value);
|
||||
};
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include "d3d11_context.h"
|
||||
#include "d3d11_resources.h"
|
||||
|
||||
/////////////////////////////////
|
||||
// implement ID3D11DeviceContext3
|
||||
@@ -49,4 +50,23 @@ void WrappedID3D11DeviceContext::GetHardwareProtectionState(BOOL *pHwProtectionE
|
||||
return;
|
||||
|
||||
m_pRealContext3->GetHardwareProtectionState(pHwProtectionEnable);
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
// implement ID3D11DeviceContext4
|
||||
|
||||
HRESULT WrappedID3D11DeviceContext::Signal(ID3D11Fence *pFence, UINT64 Value)
|
||||
{
|
||||
if(m_pRealContext4 == NULL)
|
||||
return E_NOINTERFACE;
|
||||
|
||||
return m_pRealContext4->Signal(UNWRAP(WrappedID3D11Fence, pFence), Value);
|
||||
}
|
||||
|
||||
HRESULT WrappedID3D11DeviceContext::Wait(ID3D11Fence *pFence, UINT64 Value)
|
||||
{
|
||||
if(m_pRealContext4 == NULL)
|
||||
return E_NOINTERFACE;
|
||||
|
||||
return m_pRealContext4->Wait(UNWRAP(WrappedID3D11Fence, pFence), Value);
|
||||
}
|
||||
@@ -79,12 +79,14 @@ WrappedID3D11Device::WrappedID3D11Device(ID3D11Device *realDevice, D3D11InitPara
|
||||
m_pDevice2 = NULL;
|
||||
m_pDevice3 = NULL;
|
||||
m_pDevice4 = NULL;
|
||||
m_pDevice5 = NULL;
|
||||
if(m_pDevice)
|
||||
{
|
||||
m_pDevice->QueryInterface(__uuidof(ID3D11Device1), (void **)&m_pDevice1);
|
||||
m_pDevice->QueryInterface(__uuidof(ID3D11Device2), (void **)&m_pDevice2);
|
||||
m_pDevice->QueryInterface(__uuidof(ID3D11Device3), (void **)&m_pDevice3);
|
||||
m_pDevice->QueryInterface(__uuidof(ID3D11Device4), (void **)&m_pDevice4);
|
||||
m_pDevice->QueryInterface(__uuidof(ID3D11Device5), (void **)&m_pDevice5);
|
||||
}
|
||||
|
||||
// refcounters implicitly construct with one reference, but we don't start with any soft
|
||||
@@ -249,6 +251,7 @@ WrappedID3D11Device::~WrappedID3D11Device()
|
||||
SAFE_RELEASE(m_pDevice2);
|
||||
SAFE_RELEASE(m_pDevice3);
|
||||
SAFE_RELEASE(m_pDevice4);
|
||||
SAFE_RELEASE(m_pDevice5);
|
||||
|
||||
SAFE_RELEASE(m_RealAnnotations);
|
||||
|
||||
@@ -552,6 +555,19 @@ HRESULT WrappedID3D11Device::QueryInterface(REFIID riid, void **ppvObject)
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
else if(riid == __uuidof(ID3D11Device5))
|
||||
{
|
||||
if(m_pDevice5)
|
||||
{
|
||||
AddRef();
|
||||
*ppvObject = (ID3D11Device5 *)this;
|
||||
return S_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
else if(riid == __uuidof(ID3D10Multithread))
|
||||
{
|
||||
RDCWARN(
|
||||
|
||||
@@ -304,7 +304,7 @@ struct DummyID3D11Debug : public ID3D11Debug
|
||||
class WrappedID3D11ClassLinkage;
|
||||
enum CaptureFailReason;
|
||||
|
||||
class WrappedID3D11Device : public IFrameCapturer, public ID3DDevice, public ID3D11Device4
|
||||
class WrappedID3D11Device : public IFrameCapturer, public ID3DDevice, public ID3D11Device5
|
||||
{
|
||||
private:
|
||||
enum
|
||||
@@ -348,6 +348,7 @@ private:
|
||||
ID3D11Device2 *m_pDevice2;
|
||||
ID3D11Device3 *m_pDevice3;
|
||||
ID3D11Device4 *m_pDevice4;
|
||||
ID3D11Device5 *m_pDevice5;
|
||||
ID3D11InfoQueue *m_pInfoQueue;
|
||||
WrappedID3D11DeviceContext *m_pImmediateContext;
|
||||
|
||||
@@ -876,4 +877,12 @@ public:
|
||||
virtual HRESULT STDMETHODCALLTYPE RegisterDeviceRemovedEvent(HANDLE hEvent, DWORD *pdwCookie);
|
||||
|
||||
virtual void STDMETHODCALLTYPE UnregisterDeviceRemoved(DWORD dwCookie);
|
||||
|
||||
//////////////////////////////
|
||||
// implement ID3D11Device5
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE CreateFence(UINT64 InitialValue, D3D11_FENCE_FLAG Flags,
|
||||
REFIID riid, void **ppFence);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE OpenSharedFence(HANDLE hFence, REFIID riid, void **ppFence);
|
||||
};
|
||||
@@ -998,6 +998,64 @@ void WrappedID3D11Device::UnregisterDeviceRemoved(DWORD dwCookie)
|
||||
return m_pDevice4->UnregisterDeviceRemoved(dwCookie);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ID3D11Device5 interface
|
||||
|
||||
HRESULT WrappedID3D11Device::CreateFence(UINT64 InitialValue, D3D11_FENCE_FLAG Flags, REFIID riid,
|
||||
void **ppFence)
|
||||
{
|
||||
if(m_pDevice5 == NULL)
|
||||
return E_NOINTERFACE;
|
||||
|
||||
if(ppFence == NULL)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if(riid != __uuidof(ID3D11Fence))
|
||||
{
|
||||
RDCERR("Unsupported UUID '%s' in WrappedID3D11Device::CreateFence", ToStr(riid).c_str());
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ID3D11Fence *ret = NULL;
|
||||
HRESULT hr = m_pDevice5->CreateFence(InitialValue, Flags, riid, (void **)&ret);
|
||||
|
||||
if(FAILED(hr) || ret == NULL)
|
||||
return hr;
|
||||
|
||||
WrappedID3D11Fence *wrapped = new WrappedID3D11Fence(ret, this);
|
||||
|
||||
*ppFence = (void *)wrapped;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT WrappedID3D11Device::OpenSharedFence(HANDLE hFence, REFIID riid, void **ppFence)
|
||||
{
|
||||
if(m_pDevice5 == NULL)
|
||||
return E_NOINTERFACE;
|
||||
|
||||
if(ppFence == NULL)
|
||||
return E_INVALIDARG;
|
||||
|
||||
if(riid != __uuidof(ID3D11Fence))
|
||||
{
|
||||
RDCERR("Unsupported UUID '%s' in WrappedID3D11Device::OpenSharedFence", ToStr(riid).c_str());
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ID3D11Fence *ret = NULL;
|
||||
HRESULT hr = m_pDevice5->OpenSharedFence(hFence, riid, (void **)&ret);
|
||||
|
||||
if(FAILED(hr) || ret == NULL)
|
||||
return hr;
|
||||
|
||||
WrappedID3D11Fence *wrapped = new WrappedID3D11Fence(ret, this);
|
||||
|
||||
*ppFence = (void *)wrapped;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#undef IMPLEMENT_FUNCTION_SERIALISED
|
||||
#define IMPLEMENT_FUNCTION_SERIALISED(ret, func, ...) \
|
||||
template bool WrappedID3D11Device::CONCAT(Serialise_, func(ReadSerialiser &ser, __VA_ARGS__)); \
|
||||
|
||||
@@ -56,6 +56,7 @@ WRAPPED_POOL_INST(WrappedID3D11Predicate);
|
||||
WRAPPED_POOL_INST(WrappedID3D11ClassInstance);
|
||||
WRAPPED_POOL_INST(WrappedID3D11ClassLinkage);
|
||||
WRAPPED_POOL_INST(WrappedID3DDeviceContextState);
|
||||
WRAPPED_POOL_INST(WrappedID3D11Fence);
|
||||
|
||||
map<ResourceId, WrappedID3D11Texture1D::TextureEntry>
|
||||
WrappedTexture<ID3D11Texture1D, D3D11_TEXTURE1D_DESC, ID3D11Texture1D>::m_TextureList;
|
||||
|
||||
@@ -1321,6 +1321,37 @@ public:
|
||||
virtual ~WrappedID3DDeviceContextState();
|
||||
};
|
||||
|
||||
class WrappedID3D11Fence : public WrappedDeviceChild11<ID3D11Fence>
|
||||
{
|
||||
public:
|
||||
ALLOCATE_WITH_WRAPPED_POOL(WrappedID3D11Fence);
|
||||
|
||||
WrappedID3D11Fence(ID3D11Fence *real, WrappedID3D11Device *device)
|
||||
: WrappedDeviceChild11(real, device)
|
||||
{
|
||||
}
|
||||
virtual ~WrappedID3D11Fence() { Shutdown(); }
|
||||
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject)
|
||||
{
|
||||
return WrappedDeviceChild11<ID3D11Fence>::QueryInterface(riid, ppvObject);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// implement ID3D11Fence
|
||||
virtual HRESULT STDMETHODCALLTYPE CreateSharedHandle(const SECURITY_ATTRIBUTES *pAttributes,
|
||||
DWORD dwAccess, LPCWSTR lpName,
|
||||
HANDLE *pHandle)
|
||||
{
|
||||
return m_pReal->CreateSharedHandle(pAttributes, dwAccess, lpName, pHandle);
|
||||
}
|
||||
|
||||
virtual UINT64 STDMETHODCALLTYPE GetCompletedValue() { return m_pReal->GetCompletedValue(); }
|
||||
virtual HRESULT STDMETHODCALLTYPE SetEventOnCompletion(UINT64 Value, HANDLE hEvent)
|
||||
{
|
||||
return m_pReal->SetEventOnCompletion(Value, hEvent);
|
||||
}
|
||||
};
|
||||
|
||||
#define GET_RANGE(wrapped, unwrapped) \
|
||||
template <> \
|
||||
inline const ResourceRange &GetResourceRange(unwrapped *v) \
|
||||
@@ -1413,6 +1444,7 @@ GET_RES_ID(WrappedID3D11ClassInstance);
|
||||
GET_RES_ID(WrappedID3D11ClassLinkage);
|
||||
GET_RES_ID(WrappedID3DDeviceContextState);
|
||||
GET_RES_ID(WrappedID3D11CommandList);
|
||||
GET_RES_ID(WrappedID3D11Fence);
|
||||
|
||||
// generic version that checks all the wrapped pools. We can use this for resource since it checks
|
||||
// buffer and textures first, and also for purely virtual interfaces like asynchronous even though
|
||||
|
||||
Reference in New Issue
Block a user