diff --git a/apps/typegpu-docs/astro.config.mjs b/apps/typegpu-docs/astro.config.mjs index 4e4597e6d7..84ff2b1279 100644 --- a/apps/typegpu-docs/astro.config.mjs +++ b/apps/typegpu-docs/astro.config.mjs @@ -243,6 +243,19 @@ export default defineConfig({ }, ]), }, + { + label: 'Migrations', + items: stripFalsy([ + DEV && { + label: 'Migrating to 0.12', + slug: 'migrations/0-12', + }, + { + label: 'Migrating to 0.11', + slug: 'migrations/0-11', + }, + ]), + }, { label: 'Tooling', items: stripFalsy([ diff --git a/apps/typegpu-docs/src/content/docs/migrations/0-11.mdx b/apps/typegpu-docs/src/content/docs/migrations/0-11.mdx new file mode 100644 index 0000000000..706552c76b --- /dev/null +++ b/apps/typegpu-docs/src/content/docs/migrations/0-11.mdx @@ -0,0 +1,32 @@ +--- +title: Migrating to 0.11 +--- + +The `buffer.writePartial` API is being deprecated in favor of `buffer.patch`. +To migrate, simply replace any partial write of arrays in the form of `[{ idx: 2, value: foo }, /* ... */]` with `{ 2: foo, /* ... */ }`. + +```diff lang=ts +const buffer = root.createBuffer(d.arrayOf(d.vec3f, 5)).$usage('storage'); + +- buffer.writePartial([{ idx: 2, value: d.vec3f(1, 2, 3) }]); ++ buffer.patch({ 2: d.vec3f(1, 2, 3) }); +``` + +### Stabilizing textures and samplers + +One by one, we're making our APIs available without the `['~unstable']` prefix, and this time around, it's **textures** and **samplers**. +Just drop the unstable prefix, and you're good to go. + +```diff lang=ts +- const sampler = root['~unstable'].createSampler({ ++ const sampler = root.createSampler({ + magFilter: 'linear', + minFilter: 'linear', +}); + +- const texture = root['~unstable'].createTexture({ ++ const texture = root.createTexture({ + size: [256, 256], + format: 'rgba8unorm' as const, +}).$usage('sampled'); +``` diff --git a/apps/typegpu-docs/src/content/docs/migrations/0-12.mdx b/apps/typegpu-docs/src/content/docs/migrations/0-12.mdx new file mode 100644 index 0000000000..822d4598d7 --- /dev/null +++ b/apps/typegpu-docs/src/content/docs/migrations/0-12.mdx @@ -0,0 +1,4 @@ +--- +title: Migrating to 0.12 +draft: true +---