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

TEXTURED

#
const TEXTURED: u32 = 1u

RIGHT_VERTEX

#
const RIGHT_VERTEX: u32 = 2u

BOTTOM_VERTEX

#
const BOTTOM_VERTEX: u32 = 4u

BORDER_LEFT

#
const BORDER_LEFT: u32 = 256u

BORDER_TOP

#
const BORDER_TOP: u32 = 512u

BORDER_RIGHT

#
const BORDER_RIGHT: u32 = 1024u

BORDER_BOTTOM

#
const BORDER_BOTTOM: u32 = 2048u

BORDER_ANY

#
const BORDER_ANY: u32 = BORDER_LEFT + BORDER_TOP + BORDER_RIGHT + BORDER_BOTTOM

INVERT

#
const INVERT: u32 = 4096u

Bindings

view

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

sprite_texture

#
@group(1)
@binding(0)
var sprite_texture: texture_2d<f32>

sprite_sampler

#
@group(1)
@binding(1)
var sprite_sampler: sampler

Structures

VertexOutput

#
struct VertexOutput {
@location(0)
uv: vec2<f32> ,
@location(1)
color: vec4<f32> ,
@location(2)
@interpolate(flat)
size: vec2<f32> ,
@location(3)
@interpolate(flat)
flags: u32 ,
@location(4)
@interpolate(flat)
radius_x: vec4<f32> ,
@location(5)
@interpolate(flat)
radius_y: vec4<f32> ,
@location(6)
@interpolate(flat)
border: vec4<f32> ,
@location(7)
point: vec2<f32> ,
@builtin(position)
position: vec4<f32> ,
}

Functions

enabled

#
fn enabled (
flags: u32
, 
mask: u32
) -> bool

vertex

#
@vertex
Processes each 3D point in a model before it's drawn
fn vertex (
@location(0)
vertex_position: vec3<f32>
, 
@location(1)
vertex_uv: vec2<f32>
, 
@location(2)
vertex_color: vec4<f32>
, 
@location(3)
flags: u32
, 
@location(4)
radius_x: vec4<f32>
, 
@location(5)
radius_y: vec4<f32>
, 
@location(6)
border: vec4<f32>
, 
@location(7)
size: vec2<f32>
, 
@location(8)
point: vec2<f32>
) -> VertexOutput

select_corner_radius

#

Arguments: - point -> The point used to choose the closest corner. - corner_radii_x -> The horizontal radius of each rounded corner. - corner_radii_y -> The vertical radius of each rounded corner. Both ordered x: top left, y: top right, z: bottom right, w: bottom left.

fn select_corner_radius (
point: vec2<f32>
, 
corner_radii_x: vec4<f32>
, 
corner_radii_y: vec4<f32>
) -> vec2<f32>

sd_rounded_box

#

Arguments: - point -> The function will return the distance from this point to the closest point on the boundary. - size -> The maximum width and height of the box. - corner_radii_x -> The horizontal semi-axis of each rounded corner. Ordered counter clockwise starting top left. - corner_radii_y -> The vertical semi-axis of each rounded corner. Ordered counter clockwise starting top left.

fn sd_rounded_box (
point: vec2<f32>
, 
size: vec2<f32>
, 
corner_radii_x: vec4<f32>
, 
corner_radii_y: vec4<f32>
) -> f32

sd_inset_rounded_box

#
fn sd_inset_rounded_box (
point: vec2<f32>
, 
size: vec2<f32>
, 
radius_x: vec4<f32>
, 
radius_y: vec4<f32>
, 
inset: vec4<f32>
) -> f32

nearest_border_active

#
fn nearest_border_active (
point_vs_mid: vec2<f32>
, 
size: vec2<f32>
, 
width: vec4<f32>
, 
flags: u32
) -> bool

antialias

#

get alpha for antialiasing for sdf

fn antialias (
distance: f32
) -> f32

draw_uinode_border

#
fn draw_uinode_border (
color: vec4<f32>
, 
point: vec2<f32>
, 
size: vec2<f32>
, 
radius_x: vec4<f32>
, 
radius_y: vec4<f32>
, 
border: vec4<f32>
, 
flags: u32
) -> vec4<f32>

draw_uinode_background

#
fn draw_uinode_background (
color: vec4<f32>
, 
point: vec2<f32>
, 
size: vec2<f32>
, 
radius_x: vec4<f32>
, 
radius_y: vec4<f32>
, 
border: vec4<f32>
, 
flags: u32
) -> vec4<f32>

fragment

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

distance_to_ellipse_approx

#

A scale relative to the unit scale of the ellipse may be passed in to cause the math to degenerate to length(p) when scale is 0, or otherwise give the normal distance approximation if scale is 1.

fn distance_to_ellipse_approx (
p: vec2<f32>
, 
inv_radii_sq: vec2<f32>
, 
scale: f32
) -> f32
Contents