radv: handle NULL vertex bindings
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 15 Apr 2020 09:48:13 +0000 (11:48 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 29 Apr 2020 07:29:54 +0000 (07:29 +0000)
With VK_EXT_robustness2, an element of pBuffers can be NULL.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4775>

src/amd/vulkan/radv_cmd_buffer.c

index a2526186e76bd907e17aa4a4684f1766cb5b013c..38c71dcd3ecac6b39ada7d9c950fedd042b5fe9f 100644 (file)
@@ -3453,19 +3453,22 @@ void radv_CmdBindVertexBuffers(
 
        assert(firstBinding + bindingCount <= MAX_VBS);
        for (uint32_t i = 0; i < bindingCount; i++) {
+               RADV_FROM_HANDLE(radv_buffer, buffer, pBuffers[i]);
                uint32_t idx = firstBinding + i;
 
                if (!changed &&
-                   (vb[idx].buffer != radv_buffer_from_handle(pBuffers[i]) ||
+                   (vb[idx].buffer != buffer ||
                     vb[idx].offset != pOffsets[i])) {
                        changed = true;
                }
 
-               vb[idx].buffer = radv_buffer_from_handle(pBuffers[i]);
+               vb[idx].buffer = buffer;
                vb[idx].offset = pOffsets[i];
 
-               radv_cs_add_buffer(cmd_buffer->device->ws, cmd_buffer->cs,
-                                  vb[idx].buffer->bo);
+               if (buffer) {
+                       radv_cs_add_buffer(cmd_buffer->device->ws,
+                                          cmd_buffer->cs, vb[idx].buffer->bo);
+               }
        }
 
        if (!changed) {