Skip to content

Commit

Permalink
fix AlembicPointsRenderer instance count issue
Browse files Browse the repository at this point in the history
  • Loading branch information
i-saint committed Feb 22, 2018
1 parent 20f9909 commit f7b897e
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,22 @@ public void Flush()
// update argument buffer
if (m_cbArgs == null || m_cbArgs.Length != submeshCount)
{
m_cbArgs = new ComputeBuffer[submeshCount];
for (int si = 0; si < submeshCount; ++si)
if (m_cbArgs != null)
{
var cbArgs = new ComputeBuffer(1, m_args.Length * sizeof(uint), ComputeBufferType.IndirectArguments);
m_cbArgs[si] = cbArgs;
m_args[0] = (int)mesh.GetIndexCount(si);
m_args[1] = numInstances;
cbArgs.SetData(m_args);
foreach (var cb in m_cbArgs)
cb.Release();
m_cbArgs = null;
}

m_cbArgs = new ComputeBuffer[submeshCount];
for (int si = 0; si < submeshCount; ++si)
m_cbArgs[si] = new ComputeBuffer(1, m_args.Length * sizeof(uint), ComputeBufferType.IndirectArguments);
}
for (int si = 0; si < submeshCount; ++si)
{
m_args[0] = (int)mesh.GetIndexCount(si);
m_args[1] = numInstances;
m_cbArgs[si].SetData(m_args);
}

// issue drawcalls
Expand Down

0 comments on commit f7b897e

Please sign in to comment.