Some tidying up and reorganising to support changes needed for D3D12 descriptor arrays where the descriptor count is UINT_MAX.
Conor McCarthy (5): vkd3d: Rename descriptor_count where binding_count is more appropriate. vkd3d: Move duplicate descriptor accounting to the descriptor count function. vkd3d: Move descriptor range iteration to the count function. vkd3d: Remove an unused function parameter. vkd3d: Store root signature Vulkan descriptor set layouts in an array.
libs/vkd3d/command.c | 4 +- libs/vkd3d/state.c | 165 +++++++++++++++++-------------------- libs/vkd3d/vkd3d_private.h | 7 +- 3 files changed, 81 insertions(+), 95 deletions(-)
signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d/state.c | 24 ++++++++++++------------ libs/vkd3d/vkd3d_private.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 81f3343..81da3f9 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -323,7 +323,7 @@ struct d3d12_root_signature_info size_t srv_count; size_t sampler_count;
- size_t descriptor_count; + size_t binding_count;
size_t root_constant_count; size_t root_descriptor_count; @@ -359,7 +359,7 @@ static HRESULT d3d12_root_signature_info_count_descriptors(struct d3d12_root_sig return E_NOTIMPL; }
- info->descriptor_count += range->NumDescriptors; + info->binding_count += range->NumDescriptors;
return S_OK; } @@ -389,19 +389,19 @@ static HRESULT d3d12_root_signature_info_from_desc(struct d3d12_root_signature_i case D3D12_ROOT_PARAMETER_TYPE_CBV: ++info->root_descriptor_count; ++info->cbv_count; - ++info->descriptor_count; + ++info->binding_count; info->cost += 2; break; case D3D12_ROOT_PARAMETER_TYPE_SRV: ++info->root_descriptor_count; ++info->buffer_srv_count; - ++info->descriptor_count; + ++info->binding_count; info->cost += 2; break; case D3D12_ROOT_PARAMETER_TYPE_UAV: ++info->root_descriptor_count; ++info->buffer_uav_count; - ++info->descriptor_count; + ++info->binding_count; info->cost += 2; break;
@@ -417,7 +417,7 @@ static HRESULT d3d12_root_signature_info_from_desc(struct d3d12_root_signature_i }
info->sampler_count += desc->NumStaticSamplers; - info->descriptor_count += desc->NumStaticSamplers; + info->binding_count += desc->NumStaticSamplers;
return S_OK; } @@ -813,9 +813,9 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa * to preserve compatibility between Vulkan resource bindings for the same * root signature, we create descriptor set layouts with two bindings for * each SRV and UAV. */ - info.descriptor_count += info.srv_count + info.uav_count; + info.binding_count += info.srv_count + info.uav_count;
- root_signature->descriptor_count = info.descriptor_count; + root_signature->binding_count = info.binding_count; root_signature->static_sampler_count = desc->NumStaticSamplers; root_signature->root_descriptor_count = info.root_descriptor_count;
@@ -824,7 +824,7 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa if (!(root_signature->parameters = vkd3d_calloc(root_signature->parameter_count, sizeof(*root_signature->parameters)))) goto fail; - if (!(root_signature->descriptor_mapping = vkd3d_calloc(root_signature->descriptor_count, + if (!(root_signature->descriptor_mapping = vkd3d_calloc(root_signature->binding_count, sizeof(*root_signature->descriptor_mapping)))) goto fail; root_signature->root_constant_count = info.root_constant_count; @@ -835,7 +835,7 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa sizeof(*root_signature->static_samplers)))) goto fail;
- if (!(binding_desc = vkd3d_calloc(info.descriptor_count, sizeof(*binding_desc)))) + if (!(binding_desc = vkd3d_calloc(info.binding_count, sizeof(*binding_desc)))) goto fail; context.current_binding = binding_desc;
@@ -1564,7 +1564,7 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st shader_interface.type = VKD3D_SHADER_STRUCTURE_TYPE_INTERFACE_INFO; shader_interface.next = NULL; shader_interface.bindings = root_signature->descriptor_mapping; - shader_interface.binding_count = root_signature->descriptor_count; + shader_interface.binding_count = root_signature->binding_count; shader_interface.push_constant_buffers = root_signature->root_constants; shader_interface.push_constant_buffer_count = root_signature->root_constant_count; shader_interface.combined_samplers = NULL; @@ -2273,7 +2273,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s shader_interface.type = VKD3D_SHADER_STRUCTURE_TYPE_INTERFACE_INFO; shader_interface.next = NULL; shader_interface.bindings = root_signature->descriptor_mapping; - shader_interface.binding_count = root_signature->descriptor_count; + shader_interface.binding_count = root_signature->binding_count; shader_interface.push_constant_buffers = root_signature->root_constants; shader_interface.push_constant_buffer_count = root_signature->root_constant_count; shader_interface.combined_samplers = NULL; diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 4af970c..b096a8c 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -711,7 +711,7 @@ struct d3d12_root_signature
D3D12_ROOT_SIGNATURE_FLAGS flags;
- unsigned int descriptor_count; + unsigned int binding_count; struct vkd3d_shader_resource_binding *descriptor_mapping;
unsigned int root_constant_count;
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Count variables no longer (or never) used are deleted.
signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d/state.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 81da3f9..4464a5f 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -316,13 +316,6 @@ static bool vk_binding_from_d3d12_descriptor_range(struct VkDescriptorSetLayoutB
struct d3d12_root_signature_info { - size_t cbv_count; - size_t buffer_uav_count; - size_t uav_count; - size_t buffer_srv_count; - size_t srv_count; - size_t sampler_count; - size_t binding_count;
size_t root_constant_count; @@ -343,16 +336,19 @@ static HRESULT d3d12_root_signature_info_count_descriptors(struct d3d12_root_sig switch (range->RangeType) { case D3D12_DESCRIPTOR_RANGE_TYPE_SRV: - info->srv_count += range->NumDescriptors; + /* XXX: Vulkan buffer and image descriptors have different types. In order + * to preserve compatibility between Vulkan resource bindings for the same + * root signature, we create descriptor set layouts with two bindings for + * each SRV and UAV. */ + info->binding_count += range->NumDescriptors; break; case D3D12_DESCRIPTOR_RANGE_TYPE_UAV: - info->uav_count += range->NumDescriptors; + /* As above. */ + info->binding_count += range->NumDescriptors; break; case D3D12_DESCRIPTOR_RANGE_TYPE_CBV: - info->cbv_count += range->NumDescriptors; break; case D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER: - info->sampler_count += range->NumDescriptors; break; default: FIXME("Unhandled descriptor type %#x.\n", range->RangeType); @@ -388,19 +384,16 @@ static HRESULT d3d12_root_signature_info_from_desc(struct d3d12_root_signature_i
case D3D12_ROOT_PARAMETER_TYPE_CBV: ++info->root_descriptor_count; - ++info->cbv_count; ++info->binding_count; info->cost += 2; break; case D3D12_ROOT_PARAMETER_TYPE_SRV: ++info->root_descriptor_count; - ++info->buffer_srv_count; ++info->binding_count; info->cost += 2; break; case D3D12_ROOT_PARAMETER_TYPE_UAV: ++info->root_descriptor_count; - ++info->buffer_uav_count; ++info->binding_count; info->cost += 2; break; @@ -416,7 +409,6 @@ static HRESULT d3d12_root_signature_info_from_desc(struct d3d12_root_signature_i } }
- info->sampler_count += desc->NumStaticSamplers; info->binding_count += desc->NumStaticSamplers;
return S_OK; @@ -809,12 +801,6 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa return E_INVALIDARG; }
- /* XXX: Vulkan buffer and image descriptors have different types. In order - * to preserve compatibility between Vulkan resource bindings for the same - * root signature, we create descriptor set layouts with two bindings for - * each SRV and UAV. */ - info.binding_count += info.srv_count + info.uav_count; - root_signature->binding_count = info.binding_count; root_signature->static_sampler_count = desc->NumStaticSamplers; root_signature->root_descriptor_count = info.root_descriptor_count;
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Simplifies future validation of consecutive range upper bounds (a bounded range must not follow an unbounded one) and handling of the last range.
signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d/state.c | 68 +++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 31 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 4464a5f..5275371 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -325,37 +325,44 @@ struct d3d12_root_signature_info };
static HRESULT d3d12_root_signature_info_count_descriptors(struct d3d12_root_signature_info *info, - const D3D12_DESCRIPTOR_RANGE *range) + const D3D12_ROOT_DESCRIPTOR_TABLE *table) { - if (range->NumDescriptors == 0xffffffff) - { - FIXME("Unhandled unbound descriptor range.\n"); - return E_NOTIMPL; - } + unsigned int i;
- switch (range->RangeType) + for (i = 0; i < table->NumDescriptorRanges; ++i) { - case D3D12_DESCRIPTOR_RANGE_TYPE_SRV: - /* XXX: Vulkan buffer and image descriptors have different types. In order - * to preserve compatibility between Vulkan resource bindings for the same - * root signature, we create descriptor set layouts with two bindings for - * each SRV and UAV. */ - info->binding_count += range->NumDescriptors; - break; - case D3D12_DESCRIPTOR_RANGE_TYPE_UAV: - /* As above. */ - info->binding_count += range->NumDescriptors; - break; - case D3D12_DESCRIPTOR_RANGE_TYPE_CBV: - break; - case D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER: - break; - default: - FIXME("Unhandled descriptor type %#x.\n", range->RangeType); + const D3D12_DESCRIPTOR_RANGE *range = &table->pDescriptorRanges[i]; + + if (range->NumDescriptors == 0xffffffff) + { + FIXME("Unhandled unbound descriptor range.\n"); return E_NOTIMPL; - } + } + + switch (range->RangeType) + { + case D3D12_DESCRIPTOR_RANGE_TYPE_SRV: + /* XXX: Vulkan buffer and image descriptors have different types. In order + * to preserve compatibility between Vulkan resource bindings for the same + * root signature, we create descriptor set layouts with two bindings for + * each SRV and UAV. */ + info->binding_count += range->NumDescriptors; + break; + case D3D12_DESCRIPTOR_RANGE_TYPE_UAV: + /* As above. */ + info->binding_count += range->NumDescriptors; + break; + case D3D12_DESCRIPTOR_RANGE_TYPE_CBV: + break; + case D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER: + break; + default: + FIXME("Unhandled descriptor type %#x.\n", range->RangeType); + return E_NOTIMPL; + }
- info->binding_count += range->NumDescriptors; + info->binding_count += range->NumDescriptors; + }
return S_OK; } @@ -363,7 +370,7 @@ static HRESULT d3d12_root_signature_info_count_descriptors(struct d3d12_root_sig static HRESULT d3d12_root_signature_info_from_desc(struct d3d12_root_signature_info *info, const D3D12_ROOT_SIGNATURE_DESC *desc) { - unsigned int i, j; + unsigned int i; HRESULT hr;
memset(info, 0, sizeof(*info)); @@ -375,10 +382,9 @@ static HRESULT d3d12_root_signature_info_from_desc(struct d3d12_root_signature_i switch (p->ParameterType) { case D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE: - for (j = 0; j < p->u.DescriptorTable.NumDescriptorRanges; ++j) - if (FAILED(hr = d3d12_root_signature_info_count_descriptors(info, - &p->u.DescriptorTable.pDescriptorRanges[j]))) - return hr; + if (FAILED(hr = d3d12_root_signature_info_count_descriptors(info, + &p->u.DescriptorTable))) + return hr; ++info->cost; break;
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d/state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 5275371..c4fcde9 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -421,7 +421,7 @@ static HRESULT d3d12_root_signature_info_from_desc(struct d3d12_root_signature_i }
static HRESULT d3d12_root_signature_init_push_constants(struct d3d12_root_signature *root_signature, - const D3D12_ROOT_SIGNATURE_DESC *desc, const struct d3d12_root_signature_info *info, + const D3D12_ROOT_SIGNATURE_DESC *desc, struct VkPushConstantRange push_constants[D3D12_SHADER_VISIBILITY_PIXEL + 1], uint32_t *push_constant_range_count) { @@ -847,7 +847,7 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa context.descriptor_binding = 0; }
- if (FAILED(hr = d3d12_root_signature_init_push_constants(root_signature, desc, &info, + if (FAILED(hr = d3d12_root_signature_init_push_constants(root_signature, desc, root_signature->push_constant_ranges, &root_signature->push_constant_range_count))) goto fail; if (FAILED(hr = d3d12_root_signature_init_root_descriptor_tables(root_signature, desc, &context)))
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
They need to be in an array for pipeline layout creation anyway, and this is useful when more layouts are needed for unbounded arrays.
signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d/command.c | 4 +-- libs/vkd3d/state.c | 59 +++++++++++++++++--------------------- libs/vkd3d/vkd3d_private.h | 5 ++-- 3 files changed, 31 insertions(+), 37 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 8b84451..116a8a6 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -2582,7 +2582,7 @@ static void d3d12_command_list_prepare_descriptors(struct d3d12_command_list *li * and when the command completes executing on the queue." */ bindings->descriptor_set = d3d12_command_allocator_allocate_descriptor_set(list->allocator, - root_signature->vk_set_layout); + root_signature->vk_set_layouts[root_signature->main_set]); bindings->in_use = false;
bindings->descriptor_table_dirty_mask |= bindings->descriptor_table_active_mask & root_signature->descriptor_table_mask; @@ -2895,7 +2895,7 @@ static void d3d12_command_list_update_descriptors(struct d3d12_command_list *lis struct d3d12_desc *base_descriptor; unsigned int i;
- if (!rs || !rs->vk_set_layout) + if (!rs || !rs->vk_set_count) return;
if (bindings->descriptor_table_dirty_mask || bindings->push_descriptor_dirty_mask) diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index c4fcde9..e459c99 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -65,10 +65,8 @@ static void d3d12_root_signature_cleanup(struct d3d12_root_signature *root_signa
if (root_signature->vk_pipeline_layout) VK_CALL(vkDestroyPipelineLayout(device->vk_device, root_signature->vk_pipeline_layout, NULL)); - if (root_signature->vk_set_layout) - VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, root_signature->vk_set_layout, NULL)); - if (root_signature->vk_push_set_layout) - VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, root_signature->vk_push_set_layout, NULL)); + for (i = 0; i < root_signature->vk_set_count; ++i) + VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, root_signature->vk_set_layouts[i], NULL));
if (root_signature->parameters) { @@ -514,7 +512,6 @@ struct vkd3d_descriptor_set_context { VkDescriptorSetLayoutBinding *current_binding; unsigned int descriptor_index; - uint32_t set_index; uint32_t descriptor_binding; };
@@ -531,7 +528,7 @@ static void d3d12_root_signature_append_vk_binding(struct d3d12_root_signature * mapping->register_index = register_idx; mapping->shader_visibility = shader_visibility; mapping->flags = buffer_descriptor ? VKD3D_SHADER_BINDING_FLAG_BUFFER : VKD3D_SHADER_BINDING_FLAG_IMAGE; - mapping->binding.set = context->set_index; + mapping->binding.set = root_signature->vk_set_count; mapping->binding.binding = context->descriptor_binding++; mapping->binding.count = 1; } @@ -777,7 +774,6 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa struct vkd3d_descriptor_set_context context; VkDescriptorSetLayoutBinding *binding_desc; struct d3d12_root_signature_info info; - VkDescriptorSetLayout set_layouts[2]; HRESULT hr;
memset(&context, 0, sizeof(context)); @@ -787,8 +783,7 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa root_signature->refcount = 1;
root_signature->vk_pipeline_layout = VK_NULL_HANDLE; - root_signature->vk_push_set_layout = VK_NULL_HANDLE; - root_signature->vk_set_layout = VK_NULL_HANDLE; + root_signature->vk_set_count = 0; root_signature->parameters = NULL; root_signature->flags = desc->Flags; root_signature->descriptor_mapping = NULL; @@ -839,10 +834,10 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa { if (FAILED(hr = vkd3d_create_descriptor_set_layout(device, VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR, - context.descriptor_binding, binding_desc, &root_signature->vk_push_set_layout))) + context.descriptor_binding, binding_desc, &root_signature->vk_set_layouts[0]))) goto fail; + ++root_signature->vk_set_count;
- set_layouts[context.set_index++] = root_signature->vk_push_set_layout; context.current_binding = binding_desc; context.descriptor_binding = 0; } @@ -855,21 +850,21 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa if (FAILED(hr = d3d12_root_signature_init_static_samplers(root_signature, device, desc, &context))) goto fail;
- root_signature->main_set = context.set_index; + root_signature->main_set = root_signature->vk_set_count; if (context.descriptor_binding) { if (FAILED(hr = vkd3d_create_descriptor_set_layout(device, - 0, context.descriptor_binding, binding_desc, &root_signature->vk_set_layout))) + 0, context.descriptor_binding, binding_desc, + &root_signature->vk_set_layouts[root_signature->vk_set_count]))) goto fail; - - set_layouts[context.set_index++] = root_signature->vk_set_layout; + ++root_signature->vk_set_count; } vkd3d_free(binding_desc); binding_desc = NULL;
- if (FAILED(hr = vkd3d_create_pipeline_layout(device, context.set_index, set_layouts, - root_signature->push_constant_range_count, root_signature->push_constant_ranges, - &root_signature->vk_pipeline_layout))) + if (FAILED(hr = vkd3d_create_pipeline_layout(device, root_signature->vk_set_count, + root_signature->vk_set_layouts, root_signature->push_constant_range_count, + root_signature->push_constant_ranges, &root_signature->vk_pipeline_layout))) goto fail;
if (FAILED(hr = vkd3d_private_store_init(&root_signature->private_store))) @@ -1424,9 +1419,9 @@ static HRESULT d3d12_pipeline_state_init_compute_uav_counters(struct d3d12_pipel const struct vkd3d_shader_scan_descriptor_info *shader_info) { const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; - struct vkd3d_descriptor_set_context context; + VkDescriptorSetLayout set_layouts[VKD3D_MAX_DESCRIPTOR_SETS + 1]; VkDescriptorSetLayoutBinding *binding_desc; - VkDescriptorSetLayout set_layouts[3]; + uint32_t set_index, descriptor_binding; unsigned int uav_counter_count = 0; unsigned int i, j; HRESULT hr; @@ -1452,11 +1447,9 @@ static HRESULT d3d12_pipeline_state_init_compute_uav_counters(struct d3d12_pipel } state->uav_counter_count = uav_counter_count;
- memset(&context, 0, sizeof(context)); - if (root_signature->vk_push_set_layout) - set_layouts[context.set_index++] = root_signature->vk_push_set_layout; - if (root_signature->vk_set_layout) - set_layouts[context.set_index++] = root_signature->vk_set_layout; + descriptor_binding = 0; + for (set_index = 0; set_index < root_signature->vk_set_count; ++set_index) + set_layouts[set_index] = root_signature->vk_set_layouts[set_index];
for (i = 0, j = 0; i < shader_info->descriptor_count; ++i) { @@ -1469,25 +1462,25 @@ static HRESULT d3d12_pipeline_state_init_compute_uav_counters(struct d3d12_pipel state->uav_counters[j].register_space = d->register_space; state->uav_counters[j].register_index = d->register_index; state->uav_counters[j].shader_visibility = VKD3D_SHADER_VISIBILITY_COMPUTE; - state->uav_counters[j].binding.set = context.set_index; - state->uav_counters[j].binding.binding = context.descriptor_binding; + state->uav_counters[j].binding.set = set_index; + state->uav_counters[j].binding.binding = descriptor_binding; state->uav_counters[j].binding.count = 1;
/* FIXME: For the graphics pipeline we have to take the shader * visibility into account. */ - binding_desc[j].binding = context.descriptor_binding; + binding_desc[j].binding = descriptor_binding; binding_desc[j].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER; binding_desc[j].descriptorCount = 1; binding_desc[j].stageFlags = VK_SHADER_STAGE_ALL; binding_desc[j].pImmutableSamplers = NULL;
- ++context.descriptor_binding; + ++descriptor_binding; ++j; }
/* Create a descriptor set layout for UAV counters. */ hr = vkd3d_create_descriptor_set_layout(device, - 0, context.descriptor_binding, binding_desc, &state->vk_set_layout); + 0, descriptor_binding, binding_desc, &state->vk_set_layout); vkd3d_free(binding_desc); if (FAILED(hr)) { @@ -1498,9 +1491,9 @@ static HRESULT d3d12_pipeline_state_init_compute_uav_counters(struct d3d12_pipel /* Create a pipeline layout which is compatible for all other descriptor * sets with the root signature's pipeline layout. */ - state->set_index = context.set_index; - set_layouts[context.set_index++] = state->vk_set_layout; - if (FAILED(hr = vkd3d_create_pipeline_layout(device, context.set_index, set_layouts, + state->set_index = set_index; + set_layouts[set_index++] = state->vk_set_layout; + if (FAILED(hr = vkd3d_create_pipeline_layout(device, set_index, set_layouts, root_signature->push_constant_range_count, root_signature->push_constant_ranges, &state->vk_pipeline_layout))) { diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index b096a8c..b30e38e 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -54,6 +54,7 @@ #define VKD3D_MAX_SHADER_EXTENSIONS 1u #define VKD3D_MAX_SHADER_STAGES 5u #define VKD3D_MAX_VK_SYNC_OBJECTS 4u +#define VKD3D_MAX_DESCRIPTOR_SETS 2u
struct d3d12_command_list; struct d3d12_device; @@ -699,8 +700,8 @@ struct d3d12_root_signature LONG refcount;
VkPipelineLayout vk_pipeline_layout; - VkDescriptorSetLayout vk_push_set_layout; - VkDescriptorSetLayout vk_set_layout; + uint32_t vk_set_count; + VkDescriptorSetLayout vk_set_layouts[VKD3D_MAX_DESCRIPTOR_SETS];
struct d3d12_root_parameter *parameters; unsigned int parameter_count;
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com