Skip to content

Commit e38e67c

Browse files
committed
docs: New docs - update links
1 parent 7e7fb1a commit e38e67c

19 files changed

Lines changed: 43 additions & 43 deletions

File tree

apps/typegpu-docs/astro.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export default defineConfig({
121121
items: stripFalsy([
122122
{
123123
label: 'Your first GPU program',
124-
slug: 'new-fundamentals/your-first-gpu-program',
124+
slug: 'fundamentals/your-first-gpu-program',
125125
badge: { text: 'new' },
126126
},
127127
{

apps/typegpu-docs/src/content/docs/advanced/shader-generation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ If we were instead resolving eagerly, the resulting snippet would be `snip('3 *
122122
123123
### Data Types
124124
125-
The data types that accompany snippets are just [TypeGPU Data Schemas](/TypeGPU/fundamentals/data-schemas). This information
125+
The data types that accompany snippets are just [TypeGPU Data Schemas](/TypeGPU/apis/data-schemas). This information
126126
can be used by parent expressions to generate different code.
127127
128128
:::note

apps/typegpu-docs/src/content/docs/advanced/timestamp-queries.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This feature is under heavy development and is yet to reach stability.
1010
To measure shader execution time, you can use **timestamp queries**, which instruct compute or render passes to write timestamps at the start and end of execution. By reading back these timestamps, you can calculate the pipeline’s execution duration in nanoseconds.
1111

1212
:::tip
13-
To use performance callbacks and timestamp queries, you must enable the `timestamp-query` feature on your GPU device. See [Enabling Features](/TypeGPU/fundamentals/enabling-features) for details.
13+
To use performance callbacks and timestamp queries, you must enable the `timestamp-query` feature on your GPU device. See [Enabling Features](/TypeGPU/advanced/enabling-features) for details.
1414
:::
1515

1616
TypeGPU offers two ways to employ timestamp queries:

apps/typegpu-docs/src/content/docs/apis/accessors.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Accessors
33
description: Accessors are schema-aware typed placeholders for GPU resources, allowing reusable GPU functions to reference buffers, variables, textures, and more without coupling to a specific resource.
44
---
55

6-
When writing reusable GPU functions in TypeGPU, you often need to reference "some global value" without coupling to a specific buffer, texture or variable. [Slots](/TypeGPU/fundamentals/slots) seem like the right tool for the job, but they encode the delivery mechanism into the slot type (e.g. a buffer or texture), making it inflexible for reusable functions.
6+
When writing reusable GPU functions in TypeGPU, you often need to reference "some global value" without coupling to a specific buffer, texture or variable. [Slots](/TypeGPU/apis/slots) seem like the right tool for the job, but they encode the delivery mechanism into the slot type (e.g. a buffer or texture), making it inflexible for reusable functions.
77

88
```ts twoslash
99
import tgpu, { type TgpuUniform, d } from 'typegpu';
@@ -76,7 +76,7 @@ tgpu.resolve([getColor]);
7676

7777
## Overriding the binding
7878

79-
Use `.with(accessor, value)` on a function or pipeline — the same pattern as [slots](/fundamentals/slots):
79+
Use `.with(accessor, value)` on a function or pipeline — the same pattern as [slots](/apis/slots):
8080

8181
```ts twoslash
8282
import tgpu, { d } from 'typegpu';
@@ -499,5 +499,5 @@ Bind groups operate at **runtime**: the WGSL is fixed, and the GPU receives diff
499499
:::
500500

501501
Accessors and slots are complementary — you can combine them. For example, an accessor's default can reference a bind group layout entry (`() => layout.$.image`), and you can override it with `.with()` the same way as a slot.
502-
For more on slots, see the [Slots guide](/TypeGPU/fundamentals/slots).
503-
For more on bind groups, see the [Bind Groups guide](/TypeGPU/fundamentals/bind-groups).
502+
For more on slots, see the [Slots guide](/TypeGPU/apis/slots).
503+
For more on bind groups, see the [Bind Groups guide](/TypeGPU/apis/bind-groups).

apps/typegpu-docs/src/content/docs/apis/bind-groups.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ You can see the list of supported storage texture formats [here](https://www.w3.
217217
## Bind Groups
218218

219219
Before execution of a pipeline, any bind group that matches a given layout can be put in its place and used by the shader.
220-
To create a bind group, you can call the `createBindGroup` method on the [root object](/TypeGPU/fundamentals/roots) and associate each named key with
220+
To create a bind group, you can call the `createBindGroup` method on the [root object](/TypeGPU/apis/roots) and associate each named key with
221221
a proper resource.
222222

223223
```ts

apps/typegpu-docs/src/content/docs/apis/buffers.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ This buffer can then be used and/or updated by a WGSL shader.
6363
## Creating a buffer
6464

6565
To create a buffer, you will need to define its schema by composing data types imported from `typegpu/data`. Every WGSL data-type can be represented as JS schemas, including
66-
structs and arrays. They will be explored in more detail in [a following chapter](/TypeGPU/fundamentals/data-schemas).
66+
structs and arrays. They will be explored in more detail in [a following chapter](/TypeGPU/apis/data-schemas).
6767

6868
```ts twoslash
6969
import tgpu, { d } from 'typegpu';
@@ -541,7 +541,7 @@ import ListItem from '../../../components/ListItem.astro';
541541

542542
## Index Buffers
543543
TypeGPU also allows for the use of index buffers. An index buffer is a buffer containing a sequence of `u32` or `u16` indices, which indicate in which order vertices will be processed. This is particulary useful for rendering geometry, where vertices are often shared between multiple primitives (e.g., triangles), as it avoids duplicating vertex data.
544-
You may refer to the [pipelines](/TypeGPU/fundamentals/pipelines/#drawing-with-drawindexed) section for usage details.
544+
You may refer to the [pipelines](/TypeGPU/apis/pipelines/#drawing-with-drawindexed) section for usage details.
545545

546546
```ts twoslash
547547
import tgpu, { d } from 'typegpu';
@@ -562,7 +562,7 @@ There are two approaches provided by TypeGPU.
562562
### Manual binding
563563

564564
The default option is to create bind group layouts and bind your buffers via bind groups.
565-
Read more in the chapter dedicated to [bind groups](/TypeGPU/fundamentals/bind-groups).
565+
Read more in the chapter dedicated to [bind groups](/TypeGPU/apis/bind-groups).
566566

567567
```ts twoslash
568568
import tgpu, { d } from 'typegpu';
@@ -620,4 +620,4 @@ pipeline.dispatchThreads(100);
620620

621621
TypeGPU automatically generates a "catch-all" bind group and populates it with the fixed resources.
622622

623-
You can also use [`resolveWithContext`](/TypeGPU/fundamentals/resolve/#resolvewithcontext) to access the automatically generated bind group and layout containing your fixed resources.
623+
You can also use [`resolveWithContext`](/TypeGPU/apis/resolve/#resolvewithcontext) to access the automatically generated bind group and layout containing your fixed resources.

apps/typegpu-docs/src/content/docs/apis/data-schemas.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ const instance = Fish({ kind: 0, state: { pos: d.vec3f(), vel: d.vec3f() } });
278278
```
279279

280280
:::caution
281-
You cannot use nested structs in [vertex layouts](/TypeGPU/fundamentals/vertex-layouts).
281+
You cannot use nested structs in [vertex layouts](/TypeGPU/apis/vertex-layouts).
282282
:::
283283

284284
If you wish to extract the JS type equivalent of a TypeGPU schema, you can do so with `d.Infer`:
@@ -343,7 +343,7 @@ const myDefaultArray = MyArray(); // [0, 0, 0, 0]
343343
const myInitializedArray = MyArray([1, 0, 0.5, 20]);
344344
```
345345

346-
You can also call `d.arrayOf` without specifying the array length. This returns a partially applied schema function, allowing you to provide the length later or use the schema to declare WGSL [runtime-sized arrays](/TypeGPU/fundamentals/bind-groups#runtime-sized-example).
346+
You can also call `d.arrayOf` without specifying the array length. This returns a partially applied schema function, allowing you to provide the length later or use the schema to declare WGSL [runtime-sized arrays](/TypeGPU/apis/bind-groups#runtime-sized-example).
347347

348348
```ts twoslash
349349
import { d } from 'typegpu';

apps/typegpu-docs/src/content/docs/apis/functions/index.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const baz = d.f16(123); // generates: const baz = 123h;
106106
To make this all work, we perform a small transformation to functions marked with `'use gpu'`. Every project's setup is different, and we want to be as non-invasive as possible. The [unplugin-typegpu](/TypeGPU/tooling/unplugin-typegpu) package hooks into existing bundlers and build tools, extracts ASTs from TypeGPU functions and compacts them into our custom format called [tinyest](https://www.npmjs.com/package/tinyest). This metadata is injected into the final JS bundle, then used to efficiently generate equivalent WGSL at runtime.
107107

108108
:::tip
109-
If all your shader code is predetermined, or you want to precompute a set of variants ahead of time, you can combine [unplugin-macros](https://github.com/unplugin/unplugin-macros) and our [resolve API](/TypeGPU/fundamentals/resolve).
109+
If all your shader code is predetermined, or you want to precompute a set of variants ahead of time, you can combine [unplugin-macros](https://github.com/unplugin/unplugin-macros) and our [resolve API](/TypeGPU/apis/resolve).
110110
:::
111111

112112

@@ -240,7 +240,7 @@ fact that these values are known at shader compilation time, and can be optimize
240240
since they use values known only during shader execution.
241241

242242
:::tip
243-
To avoid inlining, use [tgpu.const](/TypeGPU/fundamentals/variables#const-variables).
243+
To avoid inlining, use [tgpu.const](/TypeGPU/apis/variables#const-variables).
244244
:::
245245

246246
After seeing this, you might be tempted to use this mechanism for sharing data between the CPU and GPU, or for defining
@@ -274,8 +274,8 @@ pipeline.dispatchThreads();
274274
```
275275

276276
There are explicit mechanisms that allow you to achieve this:
277-
- [Use buffers to efficiently share data between the CPU and GPU](/TypeGPU/fundamentals/buffers)
278-
- [Use variables to share state between functions](/TypeGPU/fundamentals/variables)
277+
- [Use buffers to efficiently share data between the CPU and GPU](/TypeGPU/apis/buffers)
278+
- [Use variables to share state between functions](/TypeGPU/apis/variables)
279279

280280
### Supported JavaScript functionality
281281

@@ -292,7 +292,7 @@ Without it, you can still use operators for numbers,
292292
but for vectors and matrices you have to use supplementary functions from `typegpu/std` (*add, mul, eq, lt, ge...*), or use a fluent interface (*abc.mul(xyz), ...*)
293293

294294
* **Calling other functions** --
295-
Only functions marked with `'use gpu'` can be called from within a shader. There are two exceptions to that rule: [`console.log`](/TypeGPU/fundamentals/utils#consolelog), which allows for tracking runtime behavior
295+
Only functions marked with `'use gpu'` can be called from within a shader. There are two exceptions to that rule: [`console.log`](/TypeGPU/apis/utils#consolelog), which allows for tracking runtime behavior
296296
of shaders in a familiar way, as well as most `Math` functions.
297297

298298
:::caution
@@ -324,7 +324,7 @@ function manhattanDistance(a: d.v3f, b: d.v3f) {
324324
## Function shells
325325

326326
In order to limit a function's signature to specific types, you can wrap it in a *shell*, an object holding only the input and output types.
327-
The shell constructor `tgpu.fn` relies on [TypeGPU schemas](/TypeGPU/fundamentals/data-schemas), objects that represent WGSL data types and assist in generating shader code at runtime.
327+
The shell constructor `tgpu.fn` relies on [TypeGPU schemas](/TypeGPU/apis/data-schemas), objects that represent WGSL data types and assist in generating shader code at runtime.
328328
It accepts two arguments:
329329

330330
- An array of schemas representing argument types,
@@ -418,7 +418,7 @@ const getGradientColor = tgpu.fn([d.f32], d.vec4f)`(ratio) {
418418
`.$uses({ purple, get_blue: getBlue });
419419
```
420420

421-
You can see for yourself what `getGradientColor` resolves to by calling [`tgpu.resolve`](/TypeGPU/fundamentals/resolve), all relevant definitions will be automatically included:
421+
You can see for yourself what `getGradientColor` resolves to by calling [`tgpu.resolve`](/TypeGPU/apis/resolve), all relevant definitions will be automatically included:
422422

423423
```wgsl
424424
// results of calling tgpu.resolve([getGradientColor])
@@ -625,7 +625,7 @@ struct mainFragment_Input {
625625
Pipelines are an *unstable* feature. The API may be subject to change in the near future.
626626
:::
627627

628-
Typed functions are crucial for simplified [pipeline](/TypeGPU/fundamentals/pipelines) creation offered by TypeGPU. You can define and run pipelines as follows:
628+
Typed functions are crucial for simplified [pipeline](/TypeGPU/apis/pipelines) creation offered by TypeGPU. You can define and run pipelines as follows:
629629

630630
```ts twoslash
631631
import tgpu, { d } from 'typegpu';

apps/typegpu-docs/src/content/docs/apis/pipelines.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ description: A guide on how to use TypeGPU render and compute pipelines.
66
:::note[Recommended reading]
77
It is assumed that you are familiar with the following concepts:
88
- <a href="https://webgpufundamentals.org/webgpu/lessons/webgpu-fundamentals.html" target="_blank" rel="noopener noreferrer">WebGPU Fundamentals</a>
9-
- [TypeGPU Functions](/TypeGPU/fundamentals/functions)
9+
- [TypeGPU Functions](/TypeGPU/apis/functions)
1010
:::
1111

1212
TypeGPU introduces a custom API to easily define and execute render and compute pipelines.
1313
It abstracts away the standard WebGPU procedures to offer a convenient, type-safe way to run shaders on the GPU.
1414

1515
## Creating pipelines
1616

17-
A pipeline can be defined with one of the following methods on the [root](/TypeGPU/fundamentals/roots) object:
17+
A pipeline can be defined with one of the following methods on the [root](/TypeGPU/apis/roots) object:
1818
- [createRenderPipeline](#createrenderpipeline)
1919
- [createComputePipeline](#createcomputepipeline)
2020
- [createGuardedComputePipeline](#createguardedcomputepipeline)
@@ -288,7 +288,7 @@ renderPipeline
288288

289289
### Resource bindings
290290

291-
Before executing pipelines, it is necessary to bind all of the utilized resources, like bind groups, vertex buffers and slots. It is done using the `with` method. It accepts either [a bind group](/TypeGPU/fundamentals/bind-groups) (render and compute pipelines) or [a vertex layout and a vertex buffer](/TypeGPU/fundamentals/vertex-layouts) (render pipelines only).
291+
Before executing pipelines, it is necessary to bind all of the utilized resources, like bind groups, vertex buffers and slots. It is done using the `with` method. It accepts either [a bind group](/TypeGPU/apis/bind-groups) (render and compute pipelines) or [a vertex layout and a vertex buffer](/TypeGPU/apis/vertex-layouts) (render pipelines only).
292292

293293
```ts
294294
// vertex layout
@@ -327,7 +327,7 @@ computePipeline
327327
### Timing performance
328328

329329
Pipelines also expose the `withPerformanceCallback` and `withTimestampWrites` methods for timing the execution time on the GPU.
330-
For more info about them, refer to the [Timing Your Pipelines guide](/TypeGPU/fundamentals/timestamp-queries/).
330+
For more info about them, refer to the [Timing Your Pipelines guide](/TypeGPU/advanced/timestamp-queries/).
331331

332332
### *draw*, *dispatchWorkgroups*
333333

@@ -339,7 +339,7 @@ Compute pipelines are executed using the `dispatchWorkgroups` method, which acce
339339

340340
### Drawing with `drawIndexed`
341341

342-
The `drawIndexed` is analogous to draw, but takes advantage of [index buffer](/TypeGPU/fundamentals/buffers/#index-buffers) to explicitly map vertex data onto primitives. When using an index buffer, you don't need to list every vertex for every primitive explicitly. Instead, you provide a list of unique vertices in a vertex buffer. Then, the index buffer defines how these vertices are connected to form primitives.
342+
The `drawIndexed` is analogous to draw, but takes advantage of [index buffer](/TypeGPU/apis/buffers/#index-buffers) to explicitly map vertex data onto primitives. When using an index buffer, you don't need to list every vertex for every primitive explicitly. Instead, you provide a list of unique vertices in a vertex buffer. Then, the index buffer defines how these vertices are connected to form primitives.
343343

344344
```ts twoslash
345345
import tgpu, { d } from 'typegpu';

apps/typegpu-docs/src/content/docs/apis/resolve.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ The second `tgpu.resolve` overload has only one argument -- an object with optio
109109
The goal of this overload is to extend the existing WGSL code provided as `template`, with additional definitions from `externals`.
110110

111111
:::tip
112-
This variant of `tgpu.resolve` can often be omitted by using [WGSL-implemented functions](/TypeGPU/fundamentals/functions/#implementing-functions-in-wgsl).
112+
This variant of `tgpu.resolve` can often be omitted by using [WGSL-implemented functions](/TypeGPU/apis/functions/#implementing-functions-in-wgsl).
113113
Use it when you are already provided with existing WGSL code and want to extend it.
114114
:::
115115

0 commit comments

Comments
 (0)