Handle post-vs data being padded/aligned instead of tightly packed

This commit is contained in:
baldurk
2015-11-27 15:05:27 +01:00
parent 8818de4524
commit 101d780956
2 changed files with 18 additions and 1 deletions
+5
View File
@@ -75,6 +75,11 @@ namespace renderdocui.Code
else return val;
}
public static uint AlignUp(this uint x, uint a)
{
return (x + (a - 1)) & (~(a - 1));
}
public static bool IsElevated
{
get
+13 -1
View File
@@ -806,8 +806,20 @@ namespace renderdocui.Windows
uint offset = 0;
for (int i = 0; i < details.OutputSig.Length; i++)
{
uint numComps = f[i].format.compCount;
uint elemSize = f[i].format.compType == FormatComponentType.Double ? 8U : 4U;
if (m_Core.CurPipelineState.HasAlignedPostVSData)
{
if (numComps == 2)
offset = offset.AlignUp(2U * elemSize);
else if (numComps > 2)
offset = offset.AlignUp(4U * elemSize);
}
f[i].offset = offset;
offset += f[i].format.compCount * sizeof(float);
offset += numComps * elemSize;
}
ret.BufferFormats = f.ToArray();