Allow a back-door UUID to query for the real ID3D11InfoQueue. Refs #418

* The user is responsible for making sure they don't break anything by
  getting the real interface - ie. not querying for anything else.
  Likewise the normal ability to record debug messages will be changed
  if they add any filters or retrieve messages before RenderDoc records
  them when capturing.
* API Validation still must be enabled via RenderDoc's capture options
  before device creation, one way or another.
This commit is contained in:
baldurk
2016-11-07 18:14:16 +01:00
parent 8d0915401f
commit bcc2eec252
+31 -1
View File
@@ -623,6 +623,10 @@ HRESULT WrappedID3D11Device::QueryInterface(REFIID riid, void **ppvObject)
static const GUID IRenderDoc_uuid = {
0xa7aa6116, 0x9c8d, 0x4bba, {0x90, 0x83, 0xb4, 0xd8, 0x16, 0xb7, 0x1b, 0x78}};
// UUID for returning unwrapped ID3D11InfoQueue {3FC4E618-3F70-452A-8B8F-A73ACCB58E3D}
static const GUID unwrappedID3D11InfoQueue__uuid = {
0x3fc4e618, 0x3f70, 0x452a, {0x8b, 0x8f, 0xa7, 0x3a, 0xcc, 0xb5, 0x8e, 0x3d}};
HRESULT hr = S_OK;
if(riid == __uuidof(IUnknown))
@@ -785,11 +789,37 @@ HRESULT WrappedID3D11Device::QueryInterface(REFIID riid, void **ppvObject)
else if(riid == __uuidof(ID3D11InfoQueue))
{
RDCWARN(
"Returning a dummy ID3D11InfoQueue that does nothing. This ID3D11InfoQueue will not work!");
"Returning a dummy ID3D11InfoQueue that does nothing. RenderDoc takes control of the debug "
"layer.");
RDCWARN(
"If you want direct access, enable API validation and query for %s. This will return the "
"real ID3D11InfoQueue - be careful as it is unwrapped so you should not call "
"QueryInterface on it.",
ToStr::Get(unwrappedID3D11InfoQueue__uuid).c_str());
*ppvObject = (ID3D11InfoQueue *)&m_DummyInfoQueue;
m_DummyInfoQueue.AddRef();
return S_OK;
}
else if(riid == unwrappedID3D11InfoQueue__uuid)
{
if(m_pInfoQueue)
{
*ppvObject = m_pInfoQueue;
m_pInfoQueue->AddRef();
return S_OK;
}
else
{
if(!RenderDoc::Inst().GetCaptureOptions().APIValidation)
{
RDCWARN("API Validation is not enabled, RenderDoc disabled the debug layer.");
RDCWARN(
"Enable this either in the capture options, or using the RenderDoc API before device "
"creation.");
}
return E_NOINTERFACE;
}
}
else if(riid == __uuidof(ID3D11Debug))
{
// we queryinterface for this at startup, so if it's present we can