mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Resolve D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND during table parsing.
Simplifies the code path for handling array bindings and unbounded ranges. Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d44c8e9feb
commit
6d5e71f5b8
@ -2674,7 +2674,6 @@ static void d3d12_command_list_update_descriptor_table(struct d3d12_command_list
|
||||
|
||||
descriptor_table = root_signature_get_descriptor_table(root_signature, index);
|
||||
|
||||
descriptor = base_descriptor;
|
||||
descriptor_count = 0;
|
||||
current_descriptor_write = descriptor_writes;
|
||||
current_image_info = image_infos;
|
||||
@ -2682,10 +2681,7 @@ static void d3d12_command_list_update_descriptor_table(struct d3d12_command_list
|
||||
{
|
||||
range = &descriptor_table->ranges[i];
|
||||
|
||||
if (range->offset != D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND)
|
||||
{
|
||||
descriptor = base_descriptor + range->offset;
|
||||
}
|
||||
descriptor = base_descriptor + range->offset;
|
||||
|
||||
for (j = 0; j < range->descriptor_count; ++j, ++descriptor)
|
||||
{
|
||||
|
@ -591,6 +591,8 @@ static HRESULT d3d12_root_signature_init_root_descriptor_tables(struct d3d12_roo
|
||||
for (i = 0; i < desc->NumParameters; ++i)
|
||||
{
|
||||
const D3D12_ROOT_PARAMETER *p = &desc->pParameters[i];
|
||||
unsigned int offset = 0;
|
||||
|
||||
if (p->ParameterType != D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE)
|
||||
continue;
|
||||
|
||||
@ -604,6 +606,25 @@ static HRESULT d3d12_root_signature_init_root_descriptor_tables(struct d3d12_roo
|
||||
if (!(table->ranges = vkd3d_calloc(table->range_count, sizeof(*table->ranges))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
for (j = 0; j < range_count; ++j)
|
||||
{
|
||||
range = &p->u.DescriptorTable.pDescriptorRanges[j];
|
||||
|
||||
if (range->OffsetInDescriptorsFromTableStart != D3D12_DESCRIPTOR_RANGE_OFFSET_APPEND)
|
||||
offset = range->OffsetInDescriptorsFromTableStart;
|
||||
|
||||
table->ranges[j].offset = offset;
|
||||
table->ranges[j].descriptor_count = range->NumDescriptors;
|
||||
table->ranges[j].descriptor_magic = vkd3d_descriptor_magic_from_d3d12(range->RangeType);
|
||||
table->ranges[j].register_space = range->RegisterSpace;
|
||||
table->ranges[j].base_register_idx = range->BaseShaderRegister;
|
||||
|
||||
TRACE("Descriptor table %u, range %u, offset %u, type %#x, count %u.\n", i, j,
|
||||
offset, range->RangeType, range->NumDescriptors);
|
||||
|
||||
offset += range->NumDescriptors;
|
||||
}
|
||||
|
||||
for (j = 0; j < range_count; ++j)
|
||||
{
|
||||
range = &p->u.DescriptorTable.pDescriptorRanges[j];
|
||||
@ -638,12 +659,7 @@ static HRESULT d3d12_root_signature_init_root_descriptor_tables(struct d3d12_roo
|
||||
++cur_binding;
|
||||
}
|
||||
|
||||
table->ranges[j].offset = range->OffsetInDescriptorsFromTableStart;
|
||||
table->ranges[j].descriptor_count = range->NumDescriptors;
|
||||
table->ranges[j].binding = vk_binding;
|
||||
table->ranges[j].descriptor_magic = vkd3d_descriptor_magic_from_d3d12(range->RangeType);
|
||||
table->ranges[j].register_space = range->RegisterSpace;
|
||||
table->ranges[j].base_register_idx = range->BaseShaderRegister;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user