vk: Only begin subpass if we're continuing a render pass
authorKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Sat, 9 Jan 2016 06:50:18 +0000 (22:50 -0800)
committerKristian Høgsberg Kristensen <kristian.h.kristensen@intel.com>
Sat, 9 Jan 2016 07:02:46 +0000 (23:02 -0800)
If VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT is not set in
pBeginInfo->flags, we don't have a render pass or framebuffer. Change
the condition that guard looking up render pass and framebuffer to test
for VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT instead of
VK_COMMAND_BUFFER_LEVEL_SECONDARY.

Fixes all remaining crashes in dEQP-VK.api.command_buffers.*.

src/vulkan/anv_cmd_buffer.c

index 0407ad92fba2ad1adfa24c3578ae11c781a33479..5507400c84a2b3a3e957cd7d2b625c5cef34521d 100644 (file)
@@ -297,7 +297,11 @@ VkResult anv_BeginCommandBuffer(
 
    cmd_buffer->usage_flags = pBeginInfo->flags;
 
-   if (cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY) {
+   assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_SECONDARY ||
+          !(cmd_buffer->usage_flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT));
+
+   if (cmd_buffer->usage_flags &
+       VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) {
       cmd_buffer->state.framebuffer =
          anv_framebuffer_from_handle(pBeginInfo->framebuffer);
       cmd_buffer->state.pass =