Fix crashes when loading 'image' logs

This commit is contained in:
baldurk
2016-04-14 21:05:40 +02:00
parent e5c9ca59e5
commit 171fbcfabd
3 changed files with 10 additions and 23 deletions
+9
View File
@@ -47,6 +47,7 @@ class ImageViewer : public IReplayDriver
m_FrameRecord.frameInfo.firstEvent = 1;
m_FrameRecord.frameInfo.frameNumber = 1;
m_FrameRecord.frameInfo.immContextId = ResourceId();
RDCEraseEl(m_FrameRecord.frameInfo.stats);
FetchDrawcall d;
d.context = ResourceId();
@@ -476,6 +477,10 @@ void ImageViewer::RefreshFile()
return;
}
m_FrameRecord.frameInfo.initDataSize = 0;
m_FrameRecord.frameInfo.persistentSize = 0;
m_FrameRecord.frameInfo.fileSize = datasize;
dds_data read_data = {0};
if(dds)
@@ -500,6 +505,10 @@ void ImageViewer::RefreshFile()
texDetails.dimension = 1;
if(texDetails.width > 1) texDetails.dimension = 2;
if(texDetails.depth > 1) texDetails.dimension = 3;
m_FrameRecord.frameInfo.fileSize = 0;
for(uint32_t i=0; i < texDetails.numSubresources; i++)
m_FrameRecord.frameInfo.fileSize += read_data.subsizes[i];
}
// recreate proxy texture if necessary.
@@ -632,7 +632,7 @@ namespace renderdocui.Windows.PipelineState
else
iaBytecode.Text = state.m_IA.LayoutName;
if (state.m_IA.Bytecode.DebugInfo != null && state.m_IA.Bytecode.DebugInfo.entryFunc.Length > 0)
if (state.m_IA.Bytecode != null && state.m_IA.Bytecode.DebugInfo != null && state.m_IA.Bytecode.DebugInfo.entryFunc.Length > 0)
iaBytecode.Text += " (" + state.m_IA.Bytecode.DebugInfo.entryFunc + ")";
iaBytecodeMismatch.Text = "";
-22
View File
@@ -600,28 +600,6 @@ namespace renderdocui.Windows
long fileSize = (new FileInfo(m_Core.LogFileName)).Length;
int firstIdx = 0;
var firstDrawcall = m_Core.CurDrawcalls[firstIdx];
while (firstDrawcall.children != null && firstDrawcall.children.Length > 0)
firstDrawcall = firstDrawcall.children[0];
while (firstDrawcall.events.Length == 0)
{
if (firstDrawcall.next != null)
{
firstDrawcall = firstDrawcall.next;
while (firstDrawcall.children != null && firstDrawcall.children.Length > 0)
firstDrawcall = firstDrawcall.children[0];
}
else
{
firstDrawcall = m_Core.CurDrawcalls[++firstIdx];
while (firstDrawcall.children != null && firstDrawcall.children.Length > 0)
firstDrawcall = firstDrawcall.children[0];
}
}
var lastDraw = m_Core.CurDrawcalls[m_Core.CurDrawcalls.Length - 1];
while (lastDraw.children != null && lastDraw.children.Length > 0)
lastDraw = lastDraw.children[lastDraw.children.Length - 1];