mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-08-29 23:16:06 +00:00
This will prevent mixing it up with other serial types in the future. Bug: dawn:442 Change-Id: I74e964708acc62eb0f33127cc48f1b9a7b171d11 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/28923 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Reviewed-by: Austin Eng <enga@chromium.org>
45 lines
1.7 KiB
C++
45 lines
1.7 KiB
C++
// Copyright 2018 The Dawn Authors
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
#include "dawn_native/FenceSignalTracker.h"
|
|
|
|
#include "dawn_native/Device.h"
|
|
#include "dawn_native/Fence.h"
|
|
|
|
namespace dawn_native {
|
|
|
|
FenceSignalTracker::FenceSignalTracker(DeviceBase* device) : mDevice(device) {
|
|
}
|
|
|
|
FenceSignalTracker::~FenceSignalTracker() {
|
|
ASSERT(mFencesInFlight.Empty());
|
|
}
|
|
|
|
void FenceSignalTracker::UpdateFenceOnComplete(Fence* fence, FenceAPISerial value) {
|
|
// Because we currently only have a single queue, we can simply update
|
|
// the fence completed value once the last submitted serial has passed.
|
|
mFencesInFlight.Enqueue(FenceInFlight{fence, value},
|
|
mDevice->GetLastSubmittedCommandSerial());
|
|
mDevice->AddFutureCallbackSerial(mDevice->GetPendingCommandSerial());
|
|
}
|
|
|
|
void FenceSignalTracker::Tick(ExecutionSerial finishedSerial) {
|
|
for (auto& fenceInFlight : mFencesInFlight.IterateUpTo(finishedSerial)) {
|
|
fenceInFlight.fence->SetCompletedValue(fenceInFlight.value);
|
|
}
|
|
mFencesInFlight.ClearUpTo(finishedSerial);
|
|
}
|
|
|
|
} // namespace dawn_native
|