libs/vkd3d: Track command list recording state.

This commit is contained in:
Józef Kucia 2016-09-28 09:42:49 +02:00
parent c311a61dc9
commit 00fec8232b
3 changed files with 18 additions and 3 deletions

View File

@ -60,6 +60,8 @@ static HRESULT vkd3d_command_allocator_allocate_command_list(struct d3d12_comman
if ((vr = VK_CALL(vkBeginCommandBuffer(list->vk_command_buffer, &begin_info)))) if ((vr = VK_CALL(vkBeginCommandBuffer(list->vk_command_buffer, &begin_info))))
ERR("Failed to begin command buffer, vr %d.\n", vr); ERR("Failed to begin command buffer, vr %d.\n", vr);
list->is_recording = TRUE;
allocator->current_command_list = list; allocator->current_command_list = list;
return S_OK; return S_OK;
@ -415,11 +417,23 @@ static HRESULT STDMETHODCALLTYPE d3d12_command_list_Close(ID3D12GraphicsCommandL
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
if (!list->is_recording)
{
WARN("Command list is not in the recording state.\n");
return E_FAIL;
}
vk_procs = &list->device->vk_procs; vk_procs = &list->device->vk_procs;
vr = VK_CALL(vkEndCommandBuffer(list->vk_command_buffer)); if ((vr = VK_CALL(vkEndCommandBuffer(list->vk_command_buffer))))
{
WARN("Failed to end command buffer, vr %d.\n", vr);
return hresult_from_vk_result(vr); return hresult_from_vk_result(vr);
} }
list->is_recording = FALSE;
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d12_command_list_Reset(ID3D12GraphicsCommandList *iface, static HRESULT STDMETHODCALLTYPE d3d12_command_list_Reset(ID3D12GraphicsCommandList *iface,
ID3D12CommandAllocator *allocator, ID3D12PipelineState *initial_state) ID3D12CommandAllocator *allocator, ID3D12PipelineState *initial_state)
{ {

View File

@ -136,6 +136,7 @@ struct d3d12_command_list
D3D12_COMMAND_LIST_TYPE type; D3D12_COMMAND_LIST_TYPE type;
VkCommandBuffer vk_command_buffer; VkCommandBuffer vk_command_buffer;
BOOL is_recording;
struct d3d12_command_allocator *allocator; struct d3d12_command_allocator *allocator;
struct d3d12_device *device; struct d3d12_device *device;

View File

@ -855,7 +855,7 @@ static void test_reset_command_allocator(void)
todo(hr == E_FAIL, "Got unexpected hr %#x.\n", hr); todo(hr == E_FAIL, "Got unexpected hr %#x.\n", hr);
hr = ID3D12GraphicsCommandList_Close(command_list); hr = ID3D12GraphicsCommandList_Close(command_list);
ok(SUCCEEDED(hr), "Close failed, hr %#x.\n", hr); todo(SUCCEEDED(hr), "Close failed, hr %#x.\n", hr);
hr = ID3D12GraphicsCommandList_Reset(command_list, command_allocator, NULL); hr = ID3D12GraphicsCommandList_Reset(command_list, command_allocator, NULL);
todo(SUCCEEDED(hr), "Resetting command list failed, hr %#x.\n", hr); todo(SUCCEEDED(hr), "Resetting command list failed, hr %#x.\n", hr);