| 810 | } |
| 811 | |
| 812 | void 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 | |
| 853 | void GPUContextWebGPU::OnDrawCall() |
| 854 | { |
nothing calls this directly
no test coverage detected