Added basic support for instanced rendering

This commit is contained in:
Simon Lübeß
2021-05-30 19:37:23 +02:00
parent 0f2c481616
commit ae290936b9
6 changed files with 29 additions and 3 deletions
@@ -2,6 +2,8 @@ using GlitchyEngine.Math;
namespace GlitchyEngine.Renderer
{
using internal GlitchyEngine.Renderer;
extension RendererAPI
{
private GraphicsContext _context;
@@ -28,5 +30,10 @@ namespace GlitchyEngine.Renderer
{
_context.DrawIndexed(geometry.IndexCount, geometry.IndexByteOffset, 0);
}
public override void DrawIndexedInstanced(GeometryBinding geometry)
{
_context.nativeContext.DrawIndexedInstanced(geometry.IndexCount, geometry.InstanceCount, geometry.IndexByteOffset, 0, 0);
}
}
}
@@ -28,7 +28,7 @@ namespace GlitchyEngine.Renderer
Debug.Assert(input.Count == output.Count);
for(int i < input.Count)
output[i] = .(input[i].SemanticName, input[i].SemanticIndex, input[i].Format, input[i].InputSlot, input[i].AlignedByteOffset, (.)input[i].InputSlotClass);
output[i] = .(input[i].SemanticName, input[i].SemanticIndex, input[i].Format, input[i].InputSlot, input[i].AlignedByteOffset, (.)input[i].InputSlotClass, input[i].InstanceDataStepRate);
}
protected override void CreateNativeLayout()