vkd3d: Check that the allocator type matches the list type in d3d12_command_list_Reset().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov
2025-09-17 08:28:22 +02:00
committed by Henri Verbeet
parent b6d274e68e
commit faec701cce
Notes: Henri Verbeet 2025-09-17 12:57:42 +02:00
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1736
2 changed files with 19 additions and 0 deletions

View File

@@ -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");

View File

@@ -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);