dx12 copy allocator fix

This commit is contained in:
Turánszki János
2023-08-01 11:00:53 +02:00
parent c928303be1
commit 912ba1446b
3 changed files with 13 additions and 12 deletions
+10 -11
View File
@@ -1638,10 +1638,8 @@ using namespace dx12_internal;
{
if (freelist[i].uploadbuffer.desc.size >= staging_size)
{
if (freelist[i].fence->GetCompletedValue() == 1)
if (freelist[i].IsCompleted())
{
HRESULT hr = freelist[i].fence->Signal(0);
assert(SUCCEEDED(hr));
cmd = std::move(freelist[i]);
std::swap(freelist[i], freelist.back());
freelist.pop_back();
@@ -1685,26 +1683,27 @@ using namespace dx12_internal;
{
HRESULT hr;
locker.lock();
cmd.fenceValueSignaled++;
freelist.push_back(cmd);
locker.unlock();
cmd.commandList->Close();
ID3D12CommandList* commandlists[] = {
cmd.commandList.Get()
};
device->queues[QUEUE_COPY].queue->ExecuteCommandLists(1, commandlists);
hr = device->queues[QUEUE_COPY].queue->Signal(cmd.fence.Get(), 1);
hr = device->queues[QUEUE_COPY].queue->Signal(cmd.fence.Get(), cmd.fenceValueSignaled);
assert(SUCCEEDED(hr));
hr = device->queues[QUEUE_GRAPHICS].queue->Wait(cmd.fence.Get(), 1);
hr = device->queues[QUEUE_GRAPHICS].queue->Wait(cmd.fence.Get(), cmd.fenceValueSignaled);
assert(SUCCEEDED(hr));
hr = device->queues[QUEUE_COMPUTE].queue->Wait(cmd.fence.Get(), 1);
hr = device->queues[QUEUE_COMPUTE].queue->Wait(cmd.fence.Get(), cmd.fenceValueSignaled);
assert(SUCCEEDED(hr));
if (device->queues[QUEUE_VIDEO_DECODE].queue)
{
hr = device->queues[QUEUE_VIDEO_DECODE].queue->Wait(cmd.fence.Get(), 1);
hr = device->queues[QUEUE_VIDEO_DECODE].queue->Wait(cmd.fence.Get(), cmd.fenceValueSignaled);
assert(SUCCEEDED(hr));
}
locker.lock();
freelist.push_back(cmd);
locker.unlock();
}
void GraphicsDevice_DX12::DescriptorBinder::init(GraphicsDevice_DX12* device)
+2
View File
@@ -84,8 +84,10 @@ namespace wi::graphics
Microsoft::WRL::ComPtr<ID3D12CommandAllocator> commandAllocator;
Microsoft::WRL::ComPtr<ID3D12GraphicsCommandList> commandList;
Microsoft::WRL::ComPtr<ID3D12Fence> fence;
uint64_t fenceValueSignaled = 0;
GPUBuffer uploadbuffer;
inline bool IsValid() const { return commandList != nullptr; }
inline bool IsCompleted() const { return fence->GetCompletedValue() >= fenceValueSignaled; }
};
wi::vector<CopyCMD> freelist;
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wi::version
// minor features, major updates, breaking compatibility changes
const int minor = 71;
// minor bug fixes, alterations, refactors, updates
const int revision = 269;
const int revision = 270;
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);