diff options
author | Samuel Pitoiset <[email protected]> | 2020-04-23 16:02:59 +0200 |
---|---|---|
committer | Marge Bot <[email protected]> | 2020-04-29 07:29:54 +0000 |
commit | c1ef225d18332ed4800191d686dc1527e8156544 (patch) | |
tree | 60af596217a944940a6a0714fae2aa23388a270a /src | |
parent | 60cc065c7dbf0291c69638fdd6a6597050814e57 (diff) |
radv: handle NULL descriptors
All fields must be zero, otherwise the HW hangs.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4775>
Diffstat (limited to 'src')
-rw-r--r-- | src/amd/vulkan/radv_descriptor_set.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c index dff774ace69..126176a9706 100644 --- a/src/amd/vulkan/radv_descriptor_set.c +++ b/src/amd/vulkan/radv_descriptor_set.c @@ -830,6 +830,11 @@ static void write_texel_buffer_descriptor(struct radv_device *device, { RADV_FROM_HANDLE(radv_buffer_view, buffer_view, _buffer_view); + if (!buffer_view) { + memset(dst, 0, 4 * 4); + return; + } + memcpy(dst, buffer_view->state, 4 * 4); if (cmd_buffer) @@ -845,6 +850,12 @@ static void write_buffer_descriptor(struct radv_device *device, const VkDescriptorBufferInfo *buffer_info) { RADV_FROM_HANDLE(radv_buffer, buffer, buffer_info->buffer); + + if (!buffer) { + memset(dst, 0, 4 * 4); + return; + } + uint64_t va = radv_buffer_get_va(buffer->bo); uint32_t range = buffer_info->range; @@ -898,8 +909,14 @@ static void write_dynamic_buffer_descriptor(struct radv_device *device, const VkDescriptorBufferInfo *buffer_info) { RADV_FROM_HANDLE(radv_buffer, buffer, buffer_info->buffer); - uint64_t va = radv_buffer_get_va(buffer->bo); - unsigned size = buffer_info->range; + uint64_t va; + unsigned size; + + if (!buffer) + return; + + va = radv_buffer_get_va(buffer->bo); + size = buffer_info->range; if (buffer_info->range == VK_WHOLE_SIZE) size = buffer->size - buffer_info->offset; @@ -928,6 +945,11 @@ write_image_descriptor(struct radv_device *device, RADV_FROM_HANDLE(radv_image_view, iview, image_info->imageView); union radv_descriptor *descriptor; + if (!iview) { + memset(dst, 0, size); + return; + } + if (descriptor_type == VK_DESCRIPTOR_TYPE_STORAGE_IMAGE) { descriptor = &iview->storage_descriptor; } else { |