class

FGpuBoids

A boids swarm on the GPU: the sample GPU ECS world. Fields Position and Velocity are GPU-owned; a counting sort into a uniform grid (clear, count, scan, scatter) feeds a 27-cell neighbour search, then the agents move and write their draw instances (foliage instance layout) in the same step.

Module
GpuEcs
Header
#include "GpuEcs/GpuBoids.h"
Namespace
Mowo

Public functions

ReturnsNameDescription
FGpuBoidsParamsMakeParams
FGpuBoidsStateMakeInitialState
boolCreate
boolRecord
boolRecord
boolStepImmediate
boolReadState
const FGpuBoidsParams&Params
FGpuBoidsParams&MutableParams
FGpuWorld&World
Ref<StorageBuffer>Instances
voidReferenceStepThe same step on the CPU — brute force over the radius, which the 27-cell search reaches exactly when radius <= cell size — with the same fixed-point sums, for parity checks on small swarms.

Function details

MakeParams

C++
static FGpuBoidsParams MakeParams(uint32_t count, float halfSize, float radius)

MakeInitialState

C++
static FGpuBoidsState MakeInitialState(const FGpuBoidsParams& params, uint32_t seed)

Create

C++
bool Create(const FGpuBoidsParams& params, const FGpuBoidsState& initial, std::string* error = nullptr)

Record

C++
bool Record(float dt)

Record

C++
bool Record(const FGpuBoidsParams& snapshot)

StepImmediate

C++
bool StepImmediate(float dt)

ReadState

C++
bool ReadState(FGpuBoidsState& out)

Params

C++
const FGpuBoidsParams& Params() const

MutableParams

C++
FGpuBoidsParams& MutableParams()

World

C++
FGpuWorld& World()

Instances

C++
Ref<StorageBuffer> Instances() const

ReferenceStep

C++
static void ReferenceStep(const FGpuBoidsParams& params, FGpuBoidsState& state)

The same step on the CPU — brute force over the radius, which the 27-cell search reaches exactly when radius <= cell size — with the same fixed-point sums, for parity checks on small swarms.

Generated from GpuEcs/GpuBoids.h via gpuecs.json · Oct 31, 2026Version 1.0.0