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

Method PostExecute

Source/Engine/Particles/Particles.cpp:1771–1820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1769}
1770
1771void ParticlesSystem::PostExecute(TaskGraph* graph)
1772{
1773 if (!Active)
1774 return;
1775 PROFILE_CPU_NAMED("Particles.PostExecute");
1776 PROFILE_MEM(Particles);
1777
1778 // Cleanup
1779 Particles::SystemLocker.ReadUnlock();
1780 Active = false;
1781 UpdateList.Clear();
1782
1783#if COMPILE_WITH_GPU_PARTICLES
1784 // Create GPU render task if missing but required
1785 if (GpuUpdateList.HasItems() && !GpuRenderTask)
1786 {
1787 GpuRenderTask = New<RenderTask>();
1788 GpuRenderTask->Order = -10000000;
1789 GpuRenderTask->Render.Bind(UpdateGPU);
1790 ScopeLock lock(RenderTask::TasksLocker);
1791 RenderTask::Tasks.Add(GpuRenderTask);
1792 }
1793 else if (GpuRenderTask)
1794 {
1795 ScopeLock lock(RenderTask::TasksLocker);
1796 GpuRenderTask->Enabled = GpuUpdateList.HasItems();
1797 }
1798#endif
1799
1800 // Recycle buffers
1801 const auto timeSeconds = Platform::GetTimeSeconds();
1802 PoolLocker.Lock();
1803 for (auto i = Pool.Begin(); i.IsNotEnd(); ++i)
1804 {
1805 auto& entries = i->Value;
1806 for (int32 j = 0; j < entries.Count(); j++)
1807 {
1808 auto& e = entries[j];
1809 if (timeSeconds - e.LastTimeUsed >= Particles::ParticleBufferRecycleTimeout)
1810 {
1811 Delete(e.Buffer);
1812 entries.RemoveAt(j--);
1813 }
1814 }
1815
1816 if (entries.IsEmpty())
1817 Pool.Remove(i);
1818 }
1819 PoolLocker.Unlock();
1820}

Callers

nothing calls this directly

Calls 13

DeleteFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80
ClearMethod · 0.45
HasItemsMethod · 0.45
BindMethod · 0.45
AddMethod · 0.45
BeginMethod · 0.45
IsNotEndMethod · 0.45
CountMethod · 0.45
RemoveAtMethod · 0.45
IsEmptyMethod · 0.45

Tested by

no test coverage detected