DeclarableCapability
이 페이지에서

DeclarableCapability

타입, IR 분류

The capabilities a module may name in ModuleDecl.enables: Capability minus the nine capabilities derived from the module's shape.

import type { DeclarableCapability } from 'typeshade'

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

구문

type DeclarableCapability = Exclude<Capability, DerivedCapability>;

설명

requiredCaps infers each of those from what the module already says (a storage binding means storageBuffer, a @compute entry means compute, a multisampled texture means msaaTextureLoad, and so on through the texture ids, a bgra8unorm storage format and the packed 4x8 calls), so declaring one would at best restate the shape and at worst assert a feature the module does not use. This type makes that a compile error. The excluded list is the private DERIVED_CAPABILITIES (derived-capabilities.ts), the same list capabilityMatrix reads for its declarable column.

clipDistances, primitiveIndex and subgroups are on both sides and deliberately so: each is derived from a @builtin(...) id the module spells (§50), and each is still declarable, because a module may hold the directive for a feature it reaches another way. Deriving and declaring meet in one set, so naming one changes nothing.

Only the authoring surface narrows: requiredCaps, Capabilities and CapProfile keep reading the full Capability, because the derived ids are exactly what they must express.

함께 보기

소스

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

이 페이지 편집 문제 보고