MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / BuildObjectsBuffer

Method BuildObjectsBuffer

Source/Engine/Renderer/RenderList.cpp:761–788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

759}
760
761void 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
790void RenderList::SortDrawCalls(const RenderContext& renderContext, bool reverseDistance, DrawCallsList& list, const RenderListBuffer<DrawCall>& drawCalls, DrawCallsListType listType, DrawPass pass)
791{

Callers 2

ExecuteDrawCallsMethod · 0.80
BuildObjectsBufferJobMethod · 0.80

Calls 5

CountMethod · 0.45
ClearMethod · 0.45
ResizeMethod · 0.45
GetMethod · 0.45
StoreMethod · 0.45

Tested by

no test coverage detected