mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-07 03:20:28 +01:00
anv: track embedded sampler counts in layouts
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28290>
This commit is contained in:
parent
dc1069b167
commit
7730fa5683
2 changed files with 25 additions and 0 deletions
|
|
@ -699,6 +699,7 @@ VkResult anv_CreateDescriptorSetLayout(
|
|||
uint32_t dynamic_offset_count = 0;
|
||||
uint32_t descriptor_buffer_surface_size = 0;
|
||||
uint32_t descriptor_buffer_sampler_size = 0;
|
||||
uint32_t sampler_count = 0;
|
||||
|
||||
for (uint32_t j = 0; j < pCreateInfo->bindingCount; j++) {
|
||||
const VkDescriptorSetLayoutBinding *binding = &pCreateInfo->pBindings[j];
|
||||
|
|
@ -846,6 +847,11 @@ VkResult anv_CreateDescriptorSetLayout(
|
|||
MAX2(set_layout->binding[b].max_plane_count, 1) *
|
||||
set_layout->binding[b].descriptor_data_sampler_size;
|
||||
|
||||
if (binding->descriptorType == VK_DESCRIPTOR_TYPE_SAMPLER) {
|
||||
sampler_count += binding->descriptorCount *
|
||||
set_layout->binding[b].max_plane_count;
|
||||
}
|
||||
|
||||
unsigned surface_align, sampler_align;
|
||||
anv_descriptor_data_alignment(set_layout->binding[b].data,
|
||||
set_layout->type,
|
||||
|
|
@ -885,6 +891,7 @@ VkResult anv_CreateDescriptorSetLayout(
|
|||
VK_DESCRIPTOR_SET_LAYOUT_CREATE_EMBEDDED_IMMUTABLE_SAMPLERS_BIT_EXT) {
|
||||
assert(set_layout->descriptor_buffer_surface_size == 0);
|
||||
assert(set_layout->descriptor_buffer_sampler_size == 0);
|
||||
set_layout->embedded_sampler_count = sampler_count;
|
||||
}
|
||||
|
||||
*pSetLayout = anv_descriptor_set_layout_to_handle(set_layout);
|
||||
|
|
@ -1148,6 +1155,18 @@ anv_pipeline_sets_layout_add(struct anv_pipeline_sets_layout *layout,
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
anv_pipeline_sets_layout_embedded_sampler_count(const struct anv_pipeline_sets_layout *layout)
|
||||
{
|
||||
uint32_t count = 0;
|
||||
for (unsigned s = 0; s < layout->num_sets; s++) {
|
||||
if (!layout->set[s].layout)
|
||||
continue;
|
||||
count += layout->set[s].layout->embedded_sampler_count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void
|
||||
anv_pipeline_sets_layout_hash(struct anv_pipeline_sets_layout *layout)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2562,6 +2562,9 @@ struct anv_descriptor_set_layout {
|
|||
*/
|
||||
uint32_t descriptor_buffer_sampler_size;
|
||||
|
||||
/* Number of embedded sampler count */
|
||||
uint32_t embedded_sampler_count;
|
||||
|
||||
/* Bindings in this descriptor set */
|
||||
struct anv_descriptor_set_binding_layout binding[0];
|
||||
};
|
||||
|
|
@ -2960,6 +2963,9 @@ void anv_pipeline_sets_layout_add(struct anv_pipeline_sets_layout *layout,
|
|||
uint32_t set_idx,
|
||||
struct anv_descriptor_set_layout *set_layout);
|
||||
|
||||
uint32_t
|
||||
anv_pipeline_sets_layout_embedded_sampler_count(const struct anv_pipeline_sets_layout *layout);
|
||||
|
||||
void anv_pipeline_sets_layout_hash(struct anv_pipeline_sets_layout *layout);
|
||||
|
||||
void anv_pipeline_sets_layout_print(const struct anv_pipeline_sets_layout *layout);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue