radv: move assert down in radv_bind_descriptor_set
authorDave Airlie <airlied@redhat.com>
Mon, 12 Jun 2017 23:36:15 +0000 (09:36 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 13 Jun 2017 00:01:36 +0000 (10:01 +1000)
coverity complains about the deref before NULL check.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/amd/vulkan/radv_cmd_buffer.c

index b08f218549a3d918c066853ea2a6b7bf8eb4d487..9f36d982234a6413ae3bef26c84d3e0dad73a358 100644 (file)
@@ -2015,13 +2015,13 @@ void radv_bind_descriptor_set(struct radv_cmd_buffer *cmd_buffer,
 {
        struct radeon_winsys *ws = cmd_buffer->device->ws;
 
-       assert(!(set->layout->flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR));
-
        cmd_buffer->state.descriptors[idx] = set;
        cmd_buffer->state.descriptors_dirty |= (1u << idx);
        if (!set)
                return;
 
+       assert(!(set->layout->flags & VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR));
+
        for (unsigned j = 0; j < set->layout->buffer_count; ++j)
                if (set->descriptors[j])
                        ws->cs_add_buffer(cmd_buffer->cs, set->descriptors[j], 7);