Skip to main content

GpuBoids

Struct GpuBoids 

Source
pub struct GpuBoids;
Expand description

Boids flocking as a GpuAgentModel, seeded through BoidsModel::init.

Trait Implementations§

Source§

impl Debug for GpuBoids

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl GpuAgentModel for GpuBoids

Source§

const BUFFERS: &'static [BufferSpec] = BUFFER_SPECS

Position, velocity and colour, each double buffered, since a boid reads its neighbours’ current values while writing its own next values.

Source§

const REPLAYS_EXACTLY: bool = false

The neighbour index leaves the order of boids within a cell to the GPU.

Source§

const REDUCE: ReduceSpec

Reduction of three lanes: speed, x velocity and y velocity.

Source§

const NAME: &'static str = "Boids Flocking (GPU)"

Name shown in the UI.
Source§

const ID: &'static str = "gpu_boids"

Stable id that identifies the model in a model set, on the command line and in a spec file.
Source§

const DESCRIPTION: &'static str = "A simulation of flocking behavior in a group of boids, stepped entirely on the GPU"

One-line description shown in the UI.
Source§

const STATS: &'static [StatDescriptor] = BoidsModel::STATS

Stat series for the history chart. Declared once, so Self::stats returns bare values.
Source§

const POS_BUFFER: usize = POS

Index into Self::BUFFERS of the vec2<f32> positions that the view draws.
Source§

const COLOR_BUFFER: usize = COLOR

Index into Self::BUFFERS of the packed RGBA that the view draws.
Source§

const INDEX: bool = true

Whether the engine rebuilds a neighbour index from the positions before every step. Read more
Source§

const STEP_PASSES: &'static [PassSpec]

Passes of one step, run in declaration order.
Source§

const ACTIONS: &'static [GpuAgentAction]

One-off passes the user can trigger. Each gets a button in the Parameters panel.
Source§

fn param_descriptors() -> Vec<ParamDescriptor>

Returns the full descriptor list. Read more
Source§

fn dims(params: &[ParamValue]) -> (u32, Extent)

Returns the population and the world extent for these params. The engine clamps the population and each axis of the extent to at least 1.
Source§

fn buffer_lens(geom: &Geometry) -> Vec<usize>

Returns the length in u32-sized elements of each buffer, one per Self::BUFFERS entry.
Source§

fn seed_buffers( geom: &Geometry, params: &[ParamValue], seed: Option<u64>, ) -> Vec<Vec<u8>>

Returns the initial contents of each buffer as raw bytes, one vector per Self::BUFFERS entry. Read more
Source§

fn index_cell_size(params: &[ParamValue]) -> f32

Returns the neighbour index’s cell size for these params. Read more
Source§

fn pass_params_bytes( pass: PassId, ctx: PassCtx<'_>, params: &[ParamValue], ) -> Vec<u8> ⓘ

Returns the uniform block of pass as raw bytes. Read more
Source§

fn stats(sums: &[f32], _counters: &[u32], geom: &Geometry) -> Vec<StatValue>

Turns the reduction and the counters into values, in Self::STATS order. Read more
Source§

const COUNTERS: usize = 0

Number of persistent u32 counters that a kernel accumulates into. Read more
Source§

const DISPLAY: Option<DisplaySpec> = None

Display pass, for a model that draws a grid layer under its agents.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WasmNotSync for T
where T: Sync,