[PATCH v2 2/4] wined3d: Add push constants to wined3d_pipeline_layout_key_vk.
jsikorski at codeweavers.com
Fri Aug 20 04:33:51 CDT 2021
> On 20 Aug 2021, at 09:52, Henri Verbeet <hverbeet at gmail.com> wrote:
> 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.
I wonder how it didn’t break everything. Somehow I imagined that || returns its first nonzero input..
>> 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.
No, we don’t, it was just convenient. As an aside, maybe we might try using them for application shaders too?
More information about the wine-devel