---
title: "WGSL resources and address spaces in TypeShade"
description: "A resource is a declare, the address space and the access mode are the wrapper type on the annotation, and the slot index is the source order."
url: https://typeshade.dev/guide/language/from-wgsl/resources/
language: en
---

# Resources and address spaces

A resource is a `declare`, which is TypeScript for a value something else provides. The address space is the wrapper type on the annotation. The access mode of a `storage` binding is the one its writes give, so a binding some entry writes is read-write and every other one is read-only, and every resource is a `const`.

WGSL TypeShade

```wgsl
@group(0) @binding(0) var<uniform> camera: Camera;
```

```ts
declare const camera: uniform<Camera>
```

```wgsl
@group(0) @binding(1) var<storage, read> src: array<f32>;
```

```ts
declare const src: storage<array<f32>>
```

```wgsl
@group(0) @binding(2) var<storage, read_write> dst: array<f32>;
```

```ts
declare const dst: storage<array<f32>, "read_write">
```

```wgsl
@group(0) @binding(3) var tex: texture_2d<f32>;
```

```ts
declare const tex: texture_2d<f32>
```

```wgsl
@group(0) @binding(4) var smp: sampler;
```

```ts
declare const smp: sampler
```

```wgsl
var<workgroup> tile: array<f32, 64>;
```

```ts
let tile: workgroup<array<f32, 64>>
```

```wgsl
var<private> seed: u32 = 7u;
```

```ts
let seed: u32 = 7
```

```wgsl
override tint: f32 = 0.85;
```

```ts
const tint: override<f32> = 0.85
```

There is no `@group` or `@binding` to write. The slot index is the source order of the `declare` in the file, and the WGSL above shows what that came out as. A texture or a sampler takes the next slot the same way.
