Scalar
On this page

Scalar

Type in Types

The four native scalar kinds: the ones WGSL and GLSL ES 3.00 both represent directly in hardware, and the set a ShaderType of kind: 'scalar' can carry.

import type { Scalar } from 'typeshade'

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

Syntax

type Scalar = 'f32' | 'i32' | 'u32' | 'bool';

Description

When a binary operator mixes two of them, the result follows the native promotion order f32 > i32 > u32. Emulated double precision is a separate ShaderType kind, f64T, so it never enters native promotion and every code path that switches on the scalar kind decides about it separately (see ShaderType).

See also

Source

src/core/ir/types.ts, line 18, at commit 26de7be8

Edit this page Report a problem