---
title: "BindingDecl: interface in IR, TypeShade API reference"
description: "BindingDecl, an interface in IR. A ModuleDecl.bindings entry: a resource bound at a slot."
url: https://typeshade.dev/api/bindingdecl/
language: en
---

# `BindingDecl`

Interface in IR

A ModuleDecl.bindings entry: a resource bound at a slot.

`import type { BindingDecl } from 'typeshade'`
`import type { BindingDecl } from 'typeshade/core/ir'`

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

## Syntax

```ts
interface BindingDecl {
  readonly group: number;
  readonly binding: number;
  readonly name: string;
  readonly space: AddressSpace;
  readonly access?: 'read' | 'read_write';
  readonly type: ShaderType;
  readonly owner?: 'module' | 'host';
  readonly precision?: 'highp' | 'mediump' | 'lowp';
  readonly glsl?: 'std140-block' | 'loose';
}
```

## Description

A `ModuleDecl.bindings` entry: a resource bound at a `(group, binding)` slot. It is a uniform buffer, a storage buffer, a texture, or a sampler, keyed by `type` (a struct, scalar or array type means a buffer; a `texture` or `sampler` `ShaderType.kind` means a handle resource with no address space). WGSL emits both `group` and `binding`. GLSL ES 3.00 has a single binding namespace, so its backend reads `binding` only; `group` is still used by [`reflect`](https://typeshade.dev/api/reflect/), which groups resources per WGSL bind group. Use [`uniformStruct`](https://typeshade.dev/api/uniformstruct/), [`resource`](https://typeshade.dev/api/resource/) or [`storageBuffer`](https://typeshade.dev/api/storagebuffer/) to derive one instead of constructing it directly.

## Instance properties

**`group` read only `number`**

**`binding` read only `number`**

**`name` read only `string`**

**`space` read only `AddressSpace`**

**`access` optional read only `'read' | 'read_write'`**

Storage access, `read` or `read_write`. Ignored for `uniform`.

**`type` read only `ShaderType`**

**`owner` optional read only `'module' | 'host'`**

Who owns this resource. `'module'` (the default) means the module declares it and describes its layout, and a host builds its bind group from [`reflect`](https://typeshade.dev/api/reflect/). `'host'` means the resource belongs to the surrounding host, such as a bind group a host-integrated WebGPU renderer hands the module, so the host’s layout is the authority and [`reflect`](https://typeshade.dev/api/reflect/) reports it under `hostResources`. Ownership does not change the spelling: a host-owned binding is still declared in the emitted source, which is what makes it type-checkable; it is just not the module’s to allocate. For a symbol the host’s prelude already declares, use [`externVar`](https://typeshade.dev/api/externvar/), which emits nothing.

**`precision` optional read only `'highp' | 'mediump' | 'lowp'`**

GLSL ES 3.00 precision qualifier for this declaration. GLSL only; WGSL has no such concept and ignores it. Without it the declaration takes the stage default from the precision preamble, which is right for a module that owns its own header and wrong for a fragment composed into a host program whose preamble the module does not control.

**`glsl` optional read only `'std140-block' | 'loose'`**

How a struct-typed uniform binding is spelled on GLSL ES 3.00. Ignored on WGSL, which has exactly one spelling, and ignored for non-struct types.

`'std140-block'` (the default, and the only choice for a module-owned block) emits `layout(std140) uniform Name { … } var;`. `'loose'` emits one default-block `uniform <type> <field>;` per member and rewrites every `var.field` read to the bare `field`, which is the form a GLSL host prelude provides. Only a host-owned block may choose `'loose'`: for a module-owned block the two spellings are not interchangeable (std140 is the only one with a defined layout for a host to write into), so the choice would be a silent ABI change.

## See also

- [`reflect`](https://typeshade.dev/api/reflect/)
- [`uniformStruct`](https://typeshade.dev/api/uniformstruct/)
- [`resource`](https://typeshade.dev/api/resource/)
- [`storageBuffer`](https://typeshade.dev/api/storagebuffer/)
- [`externVar`](https://typeshade.dev/api/externvar/)

## Source

[`src/core/ir/nodes/host-interface-decls.ts`, line 41](https://github.com/typeshade/typeshade/blob/af54ddad5/src/core/ir/nodes/host-interface-decls.ts#L41), at commit af54ddad5
