Only try to read annotations when capturing

* This iterator will be invalid on replay
This commit is contained in:
baldurk committed 2026-02-25 11:32:59 +00:00
1 parent 9e52aa1a5f
commit cab8c4f649
4 files changed
+34 -14

No files matched your search

+9 -4
View File
@@ -473,18 +473,23 @@ bool WrappedID3D11DeviceContext::Serialise_BeginCaptureFrame(SerialiserType &ser
for(uint32_t i = 0; i < numAnnotations; i++)
{
SERIALISE_ELEMENT_LOCAL(id, it->first);
SDObject *annotation = it->second;
SDObject *annotation = NULL;
if(ser.IsReading())
{
annotation = new SDObject(""_lit, ""_lit); // will be overwritten below
}
else
{
annotation = it->second;
it++;
}
ser.Serialise("annotation"_lit, *annotation);
if(ser.IsReading() && IsLoading(m_State))
{
m_Annotations[id] = annotation;
m_pDevice->GetReplay()->GetResourceDesc(id).annotations = annotation;
m_Replay->GetResourceDesc(id).annotations = annotation;
}
++it;
}
if(numAnnotations > 0)
+8 -3
View File
@@ -2761,9 +2761,16 @@ bool WrappedID3D12Device::Serialise_BeginCaptureFrame(SerialiserType &ser)
for(uint32_t i = 0; i < numAnnotations; i++)
{
SERIALISE_ELEMENT_LOCAL(id, it->first);
SDObject *annotation = it->second;
SDObject *annotation = NULL;
if(ser.IsReading())
{
annotation = new SDObject(""_lit, ""_lit); // will be overwritten below
}
else
{
annotation = it->second;
it++;
}
ser.Serialise("annotation"_lit, *annotation);
if(ser.IsReading() && IsLoading(m_State))
@@ -2771,8 +2778,6 @@ bool WrappedID3D12Device::Serialise_BeginCaptureFrame(SerialiserType &ser)
m_Annotations[id] = annotation;
m_Replay->GetResourceDesc(id).annotations = annotation;
}
++it;
}
if(numAnnotations > 0)
+9 -4
View File
@@ -3142,18 +3142,23 @@ bool WrappedOpenGL::Serialise_BeginCaptureFrame(SerialiserType &ser)
for(uint32_t i = 0; i < numAnnotations; i++)
{
SERIALISE_ELEMENT_LOCAL(id, it->first);
SDObject *annotation = it->second;
SDObject *annotation = NULL;
if(ser.IsReading())
{
annotation = new SDObject(""_lit, ""_lit); // will be overwritten below
}
else
{
annotation = it->second;
it++;
}
ser.Serialise("annotation"_lit, *annotation);
if(ser.IsReading() && IsLoading(m_State))
{
m_Annotations[id] = annotation;
GetReplay()->GetResourceDesc(id).annotations = annotation;
m_Replay->GetResourceDesc(id).annotations = annotation;
}
++it;
}
if(numAnnotations > 0)
+8 -3
View File
@@ -2643,9 +2643,16 @@ bool WrappedVulkan::Serialise_BeginCaptureFrame(SerialiserType &ser)
for(uint32_t i = 0; i < numAnnotations; i++)
{
SERIALISE_ELEMENT_LOCAL(id, it->first);
SDObject *annotation = it->second;
SDObject *annotation = NULL;
if(ser.IsReading())
{
annotation = new SDObject(""_lit, ""_lit); // will be overwritten below
}
else
{
annotation = it->second;
it++;
}
ser.Serialise("annotation"_lit, *annotation);
if(ser.IsReading() && IsLoading(m_State))
@@ -2653,8 +2660,6 @@ bool WrappedVulkan::Serialise_BeginCaptureFrame(SerialiserType &ser)
m_Annotations[id] = annotation;
m_Replay->GetResourceDesc(id).annotations = annotation;
}
++it;
}
if(numAnnotations > 0)