anv: introduce a new descriptor set layout type

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21645>
This commit is contained in:
Lionel Landwerlin
2023-03-27 17:11:44 +03:00
committed by Marge Bot
parent 7b9d27e613
commit 6367691b58
2 changed files with 24 additions and 0 deletions

View File

@@ -579,6 +579,13 @@ VkResult anv_CreateDescriptorSetLayout(
set_layout->dynamic_offset_count = dynamic_offset_count;
set_layout->descriptor_buffer_size = descriptor_buffer_size;
if (pCreateInfo->flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_DESCRIPTOR_BUFFER_BIT_EXT)
set_layout->type = ANV_PIPELINE_DESCRIPTOR_SET_LAYOUT_TYPE_BUFFER;
else if (device->physical->indirect_descriptors)
set_layout->type = ANV_PIPELINE_DESCRIPTOR_SET_LAYOUT_TYPE_INDIRECT;
else
set_layout->type = ANV_PIPELINE_DESCRIPTOR_SET_LAYOUT_TYPE_DIRECT;
*pSetLayout = anv_descriptor_set_layout_to_handle(set_layout);
return VK_SUCCESS;
@@ -764,6 +771,11 @@ anv_pipeline_sets_layout_add(struct anv_pipeline_sets_layout *layout,
if (layout->independent_sets && anv_descriptor_set_layout_empty(set_layout))
return;
if (layout->type == ANV_PIPELINE_DESCRIPTOR_SET_LAYOUT_TYPE_UNKNOWN)
layout->type = set_layout->type;
else
assert(layout->type == set_layout->type);
layout->num_sets = MAX2(set_idx + 1, layout->num_sets);
layout->set[set_idx].layout =

View File

@@ -1695,6 +1695,13 @@ struct anv_descriptor_set_binding_layout {
struct anv_sampler **immutable_samplers;
};
enum anv_descriptor_set_layout_type {
ANV_PIPELINE_DESCRIPTOR_SET_LAYOUT_TYPE_UNKNOWN,
ANV_PIPELINE_DESCRIPTOR_SET_LAYOUT_TYPE_INDIRECT,
ANV_PIPELINE_DESCRIPTOR_SET_LAYOUT_TYPE_DIRECT,
ANV_PIPELINE_DESCRIPTOR_SET_LAYOUT_TYPE_BUFFER,
};
bool anv_descriptor_supports_bindless(const struct anv_physical_device *pdevice,
const struct anv_descriptor_set_binding_layout *binding,
bool sampler);
@@ -1708,6 +1715,9 @@ struct anv_descriptor_set_layout {
VkDescriptorSetLayoutCreateFlags flags;
/* Type of descriptor set layout */
enum anv_descriptor_set_layout_type type;
/* Descriptor set layouts can be destroyed at almost any time */
uint32_t ref_cnt;
@@ -2023,6 +2033,8 @@ struct anv_pipeline_sets_layout {
uint32_t dynamic_offset_start;
} set[MAX_SETS];
enum anv_descriptor_set_layout_type type;
uint32_t num_sets;
uint32_t num_dynamic_buffers;