Replace vertex/index buffer creation with D3D12Buffer wrapper

This commit is contained in:
2026-03-15 19:58:22 +08:00
parent 38e23e45c4
commit 13818fe641
2 changed files with 8 additions and 75 deletions

View File

@@ -92,7 +92,7 @@ bool D3D12Buffer::InitializeWithData(ID3D12Device* device, ID3D12GraphicsCommand
device->GetCopyableFootprints(&bufferDesc, 0, 1, 0,
&subresourceFootprint, &rowUsed, &rowSizeInBytes, &memorySizeUsed);
ComPtr<ID3D12Resource> tempBufferObject;
ID3D12Resource* tempBufferObject = nullptr;
D3D12_HEAP_PROPERTIES d3dTempHeapProperties = {};
d3dTempHeapProperties.Type = D3D12_HEAP_TYPE_UPLOAD;
@@ -129,7 +129,7 @@ bool D3D12Buffer::InitializeWithData(ID3D12Device* device, ID3D12GraphicsCommand
memcpy(pDstTempBuffer, pSrcData, size);
tempBufferObject->Unmap(0, nullptr);
commandList->CopyBufferRegion(m_resource.Get(), 0, tempBufferObject.Get(), 0, subresourceFootprint.Footprint.Width);
commandList->CopyBufferRegion(m_resource.Get(), 0, tempBufferObject, 0, subresourceFootprint.Footprint.Width);
D3D12_RESOURCE_BARRIER barrier = {};
barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;