Query API: Record used query index in command encoder

- There are some methods need to know which query indexes are used in
encoders: endOcclusionQuery, endPipelineStatisticsQuery, resolveQuerySet.
- On Vulkan, we also need to use the used query indexes to reset each
queries between uses. And because the reset command must be called
outside render pass, we need to check whether a query index is writen
twice on command encoder and render/compute encoders.
- Add validation on writeTimestamp for duplicate writes at same index.

Bug: dawn:434
Change-Id: I6d00dd91e565d960246b6d01ad434d2d5c095deb
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/27561
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Hao Li <hao.x.li@intel.com>
This commit is contained in:
Hao Li
2020-10-21 08:38:31 +00:00
committed by Commit Bot service account
parent 3f6bb08d00
commit e2cbcc9565
7 changed files with 101 additions and 5 deletions

View File

@@ -106,10 +106,13 @@ namespace dawn_native {
mEncodingContext->TryEncode(this, [&](CommandAllocator* allocator) -> MaybeError {
if (GetDevice()->IsValidationEnabled()) {
DAWN_TRY(GetDevice()->ValidateObject(querySet));
DAWN_TRY(ValidateTimestampQuery(querySet, queryIndex));
DAWN_TRY(ValidateTimestampQuery(querySet, queryIndex,
mCommandEncoder->GetUsedQueryIndices()));
mCommandEncoder->TrackUsedQuerySet(querySet);
}
mCommandEncoder->TrackUsedQueryIndex(querySet, queryIndex);
WriteTimestampCmd* cmd =
allocator->Allocate<WriteTimestampCmd>(Command::WriteTimestamp);
cmd->querySet = querySet;