stageOf()
함수, IR 분류
함수 선언의 스테이지입니다. 진입점이면 'vertex', 'fragment' 또는 'compute'이고, 헬퍼이면 undefined입니다.
import { stageOf } from 'typeshade'import { stageOf } from 'typeshade/core/ir'
설명은 커밋 af54ddad5의 검토된 컴파일러 문서를 번역한 것입니다. 시그니처와 예제 코드는 원문을 따르며, 필요한 경우 설명에 편집상 수정이 반영됩니다.
구문
const stageOf: ( f: Pick<FuncDecl, "stage" | "attrs">,) => "vertex" | "fragment" | "compute" | undefined매개변수
fPick<FuncDecl, 'stage' | 'attrs'>
반환값
'vertex' | 'fragment' | 'compute' | undefined
설명
함수 선언의 스테이지입니다. 진입점이면 'vertex', 'fragment' 또는 'compute'이고, 헬퍼이면 undefined입니다. 먼저 구조화된 stage 필드를 읽고, 직접 만든 FuncDecl 리터럴이면 attrs 문자열로 폴백합니다. 패키지의 모든 스테이지 판단은 이 함수 하나를 거칩니다. 여기에는 reflect, 기능 게이트, GLSL 진입점 분류, 죽은 함수 제거의 루트가 포함됩니다.
함께 보기
소스
src/core/ir/nodes.ts, 599행, 커밋 af54ddad5 기준