Skip to content

Commit

Permalink
Change primitive topology
Browse files Browse the repository at this point in the history
  • Loading branch information
mhawryluk committed Nov 28, 2024
1 parent 97e4921 commit d3722d1
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,11 @@ const mainVert = tgpu
let width = tilt;
let height = tilt / 2;
var pos = rotate(array<vec2f, 6>(
var pos = rotate(array<vec2f, 4>(
vec2f(0, 0),
vec2f(width, 0),
vec2f(width, height),
vec2f(width, height),
vec2f(0, height),
vec2f(0, 0),
vec2f(width, height),
)[index] / 350, angle) + center;
if (canvasAspectRatio < 1) {
Expand All @@ -157,7 +154,7 @@ const mainFrag = tgpu.fragmentFn(VertexOutput, vec4f).does(/* wgsl */ `
}`);

const mainCompute = tgpu
.computeFn([1])
.computeFn([builtin.globalInvocationId], { workgroupSize: [1] })
.does(
/* wgsl */ `(@builtin(global_invocation_id) gid: vec3u) {
let index = gid.x;
Expand Down Expand Up @@ -186,6 +183,9 @@ const renderPipeline = root
.withFragment(mainFrag, {
format: presentationFormat,
})
.withPrimitive({
topology: 'triangle-strip',
})
.createPipeline()
.with(geometryLayout, particleGeometryBuffer)
.with(dataLayout, particleDataBuffer);
Expand Down Expand Up @@ -241,7 +241,7 @@ onFrame((deltaTime) => {
loadOp: 'clear' as const,
storeOp: 'store' as const,
})
.draw(6, PARTICLE_AMOUNT);
.draw(4, PARTICLE_AMOUNT);

root.flush();
});
Expand Down

0 comments on commit d3722d1

Please sign in to comment.