From 8fd2ac2a68c16569dd11705457aaa9b46970819d Mon Sep 17 00:00:00 2001 From: ShrekShao Date: Mon, 22 Feb 2021 21:24:46 -0800 Subject: [PATCH] Some more cases for index_access.spec.ts (#466) * Invalidate out-of-bounds drawIndexed calls * some more tests (indirect?) * no-ops for out of bounds drawIndexed * nits Co-authored-by: Kai Ninomiya --- .../encoding/cmds/index_access.spec.ts | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/webgpu/api/validation/encoding/cmds/index_access.spec.ts b/src/webgpu/api/validation/encoding/cmds/index_access.spec.ts index 6c6ff908e01b..cb1aaecb60b7 100644 --- a/src/webgpu/api/validation/encoding/cmds/index_access.spec.ts +++ b/src/webgpu/api/validation/encoding/cmds/index_access.spec.ts @@ -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;