Skip Unneccessary GetPendingCommandContext() Call To Save An Extra Fence
GetPendingCommandContext() call might create a new commandList. Dawn handles it in Tick() by executing this commandList and signal a fence even it is empty. Skip the unnecessary GetPendingCommandContext() call saves an extra fence and might resolve the callback for MapAsync earlier. Bug: dawn:1335 Change-Id: I07f82388edb6978473eeaa2ed0834edbb5e1f497 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86621 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
This commit is contained in:
parent
c7e9589e19
commit
3ed8b4e31d
|
@ -354,9 +354,14 @@ namespace dawn::native::d3d12 {
|
|||
}
|
||||
|
||||
MaybeError Buffer::MapAsyncImpl(wgpu::MapMode mode, size_t offset, size_t size) {
|
||||
CommandRecordingContext* commandContext;
|
||||
DAWN_TRY_ASSIGN(commandContext, ToBackend(GetDevice())->GetPendingCommandContext());
|
||||
DAWN_TRY(EnsureDataInitialized(commandContext));
|
||||
// GetPendingCommandContext() call might create a new commandList. Dawn will handle
|
||||
// it in Tick() by execute the commandList and signal a fence for it even it is empty.
|
||||
// Skip the unnecessary GetPendingCommandContext() call saves an extra fence.
|
||||
if (NeedsInitialization()) {
|
||||
CommandRecordingContext* commandContext;
|
||||
DAWN_TRY_ASSIGN(commandContext, ToBackend(GetDevice())->GetPendingCommandContext());
|
||||
DAWN_TRY(EnsureDataInitialized(commandContext));
|
||||
}
|
||||
|
||||
return MapInternal(mode & wgpu::MapMode::Write, offset, size, "D3D12 map async");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue