Make sure we have some fallback for locating position element. Refs #149

* If no position element is selected at all that's really confusing, so
  worst case we just pick the first attribute.
* Making it intuitive/obvious that you can change which attribute is
  displayed as mesh - that's a different problem.
This commit is contained in:
baldurk
2015-09-12 17:30:35 +02:00
parent 96b43aa54d
commit d16a8024d5
+28
View File
@@ -2365,6 +2365,7 @@ namespace renderdocui.Windows
break;
}
}
// look for an exact match
for (int i = 0; posEl == -1 && i < ui.m_Input.BufferFormats.Length; i++)
{
FormatElement el = ui.m_Input.BufferFormats[i];
@@ -2378,6 +2379,33 @@ namespace renderdocui.Windows
break;
}
}
// try anything containing position
for (int i = 0; posEl == -1 && i < ui.m_Input.BufferFormats.Length; i++)
{
FormatElement el = ui.m_Input.BufferFormats[i];
if (el.name.ToUpperInvariant().Contains("POSITION"))
{
posEl = i;
break;
}
}
// OK last resort, just look for 'pos'
for (int i = 0; posEl == -1 && i < ui.m_Input.BufferFormats.Length; i++)
{
FormatElement el = ui.m_Input.BufferFormats[i];
if (el.name.ToUpperInvariant().Contains("POS"))
{
posEl = i;
break;
}
}
// if we still have absolutely nothing, just use the first available element
if (posEl == -1 && ui.m_Input.BufferFormats.Length > 0)
{
posEl = 0;
}
}
m_PosElement[(int)stage] = posEl;