Only Increment Serials When Necessary On D3D12

Only increments last submitted and last completed serials from the D3D12
backend when commands were submitted to the GPU.

Bug: dawn:119
Change-Id: I01748b7f4ac90443adac4cdef29016184f992e9c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32162
Commit-Queue: Brandon Jones <brandon1.jones@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Brandon Jones
2020-11-13 02:11:12 +00:00
committed by Commit Bot service account
parent bc6a700bf5
commit b6f4d53126
3 changed files with 22 additions and 8 deletions

View File

@@ -238,6 +238,8 @@ namespace dawn_native {
// still check if we have pending work to take care of, rather than hanging and never
// reaching the serial the work will be executed on.
void AddFutureSerial(ExecutionSerial serial);
// Check for passed fences and set the new completed serial
void CheckPassedSerials();
virtual uint32_t GetOptimalBytesPerRowAlignment() const = 0;
virtual uint64_t GetOptimalBufferToTextureCopyOffsetAlignment() const = 0;
@@ -251,8 +253,6 @@ namespace dawn_native {
// Incrememt mLastSubmittedSerial when we submit the next serial
void IncrementLastSubmittedCommandSerial();
// Check for passed fences and set the new completed serial
void CheckPassedSerials();
private:
virtual ResultOrError<BindGroupBase*> CreateBindGroupImpl(

View File

@@ -228,8 +228,11 @@ namespace dawn_native { namespace d3d12 {
mRenderTargetViewAllocator->Tick(completedSerial);
mDepthStencilViewAllocator->Tick(completedSerial);
mUsedComObjectRefs.ClearUpTo(completedSerial);
DAWN_TRY(ExecutePendingCommandContext());
DAWN_TRY(NextSerial());
if (mPendingCommands.IsOpen()) {
DAWN_TRY(ExecutePendingCommandContext());
DAWN_TRY(NextSerial());
}
DAWN_TRY(CheckDebugLayerAndGenerateErrors());
@@ -256,7 +259,13 @@ namespace dawn_native { namespace d3d12 {
}
ExecutionSerial Device::CheckAndUpdateCompletedSerials() {
return ExecutionSerial(mFence->GetCompletedValue());
ExecutionSerial completeSerial = ExecutionSerial(mFence->GetCompletedValue());
if (completeSerial <= GetCompletedCommandSerial()) {
return ExecutionSerial(0);
}
return completeSerial;
}
void Device::ReferenceUntilUnused(ComPtr<IUnknown> object) {