From e612c3b9bfd5c9bfb6ece9e2b3c88f787d742d85 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 7 Feb 2019 10:16:24 -0600 Subject: anv: Count the number of planes in each descriptor binding Reviewed-by: Lionel Landwerlin Reviewed-by: Caio Marcelo de Oliveira Filho --- src/intel/vulkan/anv_descriptor_set.c | 19 ++++++++++++++++--- src/intel/vulkan/anv_private.h | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src/intel') diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c index 85915cfb9d0..2d0df227852 100644 --- a/src/intel/vulkan/anv_descriptor_set.c +++ b/src/intel/vulkan/anv_descriptor_set.c @@ -289,6 +289,7 @@ VkResult anv_CreateDescriptorSetLayout( memset(&set_layout->binding[b], -1, sizeof(set_layout->binding[b])); set_layout->binding[b].data = 0; + set_layout->binding[b].max_plane_count = 0; set_layout->binding[b].array_size = 0; set_layout->binding[b].immutable_samplers = NULL; } @@ -344,15 +345,26 @@ VkResult anv_CreateDescriptorSetLayout( switch (binding->descriptorType) { case VK_DESCRIPTOR_TYPE_SAMPLER: case VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER: + set_layout->binding[b].max_plane_count = 1; if (binding->pImmutableSamplers) { set_layout->binding[b].immutable_samplers = samplers; samplers += binding->descriptorCount; - for (uint32_t i = 0; i < binding->descriptorCount; i++) - set_layout->binding[b].immutable_samplers[i] = - anv_sampler_from_handle(binding->pImmutableSamplers[i]); + for (uint32_t i = 0; i < binding->descriptorCount; i++) { + ANV_FROM_HANDLE(anv_sampler, sampler, + binding->pImmutableSamplers[i]); + + set_layout->binding[b].immutable_samplers[i] = sampler; + if (set_layout->binding[b].max_plane_count < sampler->n_planes) + set_layout->binding[b].max_plane_count = sampler->n_planes; + } } break; + + case VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE: + set_layout->binding[b].max_plane_count = 1; + break; + default: break; } @@ -427,6 +439,7 @@ sha1_update_descriptor_set_binding_layout(struct mesa_sha1 *ctx, const struct anv_descriptor_set_binding_layout *layout) { SHA1_UPDATE_VALUE(ctx, layout->data); + SHA1_UPDATE_VALUE(ctx, layout->max_plane_count); SHA1_UPDATE_VALUE(ctx, layout->array_size); SHA1_UPDATE_VALUE(ctx, layout->descriptor_index); SHA1_UPDATE_VALUE(ctx, layout->dynamic_offset_index); diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 9c747fa019c..bb24ff1ae82 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1558,6 +1558,9 @@ struct anv_descriptor_set_binding_layout { /* Bitfield representing the type of data this descriptor contains */ enum anv_descriptor_data data; + /* Maximum number of YCbCr texture/sampler planes */ + uint8_t max_plane_count; + /* Number of array elements in this binding (or size in bytes for inline * uniform data) */ -- cgit v1.2.3