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.

oit_resolve.wgsl

Constants

LINKED_LIST_END_SENTINEL

#
const LINKED_LIST_END_SENTINEL: u32 = 0xFFFFFFFFu

SORTED_FRAGMENT_MAX_COUNT

#
const SORTED_FRAGMENT_MAX_COUNT: u32 = #{SORTED_FRAGMENT_MAX_COUNT

Bindings

view

#
@group(0)
@binding(0)
var<uniform> view: View

nodes

#
@group(0)
@binding(1)
var<storage, read> nodes: array<OitFragmentNode>

heads

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

atomic_counter

#
@group(0)
@binding(3)
var<storage, read_write> atomic_counter: u32

depth

#
@group(1)
@binding(0)
var depth: texture_depth_2d

Structures

OitFragment

#
struct OitFragment {
color: u32 ,
depth_alpha: u32 ,
}

FullscreenVertexOutput

#
struct FullscreenVertexOutput {
@builtin(position)
position: vec4<f32> ,
@location(0)
uv: vec2<f32> ,
}

Functions

fragment

#
@fragment
Calculates the final color of each pixel on the screen
fn fragment ( ) ->
@location(0)
vec4<f32>

resolve

#
fn resolve (
head: u32
opaque_depth: f32
) -> vec4<f32>

blend

#

OVER operator using premultiplied alpha see: https://en.wikipedia.org/wiki/Alpha_compositing

fn blend (
color_a: vec4<f32>
color_b: vec4<f32>
) -> vec4<f32>

packed_depth_alpha_get_alpha

#
fn packed_depth_alpha_get_alpha (
packed: u32
) -> f32