---
title: "capabilityMatrix(): function in Backends, TypeShade API"
description: "capabilityMatrix, a function in Backends. Report which backend can spell which capability, as one row per capability with a support class per backend."
url: https://typeshade.dev/api/capabilitymatrix/
language: en
---

# `capabilityMatrix()`

Function in Backends

Report which backend can spell which capability, as one row per capability with a support class per backend.

`import { capabilityMatrix } from 'typeshade'`

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

## Syntax

```ts
function capabilityMatrix(backends: readonly Backend[]): readonly CapabilityRow[]
```

## Parameters

**`backends` `readonly Backend[]`**

the backends to compare, in the column order you want.

## Return value

`readonly CapabilityRow[]`

one row per capability, in the canonical capability order.

## Exceptions

**`UnsupportedFeatureError`**

Emit throws UnsupportedFeatureError with SD0030 naming the capability, and no source the driver would reject is produced. declarable is false for the nine capabilities derived from a module’s shape, which enables cannot name: storageBuffer, compute, msaaTextureLoad, storageTexture, texture1d, textureCubeArray, `textureGather`, bgra8unormStorage and packed4x8Dot.

**[`SD0030`](https://typeshade.dev/reference/errors/sd0030/)**

Emit throws UnsupportedFeatureError with SD0030 naming the capability, and no source the driver would reject is produced. declarable is false for the nine capabilities derived from a module’s shape, which enables cannot name: storageBuffer, compute, msaaTextureLoad, storageTexture, texture1d, textureCubeArray, `textureGather`, bgra8unormStorage and packed4x8Dot.

## Description

The support classes are read from each backend’s own `capProfile` table, so the matrix cannot go stale against the thing it describes. A row reads `'native'` when the target needs nothing, `'directive'` when the backend emits a source line for it, `'host-feature'` when the host activates it before pipeline creation, and `'unsupported'` when that target has no row at all. A capability may need both halves, a directive and a host feature, and the class names the one that decides the row.

Support is not reachability. A capability can have a profile row and no way to author it: a row says the backend would emit the directive, and whether the DSL has a construct that needs it is a separate question. Read a row as a fact about the emit, and check the authoring surface separately.

A missing row is a hard stop by design, and it is no hint to work around. Emit throws `UnsupportedFeatureError` with [`SD0030`](https://typeshade.dev/reference/errors/sd0030/) naming the capability, and no source the driver would reject is produced.

`declarable` is false for the nine capabilities derived from a module’s shape, which `enables` cannot name: `storageBuffer`, `compute`, `msaaTextureLoad`, `storageTexture`, `texture1d`, `textureCubeArray`, `textureGather`, `bgra8unormStorage` and `packed4x8Dot`. It reads the same list [`DeclarableCapability`](https://typeshade.dev/api/declarablecapability/) is defined against.

## Examples

### Example

```ts
import { capabilityMatrix, wgslBackend, glslEs300Backend } from 'typeshade'

capabilityMatrix([wgslBackend, glslEs300Backend])
// [{ capability: 'storageBuffer',
//    support: { wgsl: 'native', 'glsl-es300': 'unsupported' }, declarable: false },
//  …,
//  { capability: 'f16',
//    support: { wgsl: 'directive', 'glsl-es300': 'unsupported' }, declarable: true }]
```

## In the guide

- [Capabilities & extensions](https://typeshade.dev/guide/internals/capabilities-extensions/)

## See also

- [`DeclarableCapability`](https://typeshade.dev/api/declarablecapability/)
- [`hostFeaturesFor`](https://typeshade.dev/api/hostfeaturesfor/)
- [`ModuleDecl`](https://typeshade.dev/api/moduledecl/)

## Source

[`src/core/backend.ts`, line 422](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/backend.ts#L422), at commit af54ddad5
