Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment