| 841 | } |
| 842 | |
| 843 | void GPUContextVulkan::Clear(GPUTextureView* rt, const Color& color) |
| 844 | { |
| 845 | auto rtVulkan = static_cast<GPUTextureViewVulkan*>(rt); |
| 846 | |
| 847 | if (rtVulkan) |
| 848 | { |
| 849 | // TODO: detect if inside render pass and use ClearAttachments |
| 850 | // TODO: delay clear for attachments before render pass to use render pass clear values for faster clearing |
| 851 | |
| 852 | const auto cmdBuffer = _cmdBufferManager->GetCmdBuffer(); |
| 853 | if (cmdBuffer->IsInsideRenderPass()) |
| 854 | EndRenderPass(); |
| 855 | |
| 856 | AddImageBarrier(rtVulkan, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); |
| 857 | FlushBarriers(); |
| 858 | |
| 859 | vkCmdClearColorImage(cmdBuffer->GetHandle(), rtVulkan->Image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, (const VkClearColorValue*)color.Raw, 1, &rtVulkan->Info.subresourceRange); |
| 860 | } |
| 861 | } |
| 862 | |
| 863 | void GPUContextVulkan::ClearDepth(GPUTextureView* depthBuffer, float depthValue, uint8 stencilValue) |
| 864 | { |
no test coverage detected