diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index d933e7ec4..4d3372439 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -2701,6 +2701,13 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_list_Reset(ID3D12GraphicsCommandL return E_INVALIDARG; } + if (allocator_impl->type != list->type) + { + WARN("Command list types do not match (allocator %#x, list %#x).\n", + allocator_impl->type, list->type); + return E_INVALIDARG; + } + if (list->is_recording) { WARN("Command list is in the recording state.\n"); diff --git a/tests/d3d12.c b/tests/d3d12.c index 551ac86f1..12f4ff72c 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -4517,6 +4517,18 @@ static void test_reset_command_allocator(void) hr = ID3D12Device_CreateCommandList(device, 0, D3D12_COMMAND_LIST_TYPE_DIRECT, command_allocator, NULL, &IID_ID3D12GraphicsCommandList, (void **)&command_list2); ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr); + hr = ID3D12GraphicsCommandList_Close(command_list2); + ok(SUCCEEDED(hr), "Failed to close command list, hr %#x.\n", hr); + + ID3D12CommandAllocator_Release(command_allocator2); + + /* Reset with mismatching allocator type. */ + hr = ID3D12Device_CreateCommandAllocator(device, D3D12_COMMAND_LIST_TYPE_BUNDLE, + &IID_ID3D12CommandAllocator, (void **)&command_allocator2); + ok(SUCCEEDED(hr), "Failed to create command allocator, hr %#x.\n", hr); + + hr = ID3D12GraphicsCommandList_Reset(command_list2, command_allocator2, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); ID3D12CommandAllocator_Release(command_allocator); ID3D12CommandAllocator_Release(command_allocator2);