Only fetch the PostVS data needed for this draw, not the whole buffer

* For instanced draws where there are many instance and each instance is
  a lot, this saves fetching a *ton* of redundant data.
This commit is contained in:
baldurk
2015-11-27 20:42:42 +01:00
parent 793d2690c4
commit 48a03ae21f
+14 -2
View File
@@ -967,8 +967,6 @@ namespace renderdocui.Windows
}
else
{
ret.Buffers[0] = r.GetBufferData(ret.PostVS.buf, ret.PostVS.offset, 0);
ret.Topology = ret.PostVS.topo;
ret.IndexCount = ret.PostVS.numVerts;
@@ -982,6 +980,8 @@ namespace renderdocui.Windows
ret.Indices = null;
ret.DataIndices = null;
uint maxIndex = Math.Max(ret.IndexCount, 1) - 1;
if (ret.PostVS.buf != ResourceId.Null && type == MeshDataStage.VSOut &&
(input.Drawcall.flags & DrawcallFlags.UseIBuffer) > 0 && input.IndexBuffer != ResourceId.Null)
{
@@ -1052,8 +1052,20 @@ namespace renderdocui.Windows
Buffer.BlockCopy(rawidxs, 0, ret.DataIndices, 0, ret.DataIndices.Length * sizeof(uint));
}
}
maxIndex = 0;
foreach (var i in ret.DataIndices)
{
if (i == input.IndexRestartValue && input.IndexRestart)
continue;
maxIndex = Math.Max(maxIndex, i);
}
}
if (ret.PostVS.buf != ResourceId.Null)
ret.Buffers[0] = r.GetBufferData(ret.PostVS.buf, ret.PostVS.offset, (maxIndex + 1) * ret.PostVS.stride);
return ret;
}
else if (input.Buffers != null && m_Output != null)