mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 18:29:23 +00:00
Clear resolve buffer to 0 for resolving unavailable queries
- Add vkCmdFillBuffer in ResolveQuerySet to clear the buffer to 0s for these unavailable queries if the buffer has been initialized or fully used which won't been initialized with 0s again. - Because vkCmdFillBuffer has driver issue on Intel Windows, Skip some affected cases. - Remove unsafe api checking from Occlusion Query. Bug: dawn:434 Change-Id: Ib34f81d93b0de8f08f0eeebf3c8a967eeb5ecefb Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/48320 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
b29467ba7b
commit
aed656cd7a
@@ -370,14 +370,6 @@ namespace dawn_native {
|
||||
if (descriptor->occlusionQuerySet != nullptr) {
|
||||
DAWN_TRY(device->ValidateObject(descriptor->occlusionQuerySet));
|
||||
|
||||
// Occlusion query has not been implemented completely. Disallow it as unsafe until
|
||||
// the implementaion is completed.
|
||||
if (device->IsToggleEnabled(Toggle::DisallowUnsafeAPIs)) {
|
||||
return DAWN_VALIDATION_ERROR(
|
||||
"Occlusion query is disallowed because it has not been implemented "
|
||||
"completely.");
|
||||
}
|
||||
|
||||
if (descriptor->occlusionQuerySet->GetQueryType() != wgpu::QueryType::Occlusion) {
|
||||
return DAWN_VALIDATION_ERROR("The type of query set must be Occlusion");
|
||||
}
|
||||
|
||||
@@ -800,13 +800,29 @@ namespace dawn_native { namespace vulkan {
|
||||
QuerySet* querySet = ToBackend(cmd->querySet.Get());
|
||||
Buffer* destination = ToBackend(cmd->destination.Get());
|
||||
|
||||
// TODO(hao.x.li@intel.com): Clear the resolve region of the buffer to 0 if at
|
||||
// least one query is unavailable for the resolving and the resolve buffer has
|
||||
// been initialized or fully used.
|
||||
// vkCmdCopyQueryPoolResults only can retrieve available queries because
|
||||
// VK_QUERY_RESULT_WAIT_BIT is set, for these unavailable queries, we need to
|
||||
// clear the resolving region of the buffer to 0s if the buffer has been
|
||||
// initialized or fully used.
|
||||
auto startIt = querySet->GetQueryAvailability().begin() + cmd->firstQuery;
|
||||
auto endIt = querySet->GetQueryAvailability().begin() + cmd->firstQuery +
|
||||
cmd->queryCount;
|
||||
bool hasUnavailableQueries = std::find(startIt, endIt, false) != endIt;
|
||||
if (hasUnavailableQueries &&
|
||||
(destination->IsDataInitialized() ||
|
||||
destination->IsFullBufferRange(cmd->destinationOffset,
|
||||
cmd->queryCount * sizeof(uint64_t)))) {
|
||||
destination->TransitionUsageNow(recordingContext,
|
||||
wgpu::BufferUsage::CopyDst);
|
||||
device->fn.CmdFillBuffer(commands, destination->GetHandle(),
|
||||
cmd->destinationOffset,
|
||||
cmd->queryCount * sizeof(uint64_t), 0u);
|
||||
} else {
|
||||
destination->EnsureDataInitializedAsDestination(
|
||||
recordingContext, cmd->destinationOffset,
|
||||
cmd->queryCount * sizeof(uint64_t));
|
||||
}
|
||||
|
||||
destination->EnsureDataInitializedAsDestination(
|
||||
recordingContext, cmd->destinationOffset,
|
||||
cmd->queryCount * sizeof(uint64_t));
|
||||
destination->TransitionUsageNow(recordingContext,
|
||||
wgpu::BufferUsage::QueryResolve);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user