Replace constant buffer with D3D12Buffer wrapper

This commit is contained in:
2026-03-15 18:59:28 +08:00
parent f25672c7d6
commit c62dc58157
3 changed files with 22 additions and 41 deletions

View File

@@ -15,7 +15,7 @@ public:
D3D12Buffer();
~D3D12Buffer();
bool Initialize(ID3D12Device* device, uint64_t size, D3D12_RESOURCE_STATES initialState = D3D12_RESOURCE_STATE_COMMON);
bool Initialize(ID3D12Device* device, uint64_t size, D3D12_RESOURCE_STATES initialState = D3D12_RESOURCE_STATE_COMMON, D3D12_HEAP_TYPE heapType = D3D12_HEAP_TYPE_DEFAULT);
bool InitializeFromExisting(ID3D12Resource* resource);
void Shutdown();

View File

@@ -10,9 +10,9 @@ D3D12Buffer::~D3D12Buffer() {
Shutdown();
}
bool D3D12Buffer::Initialize(ID3D12Device* device, uint64_t size, D3D12_RESOURCE_STATES initialState) {
bool D3D12Buffer::Initialize(ID3D12Device* device, uint64_t size, D3D12_RESOURCE_STATES initialState, D3D12_HEAP_TYPE heapType) {
D3D12_HEAP_PROPERTIES heapProperties = {};
heapProperties.Type = D3D12_HEAP_TYPE_DEFAULT;
heapProperties.Type = heapType;
heapProperties.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
heapProperties.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
heapProperties.CreationNodeMask = 0;