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

Method ManualClear

Source/Engine/GraphicsDevice/WebGPU/GPUContextWebGPU.cpp:812–851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

810}
811
812void GPUContextWebGPU::ManualClear(const PendingClear& clear)
813{
814 // End existing pass (if any)
815 if (_renderPass)
816 EndRenderPass();
817
818 // Clear with a render pass
819 WGPURenderPassColorAttachment colorAttachment;
820 WGPURenderPassDepthStencilAttachment depthStencilAttachment;
821 WGPURenderPassDescriptor renderPassDesc = WGPU_RENDER_PASS_DESCRIPTOR_INIT;
822 if (((GPUTextureWebGPU*)clear.View->GetParent())->IsDepthStencil())
823 {
824 renderPassDesc.depthStencilAttachment = &depthStencilAttachment;
825 depthStencilAttachment = WGPU_RENDER_PASS_DEPTH_STENCIL_ATTACHMENT_INIT;
826 depthStencilAttachment.view = clear.View->ViewRender;
827 depthStencilAttachment.depthLoadOp = WGPULoadOp_Clear;
828 depthStencilAttachment.depthStoreOp = WGPUStoreOp_Store;
829 depthStencilAttachment.depthClearValue = clear.Depth;
830 depthStencilAttachment.stencilClearValue = clear.Stencil;
831 if (clear.View->HasStencil)
832 {
833 depthStencilAttachment.stencilLoadOp = WGPULoadOp_Clear;
834 depthStencilAttachment.stencilStoreOp = WGPUStoreOp_Store;
835 }
836 }
837 else
838 {
839 renderPassDesc.colorAttachmentCount = 1;
840 renderPassDesc.colorAttachments = &colorAttachment;
841 colorAttachment = WGPU_RENDER_PASS_COLOR_ATTACHMENT_INIT;
842 colorAttachment.view = clear.View->ViewRender;
843 colorAttachment.depthSlice = clear.View->DepthSlice;
844 colorAttachment.loadOp = WGPULoadOp_Clear;
845 colorAttachment.storeOp = WGPUStoreOp_Store;
846 colorAttachment.clearValue = { clear.RGBA[0], clear.RGBA[1], clear.RGBA[2], clear.RGBA[3] };
847 }
848 auto renderPass = wgpuCommandEncoderBeginRenderPass(Encoder, &renderPassDesc);
849 wgpuRenderPassEncoderEnd(renderPass);
850 wgpuRenderPassEncoderRelease(renderPass);
851}
852
853void GPUContextWebGPU::OnDrawCall()
854{

Callers

nothing calls this directly

Calls 2

IsDepthStencilMethod · 0.80
GetParentMethod · 0.45

Tested by

no test coverage detected