On 20 Aug 2021, at 09:52, Henri Verbeet hverbeet@gmail.com wrote:
On Tue, 17 Aug 2021 at 16:02, Jan Sikorski jsikorski@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?
- Jan