diff --git a/src/dawn_native/Buffer.cpp b/src/dawn_native/Buffer.cpp index 64ee20f654..5c2528ad96 100644 --- a/src/dawn_native/Buffer.cpp +++ b/src/dawn_native/Buffer.cpp @@ -289,9 +289,8 @@ namespace dawn_native { } std::unique_ptr request = std::make_unique(this, mLastMapID); - // TODO(dawn:723): do not get a new reference to the Queue. - GetDevice()->APIGetQueue()->TrackTask(std::move(request), - GetDevice()->GetPendingCommandSerial()); + GetDevice()->GetQueue()->TrackTask(std::move(request), + GetDevice()->GetPendingCommandSerial()); } void* BufferBase::APIGetMappedRange(size_t offset, size_t size) { diff --git a/src/dawn_native/CommandEncoder.cpp b/src/dawn_native/CommandEncoder.cpp index 699d49714f..0e757906be 100644 --- a/src/dawn_native/CommandEncoder.cpp +++ b/src/dawn_native/CommandEncoder.cpp @@ -419,10 +419,9 @@ namespace dawn_native { // TODO(dawn:723): change to not use AcquireRef for reentrant object creation. Ref availabilityBuffer = AcquireRef(device->APICreateBuffer(&availabilityDesc)); - // TODO(dawn:723): do not get a new reference to the Queue. // TODO(dawn:723): propagate any errors from WriteBuffer. - device->APIGetQueue()->APIWriteBuffer(availabilityBuffer.Get(), 0, availability.data(), - availability.size() * sizeof(uint32_t)); + device->GetQueue()->APIWriteBuffer(availabilityBuffer.Get(), 0, availability.data(), + availability.size() * sizeof(uint32_t)); // Timestamp params uniform buffer TimestampParams params = {queryCount, static_cast(destinationOffset), @@ -432,9 +431,8 @@ namespace dawn_native { parmsDesc.size = sizeof(params); // TODO(dawn:723): change to not use AcquireRef for reentrant object creation. Ref paramsBuffer = AcquireRef(device->APICreateBuffer(&parmsDesc)); - // TODO(dawn:723): do not get a new reference to the Queue. // TODO(dawn:723): propagate any errors from WriteBuffer. - device->APIGetQueue()->APIWriteBuffer(paramsBuffer.Get(), 0, ¶ms, sizeof(params)); + device->GetQueue()->APIWriteBuffer(paramsBuffer.Get(), 0, ¶ms, sizeof(params)); EncodeConvertTimestampsToNanoseconds(encoder, destination, availabilityBuffer.Get(), paramsBuffer.Get()); diff --git a/src/dawn_native/CopyTextureForBrowserHelper.cpp b/src/dawn_native/CopyTextureForBrowserHelper.cpp index fea63efbeb..c5b145e355 100644 --- a/src/dawn_native/CopyTextureForBrowserHelper.cpp +++ b/src/dawn_native/CopyTextureForBrowserHelper.cpp @@ -273,10 +273,9 @@ namespace dawn_native { // TODO(dawn:723): change to not use AcquireRef for reentrant object creation. Ref uniformBuffer = AcquireRef(device->APICreateBuffer(&uniformDesc)); - // TODO(dawn:723): change to not use AcquireRef for reentrant object creation. // TODO(dawn:723): propagate any errors from WriteBuffer. - device->APIGetQueue()->APIWriteBuffer(uniformBuffer.Get(), 0, uniformData, - sizeof(uniformData)); + device->GetQueue()->APIWriteBuffer(uniformBuffer.Get(), 0, uniformData, + sizeof(uniformData)); // Prepare binding 1 resource: sampler // Use default configuration, filterMode set to Nearest for min and mag. @@ -347,9 +346,7 @@ namespace dawn_native { CommandBufferBase* submitCommandBuffer = commandBuffer.Get(); // Submit command buffer. - // TODO(dawn:723): do not get a new reference to the Queue. - Ref queue = AcquireRef(device->APIGetQueue()); - queue->APISubmit(1, &submitCommandBuffer); + device->GetQueue()->APISubmit(1, &submitCommandBuffer); return {}; } diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index 3b8bf166d3..87ee093d98 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -176,8 +176,7 @@ namespace dawn_native { // Tick the queue-related tasks since they should be complete. This must be done before // ShutDownImpl() it may relinquish resources that will be freed by backends in the // ShutDownImpl() call. - // TODO(dawn:723): do not get a new reference to the Queue. - APIGetQueue()->Tick(GetCompletedCommandSerial()); + mQueue->Tick(GetCompletedCommandSerial()); // Call TickImpl once last time to clean up resources // Ignore errors so that we can continue with destruction IgnoreErrors(TickImpl()); @@ -896,8 +895,7 @@ namespace dawn_native { // tick the dynamic uploader before the backend resource allocators. This would allow // reclaiming resources one tick earlier. mDynamicUploader->Deallocate(mCompletedSerial); - // TODO(dawn:723): do not get a new reference to the Queue. - APIGetQueue()->Tick(mCompletedSerial); + mQueue->Tick(mCompletedSerial); mCreatePipelineAsyncTracker->Tick(mCompletedSerial); } @@ -963,6 +961,10 @@ namespace dawn_native { } } + QueueBase* DeviceBase::GetQueue() const { + return mQueue.Get(); + } + // Implementation details of object creation MaybeError DeviceBase::CreateBindGroupInternal(BindGroupBase** result, diff --git a/src/dawn_native/Device.h b/src/dawn_native/Device.h index 9064224ba3..225b689883 100644 --- a/src/dawn_native/Device.h +++ b/src/dawn_native/Device.h @@ -229,6 +229,7 @@ namespace dawn_native { size_t GetDeprecationWarningCountForTesting(); void EmitDeprecationWarning(const char* warning); void APILoseForTesting(); + QueueBase* GetQueue() const; // AddFutureSerial is used to update the mFutureSerial with the max serial needed to be // ticked in order to clean up all pending callback work or to execute asynchronous resource diff --git a/src/dawn_native/Fence.cpp b/src/dawn_native/Fence.cpp index 175f4cea28..c9f322470b 100644 --- a/src/dawn_native/Fence.cpp +++ b/src/dawn_native/Fence.cpp @@ -136,9 +136,8 @@ namespace dawn_native { std::make_unique(fence, value); // TODO: use GetLastSubmittedCommandSerial in the future for perforamnce - // TODO(dawn:723): do not get a new reference to the Queue. - GetDevice()->APIGetQueue()->TrackTask(std::move(fenceInFlight), - GetDevice()->GetPendingCommandSerial()); + GetDevice()->GetQueue()->TrackTask(std::move(fenceInFlight), + GetDevice()->GetPendingCommandSerial()); } MaybeError Fence::ValidateOnCompletion(FenceAPISerial value,