FnParamSpec
타입, 작성 분류
The parameter record fn() accepts.
import type { FnParamSpec } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
type FnParamSpec = Record<string, ShaderType | ParamAttr | StructParamHandle>;설명
Each key is a parameter name and each value is one
of three things: a plain ShaderType for an ordinary parameter; a builtin
or location spec for an entry-point parameter that carries a stage attribute; or
a structDecl / ioStruct handle, in which case the body receives that
struct’s typed field proxy. One record shape covers plain helpers and @vertex,
@fragment and @compute entries alike. See FnHandle for the call surface a
record produces.
예제
예제
import { fn, builtin, toF32, vec4, u32T, vec4fT, type FnParamSpec } from 'typeshade'
const vs = fn( 'vs_main', { idx: builtin('vertex_index', u32T) } satisfies FnParamSpec, ({ idx }) => vec4(toF32(idx), 0, 0, 1), { stage: 'vertex', retAttr: builtin('position', vec4fT) },)함께 보기
소스
src/core/ir/builder.ts, 100행, 커밋 c66579bf 기준