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
22 changes: 14 additions & 8 deletions src/webgpu/shader/execution/limits.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,22 @@ g.test('workgroup_array_byte_size_override')

g.test('const_array_elements')
.desc(`Test that constant array expressions with the maximum number of elements are supported.`)
.params(
u =>
// Some backend shader compilers take too long to compile the maximum
// size. In that case the browser GPU process can time out. The WGSL
// spec allows this as an 'uncategorized error'.
// To get some useful signal from this test, also check a const array
// with a significant size even though it may not be the maximum supported
// size listed in the spec.
u.combine('sizeDivisor', [64, 8, 1]) // Must include 1, to test largest size.
)
.fn(t => {
const type = `array<u32, ${kMaxConstArrayElements}>`;
const elementCount = Math.ceil(kMaxConstArrayElements / t.params.sizeDivisor);
const type = `array<u32, ${elementCount}>`;

let expr = `${type}(`;
for (let i = 0; i < kMaxConstArrayElements; i++) {
for (let i = 0; i < elementCount; i++) {
expr += `${i}, `;
}
expr += `)`;
Expand All @@ -430,10 +441,5 @@ g.test('const_array_elements')
}
`;

runShaderTest(
t,
code,
new Uint32Array([...iterRange(kMaxConstArrayElements, _i => 0xdeadbeef)]),
i => i
);
runShaderTest(t, code, new Uint32Array([...iterRange(elementCount, _i => 0xdeadbeef)]), i => i);
});