diff options
author | Jason Ekstrand <[email protected]> | 2019-02-07 10:16:24 -0600 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-04-19 19:56:42 +0000 |
commit | e612c3b9bfd5c9bfb6ece9e2b3c88f787d742d85 (patch) | |
tree | 817c0999a4ccbd387efb309b689111e83644d3c3 | |
parent | 843286d324c833198f4f5bd6d548ab3612968169 (diff) |
anv: Count the number of planes in each descriptor binding
Reviewed-by: Lionel Landwerlin <[email protected]>
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
-rw-r--r-- | src/intel/vulkan/anv_descriptor_set.c | 19 | ||||
-rw-r--r-- | src/intel/vulkan/anv_private.h | 3 |
2 files changed, 19 insertions, 3 deletions
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) */ |