| 759 | } |
| 760 | |
| 761 | void RenderList::BuildObjectsBuffer() |
| 762 | { |
| 763 | int32 count = DrawCalls.Count(); |
| 764 | for (const auto& e : BatchedDrawCalls) |
| 765 | count += e.Instances.Count(); |
| 766 | ObjectBuffer.Clear(); |
| 767 | if (count == 0) |
| 768 | return; |
| 769 | PROFILE_CPU(); |
| 770 | PROFILE_MEM(GraphicsCommands); |
| 771 | ObjectBuffer.Data.Resize(count * sizeof(ShaderObjectData)); |
| 772 | auto* src = (const DrawCall*)DrawCalls.Get(); |
| 773 | auto* dst = (ShaderObjectData*)ObjectBuffer.Data.Get(); |
| 774 | for (int32 i = 0; i < DrawCalls.Count(); i++) |
| 775 | { |
| 776 | dst->Store(src[i]); |
| 777 | dst++; |
| 778 | } |
| 779 | int32 startIndex = DrawCalls.Count(); |
| 780 | for (auto& batch : BatchedDrawCalls) |
| 781 | { |
| 782 | batch.ObjectsStartIndex = startIndex; |
| 783 | Platform::MemoryCopy(dst, batch.Instances.Get(), batch.Instances.Count() * sizeof(ShaderObjectData)); |
| 784 | dst += batch.Instances.Count(); |
| 785 | startIndex += batch.Instances.Count(); |
| 786 | } |
| 787 | ZoneValue(ObjectBuffer.Data.Count() / 1024); // Objects Buffer size in kB |
| 788 | } |
| 789 | |
| 790 | void RenderList::SortDrawCalls(const RenderContext& renderContext, bool reverseDistance, DrawCallsList& list, const RenderListBuffer<DrawCall>& drawCalls, DrawCallsListType listType, DrawPass pass) |
| 791 | { |
no test coverage detected