ModuleVarDecl
이 페이지에서

ModuleVarDecl

인터페이스, IR 분류

One entry of ModuleDecl.vars: a module-scope variable that is not a resource.

import type { ModuleVarDecl } from 'typeshade'

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

구문

interface ModuleVarDecl {
readonly name: string;
readonly space: 'workgroup' | 'private';
readonly type: ShaderType;
readonly init?: Expr;
}

설명

workgroup is WGSL’s var<workgroup>, memory one workgroup’s invocations share, zero at the start of each workgroup and never initialised. private is WGSL’s var<private>, a value each invocation owns for its lifetime, init or zero at its start. Neither has a group, a binding or a byte layout, so reflect reports nothing for one; a host never binds it.

인스턴스 속성

name읽기 전용 string
space읽기 전용 'workgroup' | 'private'
type읽기 전용 ShaderType
init선택 사항읽기 전용 Expr

The initial value, a constant expression over literals and module consts. Only a private variable carries one; WGSL forbids an initializer on workgroup memory.

함께 보기

소스

src/core/ir/nodes.ts, 423행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고