[PATCH v2 2/4] wined3d: Add push constants to wined3d_pipeline_layout_key_vk.

Henri Verbeet hverbeet at gmail.com
Fri Aug 20 02:52:13 CDT 2021


On Tue, 17 Aug 2021 at 16:02, Jan Sikorski <jsikorski at codeweavers.com> wrote:
> @@ -1746,7 +1746,10 @@ static int wined3d_pipeline_layout_vk_compare(const void *key, const struct wine
>
>      if (a->binding_count != b->binding_count)
>          return a->binding_count - b->binding_count;
> -    return memcmp(a->bindings, b->bindings, a->binding_count * sizeof(*a->bindings));
> +    if (a->push_constant_count != b->push_constant_count)
> +        return a->push_constant_count - b->push_constant_count;
> +    return memcmp(a->bindings, b->bindings, a->binding_count * sizeof(*a->bindings)) ||
> +            memcmp(a->push_constants, b->push_constants, a->push_constant_count * sizeof(*a->push_constants));
>  }
>
That doesn't do the right thing, the compare needs to be ordered.

>      memcpy(layout->key.bindings, key.bindings, sizeof(*layout->key.bindings) * key.binding_count);
>      layout->key.binding_count = key.binding_count;
> +    layout->key.push_constants = (VkPushConstantRange *)(layout->key.bindings + key.binding_count);

By convention, we'd write that as "layout->key.push_constants =
(VkPushConstantRange *)&layout->key.bindings[key.binding_count];"

Do we need push constants in the pipeline layout cache? I imagine we'd
only use these for internal shaders, but we wouldn't need to go
through the pipeline layout cache for those.



More information about the wine-devel mailing list