Commit bbbe4efc authored by Per-Morten Straume's avatar Per-Morten Straume
Browse files

Fix incorrect count in DrawMeshInstanced

The last Graphics.DrawMeshInstanced call is supposed to only render
stragglers that don't fit in full batches. However, instead it 
renders 1023 elements, rendering extra elements that shouldn't be there.
This mistake was probably due to a copy and paste error.

Fixed by introducing a stragglerCount to avoid calling % twice 
and to give better clarity.
parent 47d85e97
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -89,10 +89,11 @@ public class GraphicsSystem
ShadowCastingMode.Off, false);
}
NativeArray<float4x4>.Copy(mTransformMatrices, range.start + i * 1023, mMatrixBufferAsNativeArray, 0, range.length % 1023);
var stragglerCount = range.length % 1023;
NativeArray<float4x4>.Copy(mTransformMatrices, range.start + i * 1023, mMatrixBufferAsNativeArray, 0, stragglerCount);
Graphics.DrawMeshInstanced(mesh, 0,
material, mMatrixBuffer,
1023, null,
stragglerCount, null,
ShadowCastingMode.Off, false);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment