mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 23:09:05 +02:00
zink: use a single allocation for zink_descriptor_layout_key
this is slightly more smart Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18065>
This commit is contained in:
parent
234620d8ab
commit
fb9f110113
1 changed files with 3 additions and 8 deletions
|
|
@ -104,16 +104,11 @@ create_layout(struct zink_context *ctx, enum zink_descriptor_type type,
|
|||
if (!dsl)
|
||||
return NULL;
|
||||
|
||||
struct zink_descriptor_layout_key *k = ralloc(ctx, struct zink_descriptor_layout_key);
|
||||
size_t bindings_size = num_bindings * sizeof(VkDescriptorSetLayoutBinding);
|
||||
struct zink_descriptor_layout_key *k = ralloc_size(ctx, sizeof(struct zink_descriptor_layout_key) + bindings_size);
|
||||
k->num_bindings = num_bindings;
|
||||
if (num_bindings) {
|
||||
size_t bindings_size = num_bindings * sizeof(VkDescriptorSetLayoutBinding);
|
||||
k->bindings = ralloc_size(k, bindings_size);
|
||||
if (!k->bindings) {
|
||||
ralloc_free(k);
|
||||
VKSCR(DestroyDescriptorSetLayout)(screen->dev, dsl, NULL);
|
||||
return NULL;
|
||||
}
|
||||
k->bindings = (void *)(k + 1);
|
||||
memcpy(k->bindings, bindings, bindings_size);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue