Optimize textures/buffers uploading on Vulkan with page allocator

This commit is contained in:
Wojtek Figat
2025-09-04 21:38:07 +02:00
parent cd22cd059d
commit 831fb0f442
10 changed files with 427 additions and 441 deletions

View File

@@ -1119,7 +1119,7 @@ void GPUContextDX12::UpdateCB(GPUConstantBuffer* cb, const void* data)
return;
// Allocate bytes for the buffer
DynamicAllocation allocation = _device->UploadBuffer->Allocate(size, D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT);
auto allocation = _device->UploadBuffer.Allocate(size, D3D12_CONSTANT_BUFFER_DATA_PLACEMENT_ALIGNMENT);
// Copy data
Platform::MemoryCopy(allocation.CPUAddress, data, allocation.Size);
@@ -1343,7 +1343,7 @@ void GPUContextDX12::UpdateBuffer(GPUBuffer* buffer, const void* data, uint32 si
SetResourceState(bufferDX12, D3D12_RESOURCE_STATE_COPY_DEST);
flushRBs();
_device->UploadBuffer->UploadBuffer(this, bufferDX12->GetResource(), offset, data, size);
_device->UploadBuffer.UploadBuffer(GetCommandList(), bufferDX12->GetResource(), offset, data, size);
}
void GPUContextDX12::CopyBuffer(GPUBuffer* dstBuffer, GPUBuffer* srcBuffer, uint32 size, uint32 dstOffset, uint32 srcOffset)
@@ -1369,7 +1369,7 @@ void GPUContextDX12::UpdateTexture(GPUTexture* texture, int32 arrayIndex, int32
SetResourceState(textureDX12, D3D12_RESOURCE_STATE_COPY_DEST);
flushRBs();
_device->UploadBuffer->UploadTexture(this, textureDX12->GetResource(), data, rowPitch, slicePitch, mipIndex, arrayIndex);
_device->UploadBuffer.UploadTexture(GetCommandList(), textureDX12->GetResource(), data, rowPitch, slicePitch, mipIndex, arrayIndex);
}
void GPUContextDX12::CopyTexture(GPUTexture* dstResource, uint32 dstSubresource, uint32 dstX, uint32 dstY, uint32 dstZ, GPUTexture* srcResource, uint32 srcSubresource)
@@ -1424,7 +1424,7 @@ void GPUContextDX12::ResetCounter(GPUBuffer* buffer)
flushRBs();
uint32 value = 0;
_device->UploadBuffer->UploadBuffer(this, counter->GetResource(), 0, &value, 4);
_device->UploadBuffer.UploadBuffer(GetCommandList(), counter->GetResource(), 0, &value, 4);
SetResourceState(counter, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
}