Rename d3d12 Device tick functions to Tick
This commit is contained in:
parent
6103c62489
commit
beb76d06db
|
@ -30,7 +30,7 @@ namespace d3d12 {
|
||||||
if (freeAllocators.none()) {
|
if (freeAllocators.none()) {
|
||||||
const uint64_t firstSerial = inFlightCommandAllocators.FirstSerial();
|
const uint64_t firstSerial = inFlightCommandAllocators.FirstSerial();
|
||||||
device->WaitForSerial(firstSerial);
|
device->WaitForSerial(firstSerial);
|
||||||
ResetCompletedAllocators(firstSerial);
|
Tick(firstSerial);
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT(freeAllocators.any());
|
ASSERT(freeAllocators.any());
|
||||||
|
@ -53,7 +53,7 @@ namespace d3d12 {
|
||||||
return commandAllocators[firstFreeIndex];
|
return commandAllocators[firstFreeIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandAllocatorManager::ResetCompletedAllocators(uint64_t lastCompletedSerial) {
|
void CommandAllocatorManager::Tick(uint64_t lastCompletedSerial) {
|
||||||
// Reset all command allocators that are no longer in flight
|
// Reset all command allocators that are no longer in flight
|
||||||
for (auto it : inFlightCommandAllocators.IterateUpTo(lastCompletedSerial)) {
|
for (auto it : inFlightCommandAllocators.IterateUpTo(lastCompletedSerial)) {
|
||||||
ASSERT_SUCCESS(it.commandAllocator->Reset());
|
ASSERT_SUCCESS(it.commandAllocator->Reset());
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace d3d12 {
|
||||||
// A CommandAllocator that is reserved must be used on the next ExecuteCommandLists
|
// A CommandAllocator that is reserved must be used on the next ExecuteCommandLists
|
||||||
// otherwise its commands may be reset before execution has completed on the GPU
|
// otherwise its commands may be reset before execution has completed on the GPU
|
||||||
ComPtr<ID3D12CommandAllocator> ReserveCommandAllocator();
|
ComPtr<ID3D12CommandAllocator> ReserveCommandAllocator();
|
||||||
void ResetCompletedAllocators(uint64_t lastCompletedSerial);
|
void Tick(uint64_t lastCompletedSerial);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Device* device;
|
Device* device;
|
||||||
|
|
|
@ -159,9 +159,9 @@ namespace d3d12 {
|
||||||
void Device::TickImpl() {
|
void Device::TickImpl() {
|
||||||
// Perform cleanup operations to free unused objects
|
// Perform cleanup operations to free unused objects
|
||||||
const uint64_t lastCompletedSerial = fence->GetCompletedValue();
|
const uint64_t lastCompletedSerial = fence->GetCompletedValue();
|
||||||
resourceAllocator->FreeUnusedResources(lastCompletedSerial);
|
resourceAllocator->Tick(lastCompletedSerial);
|
||||||
commandAllocatorManager->ResetCompletedAllocators(lastCompletedSerial);
|
commandAllocatorManager->Tick(lastCompletedSerial);
|
||||||
descriptorHeapAllocator->FreeDescriptorHeaps(lastCompletedSerial);
|
descriptorHeapAllocator->Tick(lastCompletedSerial);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Device::GetSerial() const {
|
uint64_t Device::GetSerial() const {
|
||||||
|
|
|
@ -101,7 +101,7 @@ namespace d3d12 {
|
||||||
return Allocate(type, count, heapSize, &gpuDescriptorHeapInfos[type], D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE);
|
return Allocate(type, count, heapSize, &gpuDescriptorHeapInfos[type], D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DescriptorHeapAllocator::FreeDescriptorHeaps(uint64_t lastCompletedSerial) {
|
void DescriptorHeapAllocator::Tick(uint64_t lastCompletedSerial) {
|
||||||
releasedHandles.ClearUpTo(lastCompletedSerial);
|
releasedHandles.ClearUpTo(lastCompletedSerial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace d3d12 {
|
||||||
|
|
||||||
DescriptorHeapHandle AllocateGPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE type, uint32_t count);
|
DescriptorHeapHandle AllocateGPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE type, uint32_t count);
|
||||||
DescriptorHeapHandle AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE type, uint32_t count);
|
DescriptorHeapHandle AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE type, uint32_t count);
|
||||||
void FreeDescriptorHeaps(uint64_t lastCompletedSerial);
|
void Tick(uint64_t lastCompletedSerial);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr unsigned int kMaxCbvUavSrvHeapSize = 1000000;
|
static constexpr unsigned int kMaxCbvUavSrvHeapSize = 1000000;
|
||||||
|
@ -62,7 +62,7 @@ namespace d3d12 {
|
||||||
};
|
};
|
||||||
|
|
||||||
using DescriptorHeapInfo = std::pair<ComPtr<ID3D12DescriptorHeap>, AllocationInfo>;
|
using DescriptorHeapInfo = std::pair<ComPtr<ID3D12DescriptorHeap>, AllocationInfo>;
|
||||||
|
|
||||||
DescriptorHeapHandle Allocate(D3D12_DESCRIPTOR_HEAP_TYPE type, uint32_t count, uint32_t allocationSize, DescriptorHeapInfo* heapInfo, D3D12_DESCRIPTOR_HEAP_FLAGS flags);
|
DescriptorHeapHandle Allocate(D3D12_DESCRIPTOR_HEAP_TYPE type, uint32_t count, uint32_t allocationSize, DescriptorHeapInfo* heapInfo, D3D12_DESCRIPTOR_HEAP_FLAGS flags);
|
||||||
void Release(DescriptorHeapHandle handle);
|
void Release(DescriptorHeapHandle handle);
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ namespace d3d12 {
|
||||||
releasedResources.Enqueue(resource, device->GetSerial());
|
releasedResources.Enqueue(resource, device->GetSerial());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceAllocator::FreeUnusedResources(uint64_t lastCompletedSerial) {
|
void ResourceAllocator::Tick(uint64_t lastCompletedSerial) {
|
||||||
releasedResources.ClearUpTo(lastCompletedSerial);
|
releasedResources.ClearUpTo(lastCompletedSerial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace d3d12 {
|
||||||
|
|
||||||
ComPtr<ID3D12Resource> Allocate(D3D12_HEAP_TYPE heapType, const D3D12_RESOURCE_DESC &resourceDescriptor, D3D12_RESOURCE_STATES initialUsage);
|
ComPtr<ID3D12Resource> Allocate(D3D12_HEAP_TYPE heapType, const D3D12_RESOURCE_DESC &resourceDescriptor, D3D12_RESOURCE_STATES initialUsage);
|
||||||
void Release(ComPtr<ID3D12Resource> resource);
|
void Release(ComPtr<ID3D12Resource> resource);
|
||||||
void FreeUnusedResources(uint64_t lastCompletedSerial);
|
void Tick(uint64_t lastCompletedSerial);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Device* device;
|
Device* device;
|
||||||
|
|
Loading…
Reference in New Issue