mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Handle edge-case where input layout bytecode doesn't use every element
This commit is contained in:
@@ -338,6 +338,7 @@ namespace renderdocui.Code
|
||||
public int InstanceRate;
|
||||
public ResourceFormat Format;
|
||||
public object[] GenericValue;
|
||||
public bool Used;
|
||||
};
|
||||
|
||||
public VertexInputAttribute[] GetVertexInputs()
|
||||
@@ -380,6 +381,20 @@ namespace renderdocui.Code
|
||||
ret[i].InstanceRate = (int)layouts[i].InstanceDataStepRate;
|
||||
ret[i].Format = layouts[i].Format;
|
||||
ret[i].GenericValue = null;
|
||||
ret[i].Used = false;
|
||||
|
||||
if (m_D3D11.m_IA.Bytecode != null)
|
||||
{
|
||||
for (int ia = 0; ia < m_D3D11.m_IA.Bytecode.InputSig.Length; ia++)
|
||||
{
|
||||
if (m_D3D11.m_IA.Bytecode.InputSig[ia].semanticName.ToUpperInvariant() == layouts[i].SemanticName.ToUpperInvariant() &&
|
||||
m_D3D11.m_IA.Bytecode.InputSig[ia].semanticIndex == layouts[i].SemanticIndex)
|
||||
{
|
||||
ret[i].Used = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -412,6 +427,7 @@ namespace renderdocui.Code
|
||||
ret[a].PerInstance = m_GL.m_VtxIn.vbuffers[attrs[i].BufferSlot].Divisor > 0;
|
||||
ret[a].InstanceRate = (int)m_GL.m_VtxIn.vbuffers[attrs[i].BufferSlot].Divisor;
|
||||
ret[a].Format = attrs[i].Format;
|
||||
ret[a].Used = true;
|
||||
|
||||
if (m_GL.m_VS.BindpointMapping != null && m_GL.m_VS.ShaderDetails != null)
|
||||
{
|
||||
|
||||
@@ -827,9 +827,19 @@ namespace renderdocui.Windows
|
||||
|
||||
ret.GenericValues = new object[vinputs.Length][];
|
||||
|
||||
int numinputs = vinputs.Length;
|
||||
|
||||
int i = 0;
|
||||
foreach (var a in vinputs)
|
||||
{
|
||||
if (!a.Used)
|
||||
{
|
||||
numinputs--;
|
||||
Array.Resize(ref f, numinputs);
|
||||
Array.Resize(ref ret.GenericValues, numinputs);
|
||||
continue;
|
||||
}
|
||||
|
||||
f[i] = new FormatElement(a.Name,
|
||||
a.VertexBuffer,
|
||||
a.RelativeByteOffset,
|
||||
|
||||
@@ -705,6 +705,26 @@ namespace renderdocui.Windows.PipelineState
|
||||
|
||||
layoutOffs[l.InputSlot] += l.Format.compByteWidth * l.Format.compCount;
|
||||
|
||||
bool iaUsed = false;
|
||||
|
||||
if (state.m_IA.Bytecode != null)
|
||||
{
|
||||
for (int ia = 0; ia < state.m_IA.Bytecode.InputSig.Length; ia++)
|
||||
{
|
||||
if (state.m_IA.Bytecode.InputSig[ia].semanticName.ToUpperInvariant() == l.SemanticName.ToUpperInvariant() &&
|
||||
state.m_IA.Bytecode.InputSig[ia].semanticIndex == l.SemanticIndex)
|
||||
{
|
||||
iaUsed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
|
||||
if(!iaUsed && !showDisabled.Checked)
|
||||
continue;
|
||||
|
||||
var node = inputLayouts.Nodes.Add(new object[] {
|
||||
i, l.SemanticName, l.SemanticIndex.ToString(), l.Format, l.InputSlot.ToString(), byteOffs,
|
||||
l.PerInstance ? "PER_INSTANCE" : "PER_VERTEX", l.InstanceDataStepRate.ToString() });
|
||||
@@ -714,7 +734,8 @@ namespace renderdocui.Windows.PipelineState
|
||||
node.Image = global::renderdocui.Properties.Resources.action;
|
||||
node.HoverImage = global::renderdocui.Properties.Resources.action_hover;
|
||||
|
||||
i++;
|
||||
if (!iaUsed)
|
||||
InactiveRow(node);
|
||||
}
|
||||
}
|
||||
inputLayouts.NodesSelection.Clear();
|
||||
|
||||
Reference in New Issue
Block a user