[Mesa-dev] [PATCH 3/5] anv/descriptor_set: Ensure that bindings are always in increasing order

Michael Schellenberger Costa mschellenbergercosta at googlemail.com
Mon Jun 6 19:07:51 UTC 2016


Hi Jason,

Am 06/06/2016 um 20:26 schrieb Jason Ekstrand:
> Since applications are allowed to specify some set of bindings which need
> not be dense they also need not be in order.  

That sentence reads strange. "Need not be" sounds like must not. Dont
you mean "Do not need to be"?
--Michael

For most things, this doesn't
> matter, but it could result getting the wrong dynamic offsets. This adds a
> quick-and-dirty sort to ensure that everything is always in increasing
> order of binding index.
> 
> Signed-off-by: Jason Ekstrand <jason at jlekstrand.net>
> Cc: Kristian Høgsberg Kristensen <krh at bitplanet.net>
> ---
>  src/intel/vulkan/anv_descriptor_set.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/src/intel/vulkan/anv_descriptor_set.c b/src/intel/vulkan/anv_descriptor_set.c
> index c977318..448ae0e 100644
> --- a/src/intel/vulkan/anv_descriptor_set.c
> +++ b/src/intel/vulkan/anv_descriptor_set.c
> @@ -89,6 +89,19 @@ VkResult anv_CreateDescriptorSetLayout(
>     for (uint32_t j = 0; j < pCreateInfo->bindingCount; j++) {
>        const VkDescriptorSetLayoutBinding *binding = &pCreateInfo->pBindings[j];
>        uint32_t b = binding->binding;
> +      /* We temporarily store the pointer to the binding in the
> +       * immutable_samplers pointer.  This provides us with a quick-and-dirty
> +       * way to sort the bindings by binding number.
> +       */
> +      set_layout->binding[b].immutable_samplers = (void *)binding;
> +   }
> +
> +   for (uint32_t b = 0; b <= max_binding; b++) {
> +      const VkDescriptorSetLayoutBinding *binding =
> +         (void *)set_layout->binding[b].immutable_samplers;
> +
> +      if (binding == NULL)
> +         continue;
>  
>        assert(binding->descriptorCount > 0);
>  #ifndef NDEBUG
> 


More information about the mesa-dev mailing list