vkd3d: Keep active bindings after changing root signature.

Shadow of the Tomb Raider does not re-bind all descriptor tables after
setting a new root signature if tessellation is enabled, which causes
some descriptors to be left undefined.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Philip Rebohle 2019-10-30 19:34:11 +01:00 committed by Alexandre Julliard
parent a38ee68f93
commit 8cb42d6971
3 changed files with 15 additions and 6 deletions

View File

@ -2539,8 +2539,8 @@ static void d3d12_command_list_prepare_descriptors(struct d3d12_command_list *li
root_signature->vk_set_layout);
bindings->in_use = false;
bindings->descriptor_table_dirty_mask |= bindings->descriptor_table_active_mask;
bindings->push_descriptor_dirty_mask |= bindings->push_descriptor_active_mask;
bindings->descriptor_table_dirty_mask |= bindings->descriptor_table_active_mask & root_signature->descriptor_table_mask;
bindings->push_descriptor_dirty_mask |= bindings->push_descriptor_active_mask & root_signature->push_descriptor_mask;
}
static bool vk_write_descriptor_set_from_d3d12_desc(VkWriteDescriptorSet *vk_descriptor_write,
@ -4030,10 +4030,8 @@ static void d3d12_command_list_set_root_signature(struct d3d12_command_list *lis
bindings->root_signature = root_signature;
bindings->descriptor_set = VK_NULL_HANDLE;
bindings->descriptor_table_dirty_mask = 0;
bindings->descriptor_table_active_mask = 0;
bindings->push_descriptor_dirty_mask = 0;
bindings->push_descriptor_active_mask = 0;
bindings->descriptor_table_dirty_mask = bindings->descriptor_table_active_mask & root_signature->descriptor_table_mask;
bindings->push_descriptor_dirty_mask = bindings->push_descriptor_active_mask & root_signature->push_descriptor_mask;
}
static void STDMETHODCALLTYPE d3d12_command_list_SetComputeRootSignature(ID3D12GraphicsCommandList1 *iface,

View File

@ -600,12 +600,16 @@ static HRESULT d3d12_root_signature_init_root_descriptor_tables(struct d3d12_roo
unsigned int i, j, k, range_count;
uint32_t vk_binding;
root_signature->descriptor_table_mask = 0;
for (i = 0; i < desc->NumParameters; ++i)
{
const D3D12_ROOT_PARAMETER *p = &desc->pParameters[i];
if (p->ParameterType != D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE)
continue;
root_signature->descriptor_table_mask |= 1ull << i;
table = &root_signature->parameters[i].u.descriptor_table;
range_count = p->u.DescriptorTable.NumDescriptorRanges;
@ -666,6 +670,8 @@ static HRESULT d3d12_root_signature_init_root_descriptors(struct d3d12_root_sign
VkDescriptorSetLayoutBinding *cur_binding = context->current_binding;
unsigned int i;
root_signature->push_descriptor_mask = 0;
for (i = 0; i < desc->NumParameters; ++i)
{
const D3D12_ROOT_PARAMETER *p = &desc->pParameters[i];
@ -674,6 +680,8 @@ static HRESULT d3d12_root_signature_init_root_descriptors(struct d3d12_root_sign
&& p->ParameterType != D3D12_ROOT_PARAMETER_TYPE_UAV)
continue;
root_signature->push_descriptor_mask |= 1u << i;
if (p->u.Descriptor.RegisterSpace)
{
FIXME("Unhandled register space %u for parameter %u.\n", p->u.Descriptor.RegisterSpace, i);

View File

@ -678,6 +678,9 @@ struct d3d12_root_signature
unsigned int parameter_count;
uint32_t main_set;
uint64_t descriptor_table_mask;
uint32_t push_descriptor_mask;
D3D12_ROOT_SIGNATURE_FLAGS flags;
unsigned int descriptor_count;