select
On this page

select()

Function in Builtins

select: the free-function form of ReadonlyNode.select.

import { select } from 'typeshade'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

function select(cond: ReadonlyNode<'bool'>, ifTrue: number, ifFalse: number): Node<'f32'>;
function select<R extends string>(
cond: ReadonlyNode<'bool'>,
ifTrue: ReadonlyNode<R> | number,
ifFalse: ReadonlyNode<R> | number,
): Node<R>;

Parameters

cond ReadonlyNode<'bool'>
ifTrue number
ifFalse number

Return value

Node<'f32'>

Description

select(cond, ifTrue, ifFalse): the free-function form of ReadonlyNode.select. Both branches must share a key; two JS numbers give an f32 result.

Targets

TargetSupportNotes
WGSL (WebGPU) Supported

select(a, b, c).

GLSL ES 3.00 (WebGL2) Supported

(c ? b : a).

CPU oracle Not supported

The oracle has no implementation for it.

In the guide

Source

src/core/ir/node.ts, line 2261, at commit 26de7be8

Edit this page Report a problem