Fix D3D11 debug messages being off by one event

This commit is contained in:
baldurk
2021-09-17 12:18:50 +01:00
parent a5dfc5b8b0
commit bcb70d3b9c
2 changed files with 16 additions and 8 deletions
+13
View File
@@ -1162,6 +1162,19 @@ void WrappedID3D11DeviceContext::AddEvent()
apievent.chunkIndex = uint32_t(m_StructuredFile->chunks.size() - 1);
// if we're using replay-time debug messages, fetch them now since we can do better to correlate
// to events on replay
if(m_pDevice->GetReplayOptions().apiValidation)
{
rdcarray<DebugMessage> messages = m_pDevice->GetDebugMessages();
for(size_t i = 0; i < messages.size(); i++)
{
messages[i].eventId = apievent.eventId;
m_pDevice->AddDebugMessage(messages[i]);
}
}
m_CurEvents.push_back(apievent);
if(IsLoading(m_State))
@@ -3776,15 +3776,10 @@ void WrappedID3D11DeviceContext::Serialise_DebugMessages(SerialiserType &ser)
SERIALISE_ELEMENT(DebugMessages);
// if we're using replay-time API validation, fetch messages at replay time and ignore any
// serialised ones
// if we're using replay-time API validation, we fetch messages at replay time in AddEvent and
// ignore any serialised ones
if(ser.IsReading() && IsLoading(m_State) && m_pDevice->GetReplayOptions().apiValidation)
{
if(GetType() == D3D11_DEVICE_CONTEXT_IMMEDIATE)
DebugMessages = m_pDevice->GetDebugMessages();
else
DebugMessages.clear();
}
DebugMessages.clear();
// hide empty sets of messages.
if(ser.IsReading() && DebugMessages.empty())