mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 09:30:44 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user