You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sampled texture schemas are created using one of the following constructors:
391
+
392
+
-**`d.texture1d(sampleType?)`** - A 1D texture
393
+
-**`d.texture2d(sampleType?)`** - A 2D texture
394
+
-**`d.texture2dArray(sampleType?)`** - A 2D array texture
395
+
-**`d.texture3d(sampleType?)`** - A 3D texture
396
+
-**`d.textureCube(sampleType?)`** - A cube texture
397
+
-**`d.textureCubeArray(sampleType?)`** - A cube array texture
398
+
-**`d.textureMultisampled2d(sampleType?)`** - A 2D multisampled texture
399
+
400
+
The `sampleType` parameter can be `d.f32`, `d.i32`, or `d.u32`, determining how the texture data will be interpreted. If omitted, it defaults to `d.f32`.
const tex3 =d.texture2dArray(); // defaults to f32
412
+
// ^?
413
+
```
414
+
415
+
#### Depth Textures
416
+
417
+
For depth comparison operations, TypeGPU provides specialized depth texture schemas:
418
+
419
+
-**`d.textureDepth2d()`** - A 2D depth texture
420
+
-**`d.textureDepthMultisampled2d()`** - A 2D multisampled depth texture
421
+
-**`d.textureDepth2dArray()`** - A 2D array depth texture
422
+
-**`d.textureDepthCube()`** - A cube depth texture
423
+
-**`d.textureDepthCubeArray()`** - A cube array depth texture
424
+
425
+
```ts twoslash
426
+
import*asdfrom'typegpu/data';
427
+
// ---cut---
428
+
const depthTex =d.textureDepth2d();
429
+
// ^?
430
+
```
431
+
432
+
### Storage Textures
433
+
434
+
Storage texture schemas are created using dimension-specific constructors, with required `format` and optional `access` parameters:
435
+
436
+
-**`d.textureStorage1d(format, access?)`** - A 1D storage texture
437
+
-**`d.textureStorage2d(format, access?)`** - A 2D storage texture
438
+
-**`d.textureStorage2dArray(format, access?)`** - A 2D array storage texture
439
+
-**`d.textureStorage3d(format, access?)`** - A 3D storage texture
440
+
441
+
The `format` parameter specifies the texture format (e.g., `'rgba8unorm'`, `'rgba16float'`, `'r32float'`), and the `access` parameter can be `'write-only'`, `'read-only'`, or `'read-write'`. If `access` is omitted, it defaults to `'write-only'`.
0 commit comments