TexelKey
On this page

TexelKey

Type in Types

The vec4<…> key a texel load from texture key K yields: the loaded element is the element in the texture key, so texture_2d<u32> loads a vec4<u32>.

import type { TexelKey } from 'typeshade'

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

Syntax

type TexelKey<K extends string> = K extends `${string}<${infer E}>` ? `vec4<${E}>` : never;

Description

Deriving it from the key keeps the result type and the texture in step; a vec4<f32> result from an integer texture, which both GPU compilers reject, cannot be written with textureLoad.

See also

Source

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

Edit this page Report a problem