Catch FinishCommandList calls on immediate context, and throw an error

This commit is contained in:
baldurk committed 2015-09-24 18:30:14 +02:00
1 parent 7fdadc52f7
commit f3abf31148
3 files changed
+26 -6

No files matched your search

@@ -4677,6 +4677,13 @@ bool WrappedID3D11DeviceContext::Serialise_FinishCommandList(BOOL RestoreDeferre
HRESULT WrappedID3D11DeviceContext::FinishCommandList(BOOL RestoreDeferredContextState, ID3D11CommandList **ppCommandList)
{
if(GetType() == D3D11_DEVICE_CONTEXT_IMMEDIATE)
{
m_pDevice->AddDebugMessage(eDbgCategory_Execution, eDbgSeverity_High, eDbgSource_IncorrectAPIUse,
"It is invalid to call FinishCommandList on an immediate context. The call has been dropped from the capture.");
return DXGI_ERROR_INVALID_CALL;
}
DrainAnnotationQueue();
ID3D11CommandList *real = NULL;
+18 -5
View File
@@ -706,10 +706,13 @@ void WrappedID3D11Device::LazyInit()
void WrappedID3D11Device::AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, DebugMessageSource src, std::string d)
{
if(m_State == READING || src == eDbgSource_RuntimeWarning)
// Only add runtime warnings while executing.
// While reading, add the messages from the log, and while writing add messages
// we add (on top of the API debug messages)
if(m_State != EXECUTING || src == eDbgSource_RuntimeWarning)
{
DebugMessage msg;
msg.eventID = m_pImmediateContext->GetEventID();
msg.eventID = m_State >= WRITING ? 0 : m_pImmediateContext->GetEventID();
msg.messageID = 0;
msg.source = src;
msg.category = c;
@@ -719,15 +722,23 @@ void WrappedID3D11Device::AddDebugMessage(DebugMessageCategory c, DebugMessageSe
}
}
void WrappedID3D11Device::AddDebugMessage(DebugMessage msg)
{
if(m_State != EXECUTING || msg.source == eDbgSource_RuntimeWarning)
m_DebugMessages.push_back(msg);
}
vector<DebugMessage> WrappedID3D11Device::GetDebugMessages()
{
vector<DebugMessage> ret;
// if reading, m_DebugMessages will contain all the messages (we
// don't try and fetch anything from the API). If writing,
// m_DebugMessages will contain any manually-added messages.
ret.swap(m_DebugMessages);
if(m_State < WRITING)
{
ret.swap(m_DebugMessages);
return ret;
}
if(!m_pInfoQueue)
return ret;
@@ -2482,6 +2493,8 @@ void WrappedID3D11Device::StartFrameCapture(void *dev, void *wnd)
record.frameInfo.captureTime = Timing::GetUnixTimestamp();
m_FrameRecord.push_back(record);
m_DebugMessages.clear();
GetResourceManager()->ClearReferencedResources();
GetResourceManager()->MarkResourceFrameReferenced(m_ResourceID, eFrameRef_Write);
+1 -1
View File
@@ -306,7 +306,7 @@ public:
void FirstFrame(IDXGISwapChain *swap);
vector<DebugMessage> GetDebugMessages();
void AddDebugMessage(DebugMessage msg) { if(m_State < WRITING) m_DebugMessages.push_back(msg); }
void AddDebugMessage(DebugMessage msg);
void AddDebugMessage(DebugMessageCategory c, DebugMessageSeverity sv, DebugMessageSource src, std::string d);
const vector<D3D11_INPUT_ELEMENT_DESC> &GetLayoutDesc(ID3D11InputLayout *layout) { return m_LayoutDescs[layout]; }