Skip to content

Commit

Permalink
Update after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mhawryluk committed Feb 13, 2025
1 parent 0b9fb04 commit 0e58721
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions apps/typegpu-docs/src/content/docs/fundamentals/functions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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<vec2f, 3>(
vec2(0.0, 0.5),
Expand All @@ -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);
}`)
Expand Down Expand Up @@ -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).

Expand Down
10 changes: 5 additions & 5 deletions apps/typegpu-docs/src/content/examples/simple/triangle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<vec2f, 3>(
vec2(0.0, 0.5),
Expand All @@ -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);
}`)
Expand Down

0 comments on commit 0e58721

Please sign in to comment.