Vixen
02b45cc4
csharp
public static class VfxSimulation

The CPU backend: it runs a compiled graph over a particle buffer.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

One operation across every particle, not every operation across one particle. That ordering is the whole performance argument and it is also what makes the GPU backend a translation rather than a redesign. Sweeping per operation means the opcode is dispatched once per frame instead of once per particle, each sweep touches one or two attribute arrays end to end, and the inner loop has no branch in it — which is what a compute shader's invocation looks like from the inside anyway.

The other order — walk the particles, run the graph on each — would put a switch inside the hot loop and read every attribute of a particle to change one of them. It is the order that reads better and it is the wrong one.

Randomness is drawn from the identifier, never from the index. A particle keeps its identifier for life and its slot only until something ahead of it dies, so an operation that hashed the slot would give a particle new random values partway through its life.

Methods (3)

  • public static void Initialize(ParticleBuffer buffer, ReadOnlySpan<VfxOperation> operations, int first, int count, uint seed, Vector3 origin = default(Vector3))

    Applies the initializers to a run of newly spawned particles.

  • public static int Update(ParticleBuffer buffer, ReadOnlySpan<VfxOperation> operations, float deltaTime, float time = 0, Span<Vector3> graveyard = default(Span<Vector3>))

    Advances every live particle by one step.

  • public static int Update(ParticleBuffer buffer, VfxOperation[] operations, float deltaTime, float time, JobScheduler scheduler, int batchSize = 0, Span<Vector3> graveyard = default(Span<Vector3>))

    Advances every live particle by one step, across the scheduler's threads.

Used by (8)

  • SweepVixen.Vfx
  • VfxAgreementTestsVixen.Vfx.Gpu.Tests
  • VfxCollisionTestsVixen.Vfx.Tests
  • VfxParallelTestsVixen.Vfx.Tests
  • VfxReapTestsVixen.Vfx.Gpu.Tests
  • VfxSortTestsVixen.Vfx.Gpu.Tests
  • VfxSubEmitterVixen.Vfx
  • VfxSystemVixen.Vfx