Skip to content
Merged
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
44 changes: 42 additions & 2 deletions src/webgpu/shader/execution/zero_init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ g.test('compute,zero_init')
}
})
.beginSubcases()
.combine('loop', ['none', 'loop', 'for', 'while'] as const)
.filter(t => {
return t.loop === 'none' || t.addressSpace === 'function';
Comment thread
alan-baker marked this conversation as resolved.
Resolved
})
// Fewer subcases: Only 0 and 2. If double-nested containers work, single-nested should too.
.combine('_containerDepth', [0, 2])
.expandWithParams(function* (p) {
Expand Down Expand Up @@ -397,12 +401,48 @@ g.test('compute,zero_init')
}
})('testVar', t.params._type);

let body = `${functionScope}\n${checkZeroCode}`;
if (t.params.loop !== 'none') {
switch (t.params.loop) {
case 'loop':
body = `
var idx = 0;
loop {
if idx > 0 {
${body}
}
continuing {
idx++;
break if idx > 1;
}
}`;
break;
case 'for':
body = `
for (var idx = 0; idx < 4; idx++) {
if idx == 2 {
${body}
}
}`;
break;
case 'while':
body = `
var idx = 0;
while idx < 3 {
if idx == 1 {
${body}
}
idx++;
}`;
break;
}
}

const wgsl = `
${moduleScope}
@compute @workgroup_size(${t.params.workgroupSize})
fn main() {
${functionScope}
${checkZeroCode}
${body}
_ = zero;
}
`;
Expand Down
Loading