mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-04 13:41:42 +00:00
This CL adds the needed headers to pass the include what you use lint check. Bug: dawn:1339 Change-Id: Ib8df68e51b2c3711169b400e84768d4804568580 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86941 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Dan Sinclair <dsinclair@chromium.org> Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
79 lines
2.3 KiB
C++
79 lines
2.3 KiB
C++
// Copyright 2020 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/d3d12/PageableD3D12.h"
|
|
|
|
#include <utility>
|
|
|
|
namespace dawn::native::d3d12 {
|
|
Pageable::Pageable(ComPtr<ID3D12Pageable> d3d12Pageable,
|
|
MemorySegment memorySegment,
|
|
uint64_t size)
|
|
: mD3d12Pageable(std::move(d3d12Pageable)), mMemorySegment(memorySegment), mSize(size) {
|
|
}
|
|
|
|
// When a pageable is destroyed, it no longer resides in resident memory, so we must evict
|
|
// it from the LRU cache. If this heap is not manually removed from the LRU-cache, the
|
|
// ResidencyManager will attempt to use it after it has been deallocated.
|
|
Pageable::~Pageable() {
|
|
if (IsInResidencyLRUCache()) {
|
|
RemoveFromList();
|
|
}
|
|
}
|
|
|
|
ID3D12Pageable* Pageable::GetD3D12Pageable() const {
|
|
return mD3d12Pageable.Get();
|
|
}
|
|
|
|
ExecutionSerial Pageable::GetLastUsage() const {
|
|
return mLastUsage;
|
|
}
|
|
|
|
void Pageable::SetLastUsage(ExecutionSerial serial) {
|
|
mLastUsage = serial;
|
|
}
|
|
|
|
ExecutionSerial Pageable::GetLastSubmission() const {
|
|
return mLastSubmission;
|
|
}
|
|
|
|
void Pageable::SetLastSubmission(ExecutionSerial serial) {
|
|
mLastSubmission = serial;
|
|
}
|
|
|
|
MemorySegment Pageable::GetMemorySegment() const {
|
|
return mMemorySegment;
|
|
}
|
|
|
|
uint64_t Pageable::GetSize() const {
|
|
return mSize;
|
|
}
|
|
|
|
bool Pageable::IsInResidencyLRUCache() const {
|
|
return IsInList();
|
|
}
|
|
|
|
void Pageable::IncrementResidencyLock() {
|
|
mResidencyLockRefCount++;
|
|
}
|
|
|
|
void Pageable::DecrementResidencyLock() {
|
|
mResidencyLockRefCount--;
|
|
}
|
|
|
|
bool Pageable::IsResidencyLocked() const {
|
|
return mResidencyLockRefCount != 0;
|
|
}
|
|
} // namespace dawn::native::d3d12
|