| 861 | } |
| 862 | |
| 863 | void GPUContextVulkan::ClearDepth(GPUTextureView* depthBuffer, float depthValue, uint8 stencilValue) |
| 864 | { |
| 865 | const auto rtVulkan = static_cast<GPUTextureViewVulkan*>(depthBuffer); |
| 866 | if (rtVulkan) |
| 867 | { |
| 868 | // TODO: detect if inside render pass and use ClearAttachments |
| 869 | // TODO: delay clear for attachments before render pass to use render pass clear values for faster clearing |
| 870 | |
| 871 | const auto cmdBuffer = _cmdBufferManager->GetCmdBuffer(); |
| 872 | if (cmdBuffer->IsInsideRenderPass()) |
| 873 | EndRenderPass(); |
| 874 | |
| 875 | AddImageBarrier(rtVulkan, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL); |
| 876 | FlushBarriers(); |
| 877 | |
| 878 | VkClearDepthStencilValue clear; |
| 879 | clear.depth = depthValue; |
| 880 | clear.stencil = stencilValue; |
| 881 | vkCmdClearDepthStencilImage(cmdBuffer->GetHandle(), rtVulkan->Image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clear, 1, &rtVulkan->Info.subresourceRange); |
| 882 | } |
| 883 | } |
| 884 | |
| 885 | void GPUContextVulkan::ClearUA(GPUBuffer* buf, const Float4& value) |
| 886 | { |
no test coverage detected