Advanced search tips: use spaces to require multiple terms (AND), | for alternatives (OR), wrap phrases in quotes (="a b"), =term for exact match, 'term to include, !term to exclude, ^term to match prefix, !^term to exclude prefix, .ext$ to match suffix, and !.ext$ to exclude suffix.

vfx_sort_fill.wgsl

Bindings

sort_buffer

#
@group(0)
@binding(0)
var<storage, read_write> sort_buffer: SortBuffer

particle_buffer

#
@group(0)
@binding(1)
var<storage, read> particle_buffer: RawParticleBuffer

indirect_index_buffer

#
@group(0)
@binding(2)
var<storage, read> indirect_index_buffer: array<u32>

effect_metadata

#
@group(0)
@binding(3)
var<storage, read_write> effect_metadata: EffectMetadata

spawner

#
@group(0)
@binding(4)
var<storage, read> spawner: Spawner

Structures

KeyValuePair

#

Key-value pair for sorting, with optional second sort key.

struct KeyValuePair {
key: u32 ,
key2: u32 ,
value: u32 ,
}

SortBuffer

#
struct SortBuffer {
count: atomic<i32> ,
}

RawParticleBuffer

#

Particle buffer as an array of u32. This prevents having to specialize this shader for every single particle layout.

struct RawParticleBuffer {
data: array<u32> ,
}

Functions

main

#
@compute
Runs custom parallel code on the GPU, not limited to graphics
@workgroup_size(64)
Defines the size of a thread group. One to three numbers: width (x), height (y), and depth (z). Missing values default to 1

Fill the sorting key-value pair buffer with data to prepare for actual sorting.

fn main (
@builtin(global_invocation_id)
global_invocation_id: vec3<u32>
)