max
Function
Returns the greater of a and b, componentwise over vectors.
The signature and the sentence under each name are the compiler's own text at commit 26de7be8.
Syntax
declare function max<V extends vec2 | vec3 | vec4 | vec2i | vec3i | vec4i | vec2u | vec3u | vec4u>(a0: V, a1: V): Vdeclare function max<P0 extends number, P1 extends number>(a0: P0, a1: P1): ([P0] extends [boolean] ? bool : typeof f32Tag extends keyof P0 ? f32 : typeof i32Tag extends keyof P0 ? i32 : typeof u32Tag extends keyof P0 ? u32 : typeof f64Tag extends keyof P0 ? f64 : ([P1] extends [boolean] ? bool : typeof f32Tag extends keyof P1 ? f32 : typeof i32Tag extends keyof P1 ? i32 : typeof u32Tag extends keyof P1 ? u32 : typeof f64Tag extends keyof P1 ? f64 : number))declare function max(a: vec2, b: number): vec2declare function max(a: vec3, b: number): vec3declare function max(a: vec4, b: number): vec4declare function max(a: vec2i, b: number): vec2ideclare function max(a: vec3i, b: number): vec3ideclare function max(a: vec4i, b: number): vec4ideclare function max(a: vec2u, b: number): vec2udeclare function max(a: vec3u, b: number): vec3udeclare function max(a: vec4u, b: number): vec4udeclare function max<T extends Numeric>(xs: array<T>): TA number in a parameter or a return position is the scalar slot. The ambient file declares a GPU scalar as a branded number whose brand is optional, so a literal and any branded scalar both fill it.
type f32 = number & { readonly [f32Tag]?: true }
A declaration you write still needs a width, and a bare number on a field or a parameter is refused; the TypeScript constructs page carries that row with the compiler's own message.
A signature may name a type the ambient file declares for its own use. These are those declarations.
Numerictype Numeric = number | vec2 | vec3 | vec4 | vec2i | vec3i | vec4i | vec2u | vec3u | vec4u
Parameters
Return value
V([P0] extends [boolean] ? bool : typeof f32Tag extends keyof P0 ? f32 : typeof i32Tag extends keyof P0 ? i32 : typeof u32Tag extends keyof P0 ? u32 : typeof f64Tag extends keyof P0 ? f64 : ([P1] extends [boolean] ? bool : typeof f32Tag extends keyof P1 ? f32 : typeof i32Tag extends keyof P1 ? i32 : typeof u32Tag extends keyof P1 ? u32 : typeof f64Tag extends keyof P1 ? f64 : number))vec2vec3vec4vec2ivec3ivec4ivec2uvec3uvec4uT
Description
If one argument is NaN, the other is returned. Also accepts f64 operands.
Targets
- WGSL
-
max(a, b) - GLSL ES 3.00
-
max(a, b)
Examples
graticule.tsfp64-rtc.tsmandelbrot.tsraymarch-sphere.tsraymarch-boxes.tstunnel.tsmetaballs.tsocean.tsheart.tsfp64-mandelbrot.tsfp64-julia.tsfp64-burning-ship.tsfp64-mandelbrot-de.tsmsaa-resolve.shade.tsuniform-array.shade.tsdefault-args.shade.tsbit-bump.shade.tshigher-order.shade.tsloops-over-data.shade.tscapsule-corp-namek-class.shade.tsshape-inheritance.shade.tsclass-syntax.shade.tsclass-builder.shade.tsrt-renderer-class.shade.tsseparable-blur.shade.tsworkgroup-tile-2d.shade.tsloop-reduction.shade.tsmandelbrot-twin.shade.tstunnel-twin.shade.tsocean-twin.shade.tsfp64-rtc-twin.shade.tsfp64-julia-twin.shade.tsfp64-burning-ship-twin.shade.tsfp64-mandelbrot-de-twin.shade.ts