Capabilities
Class in Backends
The set of capabilities a backend supports, built from its capProfile with Capabilities.fromProfile.
import { Capabilities } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit af54ddad5.
Syntax
class CapabilitiesDescription
Membership in the profile’s keys is support, so the set and the profile are one fact.
The capability gate that runs before every emit uses it: it derives what a module needs
(a storage binding needs storageBuffer, a @compute entry needs compute, a multisampled
texture load needs msaaTextureLoad, plus whatever the module lists in enables), calls
covers(reqs), and on a miss calls missing(reqs) to name the capabilities the target
cannot emit. The thrown UnsupportedFeatureError then reads “backend ‘glsl-es300’
cannot emit this module: missing capabilities: compute”, with the whole module as context.
The GLSL ES 3.00 capProfile has no row for storageBuffer, compute, or msaaTextureLoad
yet (Rule 10.5): the gate refuses the module before the writer sees it.
Constructor
new Capabilities(private readonly set: ReadonlySet<Capability>)
Instance methods
fromProfile(profile: CapProfile): CapabilitiesThe capabilities a
capProfiledeclares, read from its keys. Build coverage this way so that profile membership and capability coverage stay one fact.has(c: Capability): booleancovers(reqs: Iterable<Capability>): booleanTrue iff this target supports everything
reqsneeds.missing(reqs: Iterable<Capability>): Capability[]
See also
Source
src/core/backend.ts, line 59, at commit af54ddad5