Skip to content

Commit

Permalink
Some more cases for index_access.spec.ts (#466)
Browse files Browse the repository at this point in the history
* Invalidate out-of-bounds drawIndexed calls

* some more tests (indirect?)

* no-ops for out of bounds drawIndexed

* nits

Co-authored-by: Kai Ninomiya <[email protected]>
  • Loading branch information
shrekshao and kainino0x authored Feb 23, 2021
1 parent f1d958a commit 8fd2ac2
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/webgpu/api/validation/encoding/cmds/index_access.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,22 @@ class F extends ValidationTest {
export const g = makeTestGroup(F);

g.test('out_of_bounds')
.params(
params()
.combine(pbool('indirect')) // indirect drawIndexed
.combine([
{ indexCount: 6, firstIndex: 1 }, // indexCount + firstIndex out of bound
{ indexCount: 6, firstIndex: 6 }, // only firstIndex out of bound
{ indexCount: 6, firstIndex: 10000 }, // firstIndex much larger than the bound
{ indexCount: 7, firstIndex: 0 }, // only indexCount out of bound
{ indexCount: 10000, firstIndex: 0 }, // indexCount much larger than the bound
] as const)
.combine(poptions('instanceCount', [1, 10000])) // normal and large instanceCount
.cases(pbool('indirect'))
.subcases(
() =>
params()
.combine([
{ indexCount: 6, firstIndex: 1 }, // indexCount + firstIndex out of bound
{ indexCount: 0, firstIndex: 6 }, // indexCount is 0 but firstIndex out of bound
{ indexCount: 6, firstIndex: 6 }, // only firstIndex out of bound
{ indexCount: 6, firstIndex: 10000 }, // firstIndex much larger than the bound
{ indexCount: 7, firstIndex: 0 }, // only indexCount out of bound
{ indexCount: 10000, firstIndex: 0 }, // indexCount much larger than the bound
{ indexCount: 0xffffffff, firstIndex: 0xffffffff }, // max uint32 value
{ indexCount: 0xffffffff, firstIndex: 2 }, // max uint32 indexCount and small firstIndex
{ indexCount: 2, firstIndex: 0xffffffff }, // small indexCount and max uint32 firstIndex
] as const)
.combine(poptions('instanceCount', [1, 10000])) // normal and large instanceCount
)
.fn(t => {
const { indirect, indexCount, firstIndex, instanceCount } = t.params;
Expand Down

0 comments on commit 8fd2ac2

Please sign in to comment.