diff --git a/apps/typegpu-docs/src/content/examples/rendering/box-raytracing/index.ts b/apps/typegpu-docs/src/content/examples/rendering/box-raytracing/index.ts index 6658a1db..9c91f099 100644 --- a/apps/typegpu-docs/src/content/examples/rendering/box-raytracing/index.ts +++ b/apps/typegpu-docs/src/content/examples/rendering/box-raytracing/index.ts @@ -185,7 +185,7 @@ const vertexFunction = tgpu['~unstable'] { vertexIndex: d.builtin.vertexIndex }, { outPos: d.builtin.position }, ) - .does(/* wgsl */ `(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput { + .does(/* wgsl */ `(input: VertexInput) -> VertexOutput { var pos = array( vec2( 1, 1), vec2( 1, -1), @@ -196,7 +196,7 @@ const vertexFunction = tgpu['~unstable'] ); var output: VertexOutput; - output.outPos = vec4f(pos[vertexIndex], 0, 1); + output.outPos = vec4f(pos[input.vertexIndex], 0, 1); return output; }`) .$name('vertex_main'); diff --git a/apps/typegpu-docs/src/content/examples/simulation/boids-next/index.ts b/apps/typegpu-docs/src/content/examples/simulation/boids-next/index.ts index d43b67c2..a5a56656 100644 --- a/apps/typegpu-docs/src/content/examples/simulation/boids-next/index.ts +++ b/apps/typegpu-docs/src/content/examples/simulation/boids-next/index.ts @@ -42,11 +42,11 @@ const VertexOutput = { const mainVert = tgpu['~unstable'] .vertexFn({ v: d.vec2f, center: d.vec2f, velocity: d.vec2f }, VertexOutput) - .does(/* wgsl */ `(@location(0) v: vec2f, @location(1) center: vec2f, @location(2) velocity: vec2f) -> VertexOutput { - let angle = getRotationFromVelocity(velocity); - let rotated = rotate(v, angle); + .does(/* wgsl */ `(input: VertexInput) -> VertexOutput { + let angle = getRotationFromVelocity(input.velocity); + let rotated = rotate(input.v, angle); - let pos = vec4(rotated + center, 0.0, 1.0); + let pos = vec4(rotated + input.center, 0.0, 1.0); let color = vec4( sin(angle + colorPalette.r) * 0.45 + 0.45, @@ -223,7 +223,7 @@ const mainCompute = tgpu['~unstable'] var alignmentCount = 0u; var cohesion = vec2(0.0, 0.0); var cohesionCount = 0u; - + for (var i = 0u; i < arrayLength(¤tTrianglePos); i = i + 1) { if (i == index) { continue; @@ -253,7 +253,7 @@ const mainCompute = tgpu['~unstable'] + (alignment * params.alignmentStrength) + (cohesion * params.cohesionStrength); instanceInfo.velocity = normalize(instanceInfo.velocity) * clamp(length(instanceInfo.velocity), 0.0, 0.01); - + if (instanceInfo.position[0] > 1.0 + triangleSize) { instanceInfo.position[0] = -1.0 - triangleSize; } @@ -340,7 +340,7 @@ export const controls = { onButtonClick: () => paramsBuffer.write(presets.blobs), }, - '⚛️ Particles': { + '⚛ Particles': { onButtonClick: () => paramsBuffer.write(presets.particles), }, diff --git a/apps/typegpu-docs/src/content/examples/simulation/confetti/index.ts b/apps/typegpu-docs/src/content/examples/simulation/confetti/index.ts index 5e70000b..64e164fe 100644 --- a/apps/typegpu-docs/src/content/examples/simulation/confetti/index.ts +++ b/apps/typegpu-docs/src/content/examples/simulation/confetti/index.ts @@ -113,22 +113,16 @@ const mainVert = tgpu['~unstable'] VertexOutput, ) .does( - /* wgsl */ `( - @location(0) tilt: f32, - @location(1) angle: f32, - @location(2) color: vec4f, - @location(3) center: vec2f, - @builtin(vertex_index) index: u32, - ) -> VertexOutput { - let width = tilt; - let height = tilt / 2; + /* wgsl */ `(input: VertexInput) -> VertexOutput { + let width = input.tilt; + let height = input.tilt / 2; var pos = rotate(array( vec2f(0, 0), vec2f(width, 0), vec2f(0, height), vec2f(width, height), - )[index] / 350, angle) + center; + )[input.index] / 350, input.angle) + input.center; if (canvasAspectRatio < 1) { pos.x /= canvasAspectRatio; @@ -136,7 +130,7 @@ const mainVert = tgpu['~unstable'] pos.y *= canvasAspectRatio; } - return VertexOutput(vec4f(pos, 0.0, 1.0), color); + return VertexOutput(vec4f(pos, 0.0, 1.0), input.color); }`, ) .$uses({ diff --git a/apps/typegpu-docs/src/content/examples/simulation/fluid-double-buffering/index.ts b/apps/typegpu-docs/src/content/examples/simulation/fluid-double-buffering/index.ts index 16335375..ebce98f4 100644 --- a/apps/typegpu-docs/src/content/examples/simulation/fluid-double-buffering/index.ts +++ b/apps/typegpu-docs/src/content/examples/simulation/fluid-double-buffering/index.ts @@ -490,7 +490,7 @@ const vertexMain = tgpu['~unstable'] { idx: d.builtin.vertexIndex }, { pos: d.builtin.position, uv: d.vec2f }, ) - .does(/* wgsl */ `(@builtin(vertex_index) idx: u32) -> VertexOut { + .does(/* wgsl */ `(input: VertexInput) -> VertexOut { var pos = array( vec2(1, 1), // top-right vec2(-1, 1), // top-left @@ -506,8 +506,8 @@ const vertexMain = tgpu['~unstable'] ); var output: VertexOut; - output.pos = vec4f(pos[idx].x, pos[idx].y, 0.0, 1.0); - output.uv = uv[idx]; + output.pos = vec4f(pos[input.idx].x, pos[input.idx].y, 0.0, 1.0); + output.uv = uv[input.idx]; return output; }`);