diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 571cb76e..8e59e16e 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -549,8 +549,8 @@ static HRESULT d3d12_command_allocator_allocate_command_buffer(struct d3d12_comm if (allocator->current_command_list) { - FIXME("Allocation for multiple command list not supported.\n"); - return E_NOTIMPL; + WARN("Command allocator is already in use.\n"); + return E_INVALIDARG; } command_buffer_info.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; diff --git a/tests/d3d12.c b/tests/d3d12.c index 8113ff2c..756b0fde 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -1274,8 +1274,8 @@ static void test_create_fence(void) static void test_reset_command_allocator(void) { ID3D12CommandAllocator *command_allocator, *command_allocator2; + ID3D12GraphicsCommandList *command_list, *command_list2; D3D12_COMMAND_QUEUE_DESC command_queue_desc; - ID3D12GraphicsCommandList *command_list; ID3D12CommandQueue *queue; ID3D12Device *device; ULONG refcount; @@ -1354,10 +1354,25 @@ static void test_reset_command_allocator(void) hr = ID3D12GraphicsCommandList_Reset(command_list, command_allocator, NULL); ok(SUCCEEDED(hr), "Resetting command list failed, hr %#x.\n", hr); + /* A command allocator can be used with one command list at a time. */ + hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT, + command_allocator, NULL, &IID_ID3D12GraphicsCommandList, (void **)&command_list2); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT, + command_allocator2, NULL, &IID_ID3D12GraphicsCommandList, (void **)&command_list2); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = ID3D12GraphicsCommandList_Close(command_list2); + ok(SUCCEEDED(hr), "Close failed, hr %#x.\n", hr); + hr = ID3D12GraphicsCommandList_Reset(command_list2, command_allocator, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + ID3D12CommandAllocator_Release(command_allocator); ID3D12CommandAllocator_Release(command_allocator2); ID3D12CommandQueue_Release(queue); ID3D12GraphicsCommandList_Release(command_list); + ID3D12GraphicsCommandList_Release(command_list2); refcount = ID3D12Device_Release(device); ok(!refcount, "ID3D12Device has %u references left.\n", (unsigned int)refcount); }