* Resets all depth information so that nothing previously drawn will * occlude anything subsequently drawn.
(depth = 1)
| 709 | * occlude anything subsequently drawn. |
| 710 | */ |
| 711 | clearDepth(depth = 1) { |
| 712 | if (!this.device || !this.depthTextureView) return; |
| 713 | this._finishActiveRenderPass(); |
| 714 | const commandEncoder = this.device.createCommandEncoder(); |
| 715 | |
| 716 | // Use framebuffer texture if active, otherwise use canvas texture |
| 717 | const activeFramebuffer = this.activeFramebuffer(); |
| 718 | |
| 719 | // Use framebuffer depth texture if active, otherwise use canvas depth texture |
| 720 | const depthTextureView = activeFramebuffer |
| 721 | ? (activeFramebuffer.aaDepthTexture |
| 722 | ? activeFramebuffer.aaDepthTextureView |
| 723 | : activeFramebuffer.depthTextureView) |
| 724 | : this.depthTextureView; |
| 725 | |
| 726 | if (!depthTextureView) { |
| 727 | // No depth buffer to clear |
| 728 | return; |
| 729 | } |
| 730 | |
| 731 | const depthAttachment = { |
| 732 | view: depthTextureView, |
| 733 | depthClearValue: depth, |
| 734 | depthLoadOp: 'clear', |
| 735 | depthStoreOp: 'store', |
| 736 | stencilLoadOp: 'load', |
| 737 | stencilStoreOp: 'store', |
| 738 | }; |
| 739 | |
| 740 | const renderPassDescriptor = { |
| 741 | colorAttachments: [], // No color attachments, we're only clearing depth |
| 742 | depthStencilAttachment: depthAttachment, |
| 743 | }; |
| 744 | |
| 745 | const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor); |
| 746 | passEncoder.end(); |
| 747 | |
| 748 | this._pendingCommandEncoders.push(commandEncoder.finish()); |
| 749 | this._hasPendingDraws = true; |
| 750 | } |
| 751 | |
| 752 | _prepareBuffer(renderBuffer, geometry, shader) { |
| 753 | const attr = shader.attributes[renderBuffer.attr]; |
nothing calls this directly
no test coverage detected