isMat
On this page

isMat()

Function in Types

Narrows a ShaderType to the { kind: 'mat' } arm.

import { isMat } from 'typeshade'
import { isMat } from 'typeshade/core/ir'

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

Syntax

const isMat: (t: ShaderType) => t is Extract<ShaderType, { kind: "mat"; }>

Parameters

t ShaderType

Return value

t is Extract<ShaderType, { kind: 'mat' }>

Description

Narrows a ShaderType to the { kind: 'mat' } arm. It matches both elem: 'f32' (native matNxN<f32>) and elem: 'f64' (emulated, emitted as a struct of double-double columns); use isMat64 when the distinction matters. Binary-op type resolution checks it before a matrix-vector or matrix-matrix product.

Examples

Example

import { isMat } from 'typeshade'
import { mat4x4fT, mat2f64T } from 'typeshade/core/ir'
isMat(mat4x4fT) // true
isMat(mat2f64T) // also true; use isMat64 to tell them apart

See also

Source

src/core/ir/types/predicates.ts, line 57, at commit af54ddad5

Edit this page Report a problem