DeclarableCapability
On this page

DeclarableCapability

Type in 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'

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

Syntax

type DeclarableCapability = Exclude<Capability, DerivedCapability>;

Description

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.

See also

Source

src/core/ir/nodes.ts, line 786, at commit 26de7be8

Edit this page Report a problem