emitConst
이 페이지에서

emitConst()

함수, 출력 분류

Emit one ConstDecl as a WGSL const line, without the surrounding module.

import { emitConst } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

const emitConst: (c: ConstDecl) => string

매개변수

c ConstDecl

반환값

string

설명

Use it to compose a shader out of separately authored pieces: emit the constants once, keep the string, and concatenate it with the rest of the source. The line is identical to the one emitModule writes for the same declaration, so a piece emitted here and a module emitted there agree, which is what makes concatenation safe.

The declaration is written as given: the passes emitModule runs before writing a module do not run here, so pass a declaration that needs none of them. The caveat on emitFuncs applies equally.

대상별 지원

대상지원비고
WGSL (WebGPU) 지원

Writes WGSL for WebGPU.

GLSL ES 3.00 (WebGL2) 해당 없음
CPU 오라클 해당 없음

함께 보기

소스

src/core/backends/wgsl.ts, 503행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고