mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-05 22:23:29 +00:00
forward declare allocator classes
This commit is contained in:
parent
f96ce23628
commit
a4dcde9cf3
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include "D3D12Backend.h"
|
#include "D3D12Backend.h"
|
||||||
#include "ResourceAllocator.h"
|
#include "ResourceAllocator.h"
|
||||||
|
#include "ResourceUploader.h"
|
||||||
|
|
||||||
namespace backend {
|
namespace backend {
|
||||||
namespace d3d12 {
|
namespace d3d12 {
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
#include "QueueD3D12.h"
|
#include "QueueD3D12.h"
|
||||||
#include "ShaderModuleD3D12.h"
|
#include "ShaderModuleD3D12.h"
|
||||||
|
|
||||||
|
#include "CommandAllocatorManager.h"
|
||||||
|
#include "ResourceAllocator.h"
|
||||||
|
#include "ResourceUploader.h"
|
||||||
|
|
||||||
namespace backend {
|
namespace backend {
|
||||||
namespace d3d12 {
|
namespace d3d12 {
|
||||||
|
|
||||||
@ -75,10 +79,10 @@ namespace d3d12 {
|
|||||||
|
|
||||||
Device::Device(ComPtr<ID3D12Device> d3d12Device)
|
Device::Device(ComPtr<ID3D12Device> d3d12Device)
|
||||||
: d3d12Device(d3d12Device),
|
: d3d12Device(d3d12Device),
|
||||||
commandAllocatorManager(this),
|
commandAllocatorManager(new CommandAllocatorManager(this)),
|
||||||
resourceAllocator(this),
|
resourceAllocator(new ResourceAllocator(this)),
|
||||||
resourceUploader(this),
|
resourceUploader(new ResourceUploader(this)),
|
||||||
pendingCommands{ commandAllocatorManager.ReserveCommandAllocator() } {
|
pendingCommands{ commandAllocatorManager->ReserveCommandAllocator() } {
|
||||||
|
|
||||||
D3D12_COMMAND_QUEUE_DESC queueDesc = {};
|
D3D12_COMMAND_QUEUE_DESC queueDesc = {};
|
||||||
queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
|
||||||
@ -111,21 +115,21 @@ namespace d3d12 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CommandAllocatorManager* Device::GetCommandAllocatorManager() {
|
CommandAllocatorManager* Device::GetCommandAllocatorManager() {
|
||||||
return &commandAllocatorManager;
|
return commandAllocatorManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceAllocator* Device::GetResourceAllocator() {
|
ResourceAllocator* Device::GetResourceAllocator() {
|
||||||
return &resourceAllocator;
|
return resourceAllocator;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceUploader* Device::GetResourceUploader() {
|
ResourceUploader* Device::GetResourceUploader() {
|
||||||
return &resourceUploader;
|
return resourceUploader;
|
||||||
}
|
}
|
||||||
|
|
||||||
ComPtr<ID3D12GraphicsCommandList> Device::GetPendingCommandList() {
|
ComPtr<ID3D12GraphicsCommandList> Device::GetPendingCommandList() {
|
||||||
// Callers of GetPendingCommandList do so to record commands. Only reserve a command allocator when it is needed so we don't submit empty command lists
|
// Callers of GetPendingCommandList do so to record commands. Only reserve a command allocator when it is needed so we don't submit empty command lists
|
||||||
if (!pendingCommands.open) {
|
if (!pendingCommands.open) {
|
||||||
pendingCommands.commandAllocator = commandAllocatorManager.ReserveCommandAllocator();
|
pendingCommands.commandAllocator = commandAllocatorManager->ReserveCommandAllocator();
|
||||||
ASSERT_SUCCESS(pendingCommands.commandList->Reset(pendingCommands.commandAllocator.Get(), nullptr));
|
ASSERT_SUCCESS(pendingCommands.commandList->Reset(pendingCommands.commandAllocator.Get(), nullptr));
|
||||||
pendingCommands.open = true;
|
pendingCommands.open = true;
|
||||||
}
|
}
|
||||||
@ -143,8 +147,8 @@ 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->FreeUnusedResources(lastCompletedSerial);
|
||||||
commandAllocatorManager.ResetCompletedAllocators(lastCompletedSerial);
|
commandAllocatorManager->ResetCompletedAllocators(lastCompletedSerial);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t Device::GetSerial() const {
|
uint64_t Device::GetSerial() const {
|
||||||
|
@ -32,9 +32,6 @@
|
|||||||
#include "common/ToBackend.h"
|
#include "common/ToBackend.h"
|
||||||
|
|
||||||
#include "d3d12_platform.h"
|
#include "d3d12_platform.h"
|
||||||
#include "CommandAllocatorManager.h"
|
|
||||||
#include "ResourceAllocator.h"
|
|
||||||
#include "ResourceUploader.h"
|
|
||||||
|
|
||||||
namespace backend {
|
namespace backend {
|
||||||
namespace d3d12 {
|
namespace d3d12 {
|
||||||
@ -57,6 +54,10 @@ namespace d3d12 {
|
|||||||
class Framebuffer;
|
class Framebuffer;
|
||||||
class RenderPass;
|
class RenderPass;
|
||||||
|
|
||||||
|
class CommandAllocatorManager;
|
||||||
|
class ResourceAllocator;
|
||||||
|
class ResourceUploader;
|
||||||
|
|
||||||
struct D3D12BackendTraits {
|
struct D3D12BackendTraits {
|
||||||
using BindGroupType = BindGroup;
|
using BindGroupType = BindGroup;
|
||||||
using BindGroupLayoutType = BindGroupLayout;
|
using BindGroupLayoutType = BindGroupLayout;
|
||||||
@ -139,9 +140,9 @@ namespace d3d12 {
|
|||||||
ComPtr<ID3D12Device> d3d12Device;
|
ComPtr<ID3D12Device> d3d12Device;
|
||||||
ComPtr<ID3D12CommandQueue> commandQueue;
|
ComPtr<ID3D12CommandQueue> commandQueue;
|
||||||
|
|
||||||
CommandAllocatorManager commandAllocatorManager;
|
CommandAllocatorManager* commandAllocatorManager;
|
||||||
ResourceAllocator resourceAllocator;
|
ResourceAllocator* resourceAllocator;
|
||||||
ResourceUploader resourceUploader;
|
ResourceUploader* resourceUploader;
|
||||||
|
|
||||||
struct PendingCommandList {
|
struct PendingCommandList {
|
||||||
ComPtr<ID3D12CommandAllocator> commandAllocator;
|
ComPtr<ID3D12CommandAllocator> commandAllocator;
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "QueueD3D12.h"
|
#include "QueueD3D12.h"
|
||||||
|
|
||||||
#include "D3D12Backend.h"
|
#include "D3D12Backend.h"
|
||||||
|
#include "CommandAllocatorManager.h"
|
||||||
#include "CommandBufferD3D12.h"
|
#include "CommandBufferD3D12.h"
|
||||||
|
|
||||||
namespace backend {
|
namespace backend {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "ResourceUploader.h"
|
#include "ResourceUploader.h"
|
||||||
|
|
||||||
#include "D3D12Backend.h"
|
#include "D3D12Backend.h"
|
||||||
|
#include "ResourceAllocator.h"
|
||||||
|
|
||||||
namespace backend {
|
namespace backend {
|
||||||
namespace d3d12 {
|
namespace d3d12 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user