Search across packages, versions, files, declarations, and comments. Use multiple terms to narrow results (AND), and add @vertex, @fragment, or @compute to filter by shader stage.

Constants

NO_BED_DEPTH

#
const NO_BED_DEPTH: f32 = 256.0

UV_CENTER

#
const UV_CENTER: f32 = 0.5

Bindings

source_foam

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

source_sampler

#
@group(0)
@binding(1)
var source_sampler: sampler

anim_waves

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

waves_sampler

#
@group(0)
@binding(3)
var waves_sampler: sampler

bed_height

#
@group(0)
@binding(4)
var bed_height: texture_2d<f32>

target_foam

#
@group(0)
@binding(5)
var target_foam: texture_storage_2d_array<rgba16float, write>

foam

#
@group(0)
@binding(6)
var<uniform> foam: FoamUniform

fft_surface

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

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 {
cascades: array<CascadeParams, 6>,
center: vec4<f32>,
bed_transform: vec4<f32>,
bed_range: vec4<f32>,
}

FoamUniform

#
struct FoamUniform {
source_layout: CascadeLayout,
target_layout: CascadeLayout,
step: vec4<u32>,
wave: vec4<f32>,
shore: vec4<f32>,
}

Functions

world_to_uv

#
fn world_to_uv (
world_xz: vec2<f32>,
cascade: CascadeParams
) -> vec2<f32>

texel_world

#
fn texel_world (
id: vec2<u32>,
cascade: CascadeParams
) -> vec2<f32>

inside_source

#
fn inside_source (
uv: vec2<f32>
) -> bool

reproject

#
fn reproject (
world_xz: vec2<f32>,
slice: u32,
) -> f32

displacement

#
fn displacement (
world_xz: vec2<f32>,
slice: u32
) -> vec4<f32>

jacobian_foam_source

#
fn jacobian_foam_source (
world_xz: vec2<f32>,
slice: u32,
cascade: CascadeParams
) -> f32

averaged_foam_source

#
fn averaged_foam_source (
world_xz: vec2<f32>,
slice: u32,
cascade: CascadeParams
) -> f32

bed_water_depth

#

Water depth below sea level. Unmapped samples use the cleared full-depth value.

fn bed_water_depth (
world_xz: vec2<f32>
) -> f32

update

#
fn update (
id: vec3<u32>,
use_previous_layout: bool,
dt: f32
)

main

#
@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
Active when
FOAM_REPROJECT_PREVIOUS
fn main (
@builtin(global_invocation_id)
id: vec3<u32>
)
Active when
FOAM_UPDATE_CURRENT
fn main (
@builtin(global_invocation_id)
id: vec3<u32>
)
Active when
!FOAM_REPROJECT_PREVIOUS AND !FOAM_UPDATE_CURRENT
fn main (
@builtin(global_invocation_id)
id: vec3<u32>
)
Contents