Capabilities
On this page

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 26de7be8.

Syntax

class Capabilities

Description

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. This is why the GLSL ES 3.00 capProfile has no row for storageBuffer, compute, or msaaTextureLoad: the gate refuses the module before the writer sees it.

Constructor

new Capabilities(private readonly set: ReadonlySet<Capability>)

Instance methods

fromProfile (profile: CapProfile): Capabilities

The capabilities a capProfile declares, read from its keys. Build coverage this way so that profile membership and capability coverage stay one fact.

has (c: Capability): boolean
covers (reqs: Iterable<Capability>): boolean

True iff this target supports everything reqs needs.

missing (reqs: Iterable<Capability>): Capability[]

See also

Source

src/core/backend.ts, line 74, at commit 26de7be8

Edit this page Report a problem