mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-07 14:35:48 +00:00
Catch FinishCommandList calls on immediate context, and throw an error
This commit is contained in:
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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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]; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user