| 2484 | } |
| 2485 | |
| 2486 | bool SyncValidator::ProcessQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2* pSubmits, VkFence fence, |
| 2487 | const ErrorObject& error_obj) { |
| 2488 | bool skip = false; |
| 2489 | |
| 2490 | const QueueId queue_id = GetQueueId(queue); |
| 2491 | if (queue_id == kQueueIdInvalid) { |
| 2492 | return skip; |
| 2493 | } |
| 2494 | |
| 2495 | QueueState& queue_state = GetQueueState(queue_id); |
| 2496 | SignalsUpdate signals_update(*this); |
| 2497 | |
| 2498 | // The submit id is a mutable automic which is not recoverable on a skip == true condition |
| 2499 | uint64_t submit_id = queue_state.ReserveSubmitId(); |
| 2500 | |
| 2501 | // Update label stack as we progress through batches and command buffers |
| 2502 | auto current_label_stack = queue_state.GetQueue()->cmdbuf_label_stack; |
| 2503 | |
| 2504 | BatchContextPtr last_batch = queue_state.LastBatch(); |
| 2505 | bool has_unresolved_batches = !queue_state.UnresolvedBatches().empty(); |
| 2506 | |
| 2507 | BatchContextPtr new_last_batch; |
| 2508 | std::vector<UnresolvedBatch> new_unresolved_batches; |
| 2509 | bool new_timeline_signals = false; |
| 2510 | |
| 2511 | for (uint32_t batch_idx = 0; batch_idx < submitCount; batch_idx++) { |
| 2512 | const VkSubmitInfo2& submit = pSubmits[batch_idx]; |
| 2513 | auto batch = std::make_shared<QueueBatchContext>(*this, queue_state); |
| 2514 | |
| 2515 | const auto wait_semaphores = vvl::make_span(submit.pWaitSemaphoreInfos, submit.waitSemaphoreInfoCount); |
| 2516 | std::vector<VkSemaphoreSubmitInfo> unresolved_waits; |
| 2517 | auto resolved_batches = batch->ResolveSubmitWaits(wait_semaphores, unresolved_waits, signals_update); |
| 2518 | |
| 2519 | // Add unresolved batch |
| 2520 | if (has_unresolved_batches || !unresolved_waits.empty()) { |
| 2521 | UnresolvedBatch unresolved_batch; |
| 2522 | unresolved_batch.batch = std::move(batch); |
| 2523 | unresolved_batch.submit_index = submit_id; |
| 2524 | unresolved_batch.batch_index = batch_idx; |
| 2525 | unresolved_batch.command_buffers = GetCommandBuffers(*device_state, submit); |
| 2526 | unresolved_batch.unresolved_waits = std::move(unresolved_waits); |
| 2527 | unresolved_batch.resolved_dependencies = std::move(resolved_batches); |
| 2528 | if (submit.pSignalSemaphoreInfos && submit.signalSemaphoreInfoCount) { |
| 2529 | const auto last_info = submit.pSignalSemaphoreInfos + submit.signalSemaphoreInfoCount; |
| 2530 | unresolved_batch.signals.assign(submit.pSignalSemaphoreInfos, last_info); |
| 2531 | } |
| 2532 | unresolved_batch.label_stack = current_label_stack; |
| 2533 | new_unresolved_batches.emplace_back(std::move(unresolved_batch)); |
| 2534 | has_unresolved_batches = true; |
| 2535 | stats.AddUnresolvedBatch(); |
| 2536 | continue; |
| 2537 | } |
| 2538 | new_last_batch = batch; |
| 2539 | |
| 2540 | // Import the previous batch information |
| 2541 | if (last_batch && !vvl::Contains(resolved_batches, last_batch)) { |
| 2542 | batch->ResolveLastBatch(last_batch); |
| 2543 | resolved_batches.emplace_back(std::move(last_batch)); |
no test coverage detected