From 0e587217139e3292ec626475ebbb18e86d02119c Mon Sep 17 00:00:00 2001 From: mhawryluk Date: Thu, 13 Feb 2025 13:12:13 +0100 Subject: [PATCH] Update after merge --- .../src/content/docs/fundamentals/functions.mdx | 12 ++++++------ .../src/content/examples/simple/triangle/index.ts | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/typegpu-docs/src/content/docs/fundamentals/functions.mdx b/apps/typegpu-docs/src/content/docs/fundamentals/functions.mdx index c1ff9107b..f86b0042b 100644 --- a/apps/typegpu-docs/src/content/docs/fundamentals/functions.mdx +++ b/apps/typegpu-docs/src/content/docs/fundamentals/functions.mdx @@ -79,10 +79,10 @@ They can be passed to root-defined pipelines and they accept special arguments l ```ts const mainVertex = tgpu['~unstable'] - .vertexFn( - { vertexIndex: d.builtin.vertexIndex }, - { outPos: d.builtin.position, uv: d.vec2f }, - ) + .vertexFn({ + in: { vertexIndex: d.builtin.vertexIndex }, + out: { outPos: d.builtin.position, uv: d.vec2f }, + }) .does(/* wgsl */ `(input: VertexInput) -> VertexOutput { var pos = array( vec2(0.0, 0.5), @@ -100,7 +100,7 @@ const mainVertex = tgpu['~unstable'] }`); const mainFragment = tgpu['~unstable'] - .fragmentFn({ uv: d.vec2f }, d.vec4f) + .fragmentFn({ in: { uv: d.vec2f }, out: d.vec4f }) .does(/* wgsl */ `(input: FragmentInput) -> @location(0) vec4f { return getGradientColor((input.uv[0] + input.uv[1]) / 2); }`) @@ -133,7 +133,7 @@ root['~unstable'].flush(); ``` And the rendering result looks like this: -![rendering result - blue triangle](../../../assets/triangle-result.png) +![rendering result - gradient triangle](../../../assets/triangle-result.png) You can check out the full example on [our examples page](/TypeGPU/examples#example=simple--triangle). diff --git a/apps/typegpu-docs/src/content/examples/simple/triangle/index.ts b/apps/typegpu-docs/src/content/examples/simple/triangle/index.ts index e5969aca3..2530d7568 100644 --- a/apps/typegpu-docs/src/content/examples/simple/triangle/index.ts +++ b/apps/typegpu-docs/src/content/examples/simple/triangle/index.ts @@ -26,10 +26,10 @@ const getGradientColor = tgpu['~unstable'] .$name('getGradientColor'); const mainVertex = tgpu['~unstable'] - .vertexFn( - { vertexIndex: d.builtin.vertexIndex }, - { outPos: d.builtin.position, uv: d.vec2f }, - ) + .vertexFn({ + in: { vertexIndex: d.builtin.vertexIndex }, + out: { outPos: d.builtin.position, uv: d.vec2f }, + }) .does(/* wgsl */ `(input: VertexInput) -> VertexOutput { var pos = array( vec2(0.0, 0.5), @@ -47,7 +47,7 @@ const mainVertex = tgpu['~unstable'] }`); const mainFragment = tgpu['~unstable'] - .fragmentFn({ uv: d.vec2f }, d.vec4f) + .fragmentFn({ in: { uv: d.vec2f }, out: d.vec4f }) .does(/* wgsl */ `(input: FragmentInput) -> @location(0) vec4f { return getGradientColor((input.uv[0] + input.uv[1]) / 2); }`)