anv_descriptor_set_destroy uses the descriptor sets's set_layout member
to iterate the set's buffer views. However, the set_layout reference
may have previously been freed.
On 64 bit builds, this bug generated valgrind errors but did not affect
CTS test results. On 32 bit builds, it reliably produces assertions and
memory corruption.
set->buffer_views[b].surface_state =
anv_state_pool_alloc(&device->surface_state_pool, 64, 64);
}
-
+ set->buffer_count = layout->buffer_count;
*out_set = set;
return VK_SUCCESS;
struct anv_descriptor_set *set)
{
/* XXX: Use the pool */
- for (uint32_t b = 0; b < set->layout->buffer_count; b++)
+ for (uint32_t b = 0; b < set->buffer_count; b++)
anv_state_pool_free(&device->surface_state_pool,
set->buffer_views[b].surface_state);
dest->descriptors[copy->dstBinding + j] =
src->descriptors[copy->srcBinding + j];
}
+ dest->buffer_count = src->buffer_count;
}
}
struct anv_descriptor_set {
const struct anv_descriptor_set_layout *layout;
+ uint32_t buffer_count;
struct anv_buffer_view *buffer_views;
struct anv_descriptor descriptors[0];
};