Fix crash when event browser is hiding empty marker regions

* When we figure out which event a marker region should jump to if you
  select the parent, we want to pick the last valid event ID that isn't
  just a label. However previously this was being done by iterating over
  the children and picking the last one and assuming there would be a
  node of that index - which isn't true in the case where some drawcalls
  were entirely omitted. It would either index out of bounds, or index
  incorrectly.
This commit is contained in:
baldurk
2015-03-02 13:36:24 +00:00
parent e2f7afc3a2
commit 4dcb89966c
+6 -2
View File
@@ -46,6 +46,8 @@ namespace renderdocui.Windows
public UInt32 frameID = 0;
public UInt32 eventID = 0;
public bool marker = false;
public ResourceId defCtx = ResourceId.Null;
public UInt32 firstDefEv = 0;
public UInt32 lastDefEv = 0;
@@ -249,6 +251,7 @@ namespace renderdocui.Windows
DeferredEvent def = new DeferredEvent();
def.frameID = m_Core.CurFrame;
def.eventID = eventNum;
def.marker = (drawcall.flags & DrawcallFlags.SetMarker) != 0;
if (drawcall.context != m_Core.FrameInfo[m_Core.CurFrame].immContextId)
{
@@ -287,9 +290,10 @@ namespace renderdocui.Windows
bool found = false;
for (int i = drawcall.children.Length - 1; i >= 0; i--)
for (int i = drawNode.Nodes.Count - 1; i >= 0; i--)
{
if ((drawcall.children[i].flags & DrawcallFlags.SetMarker) == 0)
DeferredEvent t = drawNode.Nodes[i].Tag as DeferredEvent;
if (!t.marker)
{
drawNode.Tag = drawNode.Nodes[i].Tag;
found = true;