BindingDecl
인터페이스, IR 분류
A ModuleDecl.bindings entry: a resource bound at a slot.
import type { BindingDecl } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
interface BindingDecl { readonly group: number; readonly binding: number; readonly name: string; readonly space: AddressSpace; readonly access?: 'read' | 'read_write'; readonly type: ShaderType; readonly owner?: 'module' | 'host'; readonly precision?: 'highp' | 'mediump' | 'lowp'; readonly glsl?: 'std140-block' | 'loose';}설명
A ModuleDecl.bindings entry: a resource bound at a (group, binding) slot. It is a
uniform buffer, a storage buffer, a texture, or a sampler, keyed by type (a struct,
scalar or array type means a buffer; a texture or sampler ShaderType.kind means
a handle resource with no address space). WGSL emits both group and binding.
GLSL ES 3.00 has a single binding namespace, so its backend reads binding only;
group is still used by reflect, which groups resources per WGSL bind group.
Use uniformStruct, resource or storageBuffer to derive one
instead of constructing it directly.
인스턴스 속성
group읽기 전용numberbinding읽기 전용numbername읽기 전용stringspace읽기 전용AddressSpaceaccess선택 사항읽기 전용'read' | 'read_write'Storage access,
readorread_write. Ignored foruniform.type읽기 전용ShaderTypeowner선택 사항읽기 전용'module' | 'host'Who owns this resource.
'module'(the default) means the module declares it and describes its layout, and a host builds its bind group fromreflect.'host'means the resource belongs to the surrounding host, such as a bind group a host-integrated WebGPU renderer hands the module, so the host’s layout is the authority andreflectreports it underhostResources. Ownership does not change the spelling: a host-owned binding is still declared in the emitted source, which is what makes it type-checkable; it is just not the module’s to allocate. For a symbol the host’s prelude already declares, useexternVar, which emits nothing.precision선택 사항읽기 전용'highp' | 'mediump' | 'lowp'GLSL ES 3.00 precision qualifier for this declaration. GLSL only; WGSL has no such concept and ignores it. Without it the declaration takes the stage default from the precision preamble, which is right for a module that owns its own header and wrong for a fragment composed into a host program whose preamble the module does not control.
glsl선택 사항읽기 전용'std140-block' | 'loose'How a struct-typed uniform binding is spelled on GLSL ES 3.00. Ignored on WGSL, which has exactly one spelling, and ignored for non-struct types.
'std140-block'(the default, and the only choice for a module-owned block) emitslayout(std140) uniform Name { … } var;.'loose'emits one default-blockuniform <type> <field>;per member and rewrites everyvar.fieldread to the barefield, which is the form a GLSL host prelude provides. Only a host-owned block may choose'loose': for a module-owned block the two spellings are not interchangeable (std140 is the only one with a defined layout for a host to write into), so the choice would be a silent ABI change.
함께 보기
소스
src/core/ir/nodes.ts, 517행, 커밋 c66579bf 기준