| 1403 | } |
| 1404 | |
| 1405 | void CommandBuffer::Begin(const VkCommandBufferBeginInfo* pBeginInfo) { |
| 1406 | if (IsRecorded(state)) { |
| 1407 | Location loc(Func::vkBeginCommandBuffer); |
| 1408 | Reset(loc); |
| 1409 | } |
| 1410 | |
| 1411 | // Set updated state here in case implicit reset occurs above |
| 1412 | state = CbState::Recording; |
| 1413 | ASSERT_AND_RETURN(pBeginInfo); |
| 1414 | |
| 1415 | begin_info_flags = pBeginInfo->flags; |
| 1416 | |
| 1417 | if (pBeginInfo->pInheritanceInfo && IsSecondary()) { |
| 1418 | // pInheritanceInfo could be valid, but ignored, if in a primary command buffer |
| 1419 | has_inheritance = true; |
| 1420 | inheritance_info.initialize(pBeginInfo->pInheritanceInfo); |
| 1421 | |
| 1422 | // If we are a secondary command-buffer and inheriting. Update the items we should inherit. |
| 1423 | if (begin_info_flags & VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT) { |
| 1424 | if (inheritance_info.renderPass) { |
| 1425 | active_render_pass = dev_data.Get<vvl::RenderPass>(inheritance_info.renderPass); |
| 1426 | SetActiveSubpass(inheritance_info.subpass); |
| 1427 | |
| 1428 | if (inheritance_info.framebuffer) { |
| 1429 | active_framebuffer = dev_data.Get<vvl::Framebuffer>(inheritance_info.framebuffer); |
| 1430 | attachment_source = AttachmentSource::Inheritance; |
| 1431 | active_subpasses.clear(); |
| 1432 | active_attachments.clear(); |
| 1433 | |
| 1434 | if (active_framebuffer) { |
| 1435 | active_subpasses.resize(active_framebuffer->create_info.attachmentCount); |
| 1436 | active_attachments.resize(active_framebuffer->create_info.attachmentCount); |
| 1437 | UpdateAttachmentsView(nullptr); |
| 1438 | |
| 1439 | // Connect this framebuffer and its children to this cmdBuffer |
| 1440 | if (!dev_data.disabled[command_buffer_state]) { |
| 1441 | AddChild(active_framebuffer); |
| 1442 | } |
| 1443 | } |
| 1444 | } |
| 1445 | } else { |
| 1446 | auto inheritance_rendering_info = |
| 1447 | vku::FindStructInPNextChain<VkCommandBufferInheritanceRenderingInfo>(pBeginInfo->pInheritanceInfo->pNext); |
| 1448 | if (inheritance_rendering_info) { |
| 1449 | active_render_pass = std::make_shared<vvl::RenderPass>(inheritance_rendering_info); |
| 1450 | |
| 1451 | InitDefaultRenderingAttachments(rendering_attachments, inheritance_rendering_info->colorAttachmentCount); |
| 1452 | if (auto locations = |
| 1453 | vku::FindStructInPNextChain<VkRenderingAttachmentLocationInfo>(pBeginInfo->pInheritanceInfo->pNext)) { |
| 1454 | SetRenderingAttachmentLocations(rendering_attachments, locations); |
| 1455 | } |
| 1456 | if (auto indexes = |
| 1457 | vku::FindStructInPNextChain<VkRenderingInputAttachmentIndexInfo>(pBeginInfo->pInheritanceInfo->pNext)) { |
| 1458 | SetRenderingInputAttachmentIndices(rendering_attachments, indexes); |
| 1459 | } |
| 1460 | } |
| 1461 | } |
| 1462 | } |
no test coverage detected