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
condReadonlyNode<'bool'>ifTruenumberifFalsenumber
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
| Target | Support | Notes |
|---|---|---|
| WGSL (WebGPU) | Supported |
|
| GLSL ES 3.00 (WebGL2) | Supported |
|
| 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