Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions packages/typegpu/tests/struct.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,43 @@ describe('struct', () => {
}"
`);
});

it('copies?', () => {
const Boid = d.struct({
pos: d.vec3f,
vel: d.vec3f,
});

const Boid2 = d.struct({
pos: d.vec3f,
vel: d.vec3f,
});

function main() {
'use gpu';
const boid = Boid();
const boid2 = Boid2(boid);
return boid2;
}

expect(tgpu.resolve([main])).toMatchInlineSnapshot(`
"struct Boid {
pos: vec3f,
vel: vec3f,
}

struct Boid2 {
pos: vec3f,
vel: vec3f,
}

fn main() -> Boid2 {
var boid = Boid();
var boid2 = boid;
return boid2;
}"
`);
});
});

describe('WgslStruct', () => {
Expand Down
Loading