| 523 | } |
| 524 | |
| 525 | void VKCommandBuffer::ClearAttachments(std::uint32_t numAttachments, const AttachmentClear* attachments) |
| 526 | { |
| 527 | /* Convert clear attachment descriptors */ |
| 528 | VkClearAttachment attachmentsVK[LLGL_MAX_NUM_ATTACHMENTS]; |
| 529 | |
| 530 | std::uint32_t numAttachmentsVK = 0; |
| 531 | |
| 532 | for (std::uint32_t i = 0, n = std::min(numAttachments, LLGL_MAX_NUM_ATTACHMENTS); i < n; ++i) |
| 533 | { |
| 534 | auto& dst = attachmentsVK[numAttachmentsVK]; |
| 535 | const auto& src = attachments[i]; |
| 536 | |
| 537 | if ((src.flags & ClearFlags::Color) != 0) |
| 538 | { |
| 539 | /* Convert color clear command */ |
| 540 | dst.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; |
| 541 | dst.colorAttachment = src.colorAttachment; |
| 542 | ToVkClearColor(dst.clearValue.color, src.clearValue.color); |
| 543 | ++numAttachmentsVK; |
| 544 | } |
| 545 | else if (hasDSVAttachment_) |
| 546 | { |
| 547 | /* Convert depth-stencil clear command */ |
| 548 | dst.aspectMask = 0; |
| 549 | dst.colorAttachment = 0; |
| 550 | |
| 551 | if ((src.flags & ClearFlags::Depth) != 0) |
| 552 | { |
| 553 | dst.aspectMask |= VK_IMAGE_ASPECT_DEPTH_BIT; |
| 554 | dst.clearValue.depthStencil.depth = src.clearValue.depth; |
| 555 | } |
| 556 | if ((src.flags & ClearFlags::Stencil) != 0) |
| 557 | { |
| 558 | dst.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT; |
| 559 | dst.clearValue.depthStencil.stencil = src.clearValue.stencil; |
| 560 | } |
| 561 | |
| 562 | ++numAttachmentsVK; |
| 563 | } |
| 564 | } |
| 565 | |
| 566 | ClearFramebufferAttachments(numAttachmentsVK, attachmentsVK); |
| 567 | } |
| 568 | |
| 569 | /* ----- Input Assembly ------ */ |
| 570 |
no test coverage detected