Skip to content

Commit 06954d9

Browse files
authored
Implement val:render_pass_descriptor:timestampWrite,query_index (gpuweb#1654)
The count of the querySet should be greater than the queryIndex of timestampWrite. So, this PR adds a test to check if a validation error is generated when the query index is greater than the count of the query set. Issue: gpuweb#1618
1 parent deec4fe commit 06954d9

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/webgpu/api/validation/render_pass/render_pass_descriptor.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -889,6 +889,34 @@ g.test('timestamp_writes_location')
889889
t.tryRenderPass(isValid, descriptor);
890890
});
891891

892+
g.test('timestampWrite,query_index')
893+
.desc(`Test that querySet.count should be greater than timestampWrite.queryIndex.`)
894+
.params(u => u.combine('queryIndex', [0, 1, 2, 3]))
895+
.beforeAllSubcases(t => {
896+
t.selectDeviceOrSkipTestCase(['timestamp-query']);
897+
})
898+
.fn(async t => {
899+
const { queryIndex } = t.params;
900+
901+
const querySetCount = 2;
902+
903+
const timestampWrite = {
904+
querySet: t.device.createQuerySet({ type: 'timestamp', count: querySetCount }),
905+
queryIndex,
906+
location: 'beginning' as const,
907+
};
908+
909+
const isValid = queryIndex < querySetCount;
910+
911+
const colorTexture = t.createTexture();
912+
const descriptor = {
913+
colorAttachments: [t.getColorAttachment(colorTexture)],
914+
timestampWrites: [timestampWrite],
915+
};
916+
917+
t.tryRenderPass(isValid, descriptor);
918+
});
919+
892920
g.test('occlusionQuerySet,query_set_type')
893921
.desc(`Test that occlusionQuerySet must have type 'occlusion'.`)
894922
.params(u => u.combine('queryType', kQueryTypes))

0 commit comments

Comments
 (0)