libs/vkd3d: Avoid updating descriptor sets bound to recording command buffer.

Fixes GPU memory page faults in gears demo on Nvidia.

The Vulkan spec says:

  "The descriptor set contents bound by a call to
  vkCmdBindDescriptorSets may be consumed during host execution of the
  command, or during shader execution of the resulting draws, or any
  time in between. Thus, the contents must not be altered (overwritten
  by an update command, or freed) between when the command is recorded
  and when the command completes executing on the queue."
This commit is contained in:
Józef Kucia 2017-06-23 22:24:33 +02:00
parent fe61e0ba22
commit c0b5cf3df6

View File

@ -1569,6 +1569,7 @@ static bool d3d12_command_list_update_current_pipeline(struct d3d12_command_list
static bool d3d12_command_list_begin_render_pass(struct d3d12_command_list *list,
const struct vkd3d_vk_device_procs *vk_procs)
{
struct d3d12_root_signature *rs = list->root_signature;
struct VkRenderPassBeginInfo begin_desc;
if (!list->state)
@ -1584,6 +1585,10 @@ static bool d3d12_command_list_begin_render_pass(struct d3d12_command_list *list
if (!d3d12_command_list_update_current_pipeline(list, vk_procs))
return false;
if (rs && rs->pool_size_count)
VK_CALL(vkCmdBindDescriptorSets(list->vk_command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
rs->vk_pipeline_layout, 0, 1, &list->current_descriptor_set, 0, NULL));
begin_desc.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
begin_desc.pNext = NULL;
begin_desc.renderPass = list->state->u.graphics.render_pass;
@ -2139,9 +2144,6 @@ static void STDMETHODCALLTYPE d3d12_command_list_SetGraphicsRootSignature(ID3D12
return;
}
VK_CALL(vkCmdBindDescriptorSets(list->vk_command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS,
rs->vk_pipeline_layout, 0, 1, &list->current_descriptor_set, 0, NULL));
list->root_signature = rs;
}