Add drawing RenderList if it was not batched/sorted

This commit is contained in:
Wojciech Figat
2022-04-01 12:40:26 +02:00
parent 94799a9e28
commit de8a6bea58

View File

@@ -783,6 +783,28 @@ DRAW:
context->DrawIndexedInstanced(drawCall.Draw.IndicesCount, drawCall.InstanceCount, 0, 0, drawCall.Draw.StartIndex);
}
}
if (list.Batches.IsEmpty() && list.Indices.Count() != 0)
{
// Draw calls list has nto been batched so execute draw calls separately
for (int32 j = 0; j < list.Indices.Count(); j++)
{
auto& drawCall = DrawCalls[list.Indices[j]];
bindParams.FirstDrawCall = &drawCall;
drawCall.Material->Bind(bindParams);
context->BindIB(drawCall.Geometry.IndexBuffer);
context->BindVB(ToSpan(drawCall.Geometry.VertexBuffers, 3), drawCall.Geometry.VertexBuffersOffsets);
if (drawCall.InstanceCount == 0)
{
context->DrawIndexedInstancedIndirect(drawCall.Draw.IndirectArgsBuffer, drawCall.Draw.IndirectArgsOffset);
}
else
{
context->DrawIndexedInstanced(drawCall.Draw.IndicesCount, drawCall.InstanceCount, 0, 0, drawCall.Draw.StartIndex);
}
}
}
}
}