diff options
| author | Ewann <207907827+dev-ewann@users.noreply.github.com> | 2026-11-22 17:36:50 +0100 |
|---|---|---|
| committer | Ewann <207907827+dev-ewann@users.noreply.github.com> | 2026-11-22 21:21:25 +0100 |
| commit | 6de779367ba8ea568fff509e004050b476510ea0 (patch) | |
| tree | 83cd1a62cbc7d2dc77d7f52b03b6cf99216d1b1f /runtime/shims/d3d12_com.cpp | |
| parent | f847748cc76bd3777f9c070c4034eb2fc1c04e64 (diff) | |
Runtime: command allocators and lists answer invalid arguments as the host does
Measured against the host D3D12 runtime (RTX 5070, driver 621.14) with
d3d12_vulkan_device_test's compare_invalid_arguments:
- CreateCommandAllocator and CreateCommandList1 took any type (7, 99,
-1); the host refuses types past VIDEO_ENCODE with E_INVALIDARG.
- CreateCommandList and CreateCommandList1 took a node mask with bits
past node 0; the host answers E_INVALIDARG.
- A null output was E_POINTER in all three; the host answers
E_UNEXPECTED, after the argument checks.
compare_invalid_arguments gets 35 "command allocator:", "command list:"
and "command list1:" cases. Video list types are not compared: the host
hands out a video list (E_NOINTERFACE for ID3D12GraphicsCommandList),
while this layer creates a graphics list for them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'runtime/shims/d3d12_com.cpp')
| -rw-r--r-- | runtime/shims/d3d12_com.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/shims/d3d12_com.cpp b/runtime/shims/d3d12_com.cpp index 38b21d55f..87dd26d21 100644 --- a/runtime/shims/d3d12_com.cpp +++ b/runtime/shims/d3d12_com.cpp | |||
| @@ -1499,8 +1499,11 @@ HRESULT create_command_queue(leonida::VulkanContext& context, VkQueue queue, std | |||
| 1499 | } | 1499 | } |
| 1500 | 1500 | ||
| 1501 | HRESULT create_command_allocator(D3D12_COMMAND_LIST_TYPE type, REFIID riid, void** out, IUnknown* device) { | 1501 | HRESULT create_command_allocator(D3D12_COMMAND_LIST_TYPE type, REFIID riid, void** out, IUnknown* device) { |
| 1502 | if (!out) return E_POINTER; | 1502 | // The host runtime's order (d3d12_vulkan_device_test, compare_invalid_arguments "command allocator:"): a type |
| 1503 | *out = nullptr; | 1503 | // past VIDEO_ENCODE is E_INVALIDARG, then a null output is E_UNEXPECTED. |
| 1504 | if (out) *out = nullptr; | ||
| 1505 | if (UINT(type) > UINT(D3D12_COMMAND_LIST_TYPE_VIDEO_ENCODE)) return E_INVALIDARG; | ||
| 1506 | if (!out) return E_UNEXPECTED; | ||
| 1504 | auto* object = new CommandAllocator(type); | 1507 | auto* object = new CommandAllocator(type); |
| 1505 | object->attach_device(device); | 1508 | object->attach_device(device); |
| 1506 | return hand_out(object, riid, out); | 1509 | return hand_out(object, riid, out); |
| @@ -1508,12 +1511,13 @@ HRESULT create_command_allocator(D3D12_COMMAND_LIST_TYPE type, REFIID riid, void | |||
| 1508 | 1511 | ||
| 1509 | HRESULT create_command_list(D3D12_COMMAND_LIST_TYPE type, ID3D12CommandAllocator* allocator, REFIID riid, | 1512 | HRESULT create_command_list(D3D12_COMMAND_LIST_TYPE type, ID3D12CommandAllocator* allocator, REFIID riid, |
| 1510 | void** out, IUnknown* device, ID3D12PipelineState* initial_state) { | 1513 | void** out, IUnknown* device, ID3D12PipelineState* initial_state) { |
| 1511 | if (!out) return E_POINTER; | 1514 | if (out) *out = nullptr; |
| 1512 | *out = nullptr; | ||
| 1513 | CommandAllocator* command_allocator = CommandAllocator::from(allocator); | 1515 | CommandAllocator* command_allocator = CommandAllocator::from(allocator); |
| 1514 | if (!command_allocator || command_allocator->type() != type) return E_INVALIDARG; | 1516 | if (!command_allocator || command_allocator->type() != type) return E_INVALIDARG; |
| 1515 | // A list is created open, so the allocator must be free: E_INVALIDARG as on the PC runtime (D3D-51). | 1517 | // A list is created open, so the allocator must be free: E_INVALIDARG as on the PC runtime (D3D-51). |
| 1516 | if (command_allocator->recording()) return E_INVALIDARG; | 1518 | if (command_allocator->recording()) return E_INVALIDARG; |
| 1519 | // A null output only after the arguments, as the host runtime answers ("command list:" cases). | ||
| 1520 | if (!out) return E_UNEXPECTED; | ||
| 1517 | if (type != D3D12_COMMAND_LIST_TYPE_DIRECT && type != D3D12_COMMAND_LIST_TYPE_BUNDLE && | 1521 | if (type != D3D12_COMMAND_LIST_TYPE_DIRECT && type != D3D12_COMMAND_LIST_TYPE_BUNDLE && |
| 1518 | type != D3D12_COMMAND_LIST_TYPE_COMPUTE && type != D3D12_COMMAND_LIST_TYPE_COPY) | 1522 | type != D3D12_COMMAND_LIST_TYPE_COMPUTE && type != D3D12_COMMAND_LIST_TYPE_COPY) |
| 1519 | stub("create_command_list(non-direct type)"); | 1523 | stub("create_command_list(non-direct type)"); |