radv: fix a potential crash if attachments allocation failed
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 14 Sep 2017 16:47:04 +0000 (18:47 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 15 Sep 2017 07:16:38 +0000 (09:16 +0200)
Also, it's useless to set the error code twice. Though, we
should probably skip the next commands when the command buffer
is considered invalid.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_cmd_buffer.c

index 068247d04d4a25a9caa8475cccd8efcb6223f2f4..5f22733a7d9e5cf7ceb4ee5649844ac82eba51c6 100644 (file)
@@ -2771,9 +2771,10 @@ void radv_CmdBeginRenderPass(
        cmd_buffer->state.framebuffer = framebuffer;
        cmd_buffer->state.pass = pass;
        cmd_buffer->state.render_area = pRenderPassBegin->renderArea;
+
        result = radv_cmd_state_setup_attachments(cmd_buffer, pass, pRenderPassBegin);
        if (result != VK_SUCCESS)
-               cmd_buffer->record_result = result;
+               return;
 
        radv_cmd_buffer_set_subpass(cmd_buffer, pass->subpasses, true);
        assert(cmd_buffer->cs->cdw <= cdw_max);