anv: fix descriptor asserts

Lots of tests are hitting the assert, one in particular :

dEQP-VK.binding_model.mutable_descriptor.single.switches.sampler_combined_image_sampler.update_copy.nonmutable_source.normal_source.pool_same_types.pre_update.no_array.comp

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: b6d11ba5b4 ("anv: Protect memcpy/memset/qsort calls against NULL arguments")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32133>
This commit is contained in:
Lionel Landwerlin
2024-11-14 13:16:07 +02:00
committed by Marge Bot
parent 07f44ecd31
commit 5cfd841dda
+6 -4
View File
@@ -2702,8 +2702,9 @@ void anv_UpdateDescriptorSets(
* - RENDER_SURFACE_STATE
* - SAMPLER_STATE
*/
assert((dst->desc_surface_mem.map == NULL) == (src->desc_surface_mem.map == NULL));
if (dst->desc_surface_mem.map) {
if (copy_surface_element_size > 0) {
assert(dst->desc_surface_mem.map != NULL);
assert(src->desc_surface_mem.map != NULL);
memcpy(dst->desc_surface_mem.map +
dst_layout->descriptor_surface_offset +
(copy->dstArrayElement + j) * dst_layout->descriptor_surface_stride,
@@ -2713,8 +2714,9 @@ void anv_UpdateDescriptorSets(
copy_surface_element_size);
}
assert((dst->desc_sampler_mem.map == NULL) == (src->desc_sampler_mem.map == NULL));
if (dst->desc_sampler_mem.map) {
if (copy_sampler_element_size) {
assert(dst->desc_sampler_mem.map != NULL);
assert(src->desc_sampler_mem.map != NULL);
memcpy(dst->desc_sampler_mem.map +
dst_layout->descriptor_sampler_offset +
(copy->dstArrayElement + j) * dst_layout->descriptor_sampler_stride,