MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ClearDepth

Method ClearDepth

Source/Engine/GraphicsDevice/Vulkan/GPUContextVulkan.cpp:863–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

861}
862
863void 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
885void GPUContextVulkan::ClearUA(GPUBuffer* buf, const Float4& value)
886{

Callers 7

FillMethod · 0.45
RenderShadowMapsMethod · 0.45
DownscaleDepthMethod · 0.45
RenderMethod · 0.45
RenderMethod · 0.45
RenderMethod · 0.45
RenderMethod · 0.45

Calls 3

GetCmdBufferMethod · 0.80
IsInsideRenderPassMethod · 0.80
GetHandleMethod · 0.45

Tested by

no test coverage detected