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.

fft_evolve.wgsl

Constants

FFT_RESOLUTION

#
const FFT_RESOLUTION: u32 = 256u

LOD_COUNT

#
const LOD_COUNT: u32 = 5u

ATTENUATION_BINS

#
const ATTENUATION_BINS: u32 = 4u

FIELD_LAYERS

#
const FIELD_LAYERS: u32 = LOD_COUNT * ATTENUATION_BINS

GRAVITY

#
const GRAVITY: f32 = 9.81

CHOP

#
const CHOP: f32 = 0.8

Bindings

initial_spectrum

#
@group(0)
@binding(0)
var initial_spectrum: texture_2d_array<f32>

height_x

#
@group(0)
@binding(1)
var height_x: texture_storage_2d_array<rgba32float, write>

z_field

#
@group(0)
@binding(2)
var z_field: texture_storage_2d_array<rgba32float, write>

fft

#
@group(0)
@binding(3)
var<uniform> fft: FftUniform

Structures

CascadeParams

#
struct CascadeParams {
center: vec2<f32> ,
scale: f32 ,
texture_res: f32 ,
inv_texture_res: f32 ,
texel_width: f32 ,
weight: f32 ,
max_wavelength: f32 ,
}

CascadeLayout

#
struct CascadeLayout {
center: vec4<f32> ,
bed_transform: vec4<f32> ,
bed_range: vec4<f32> ,
}

FftUniform

#
struct FftUniform {
cascade_layout: CascadeLayout ,
params: vec4<f32> ,
mode: vec4<f32> ,
}

Functions

complex_multiply

#
fn complex_multiply ( ) -> vec2<f32>

conjugate

#
fn conjugate ( ) -> vec2<f32>

signed_frequency

#
fn signed_frequency (
value: u32
) -> i32

evolve

#
@compute
Runs custom parallel code on the GPU, not limited to graphics
@workgroup_size(8, 8, 1)
Defines the size of a thread group. One to three numbers: width (x), height (y), and depth (z). Missing values default to 1
fn evolve (
@builtin(global_invocation_id)
id: vec3<u32>
)