MCPcopy
hub / github.com/processing/p5.js / _clearClipBuffer

Method _clearClipBuffer

src/webgpu/p5.RendererWebGPU.js:2664–2698  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2662 }
2663
2664 _clearClipBuffer() {
2665 this._finishActiveRenderPass();
2666 const commandEncoder = this.device.createCommandEncoder();
2667
2668 const activeFramebuffer = this.activeFramebuffer();
2669 const depthTextureView = activeFramebuffer
2670 ? (activeFramebuffer.aaDepthTexture
2671 ? activeFramebuffer.aaDepthTextureView
2672 : activeFramebuffer.depthTextureView)
2673 : this.depthTextureView;
2674
2675 if (!depthTextureView) {
2676 return;
2677 }
2678
2679 const depthStencilAttachment = {
2680 view: depthTextureView,
2681 stencilLoadOp: 'clear',
2682 stencilStoreOp: 'store',
2683 stencilClearValue: 1,
2684 depthReadOnly: true,
2685 stencilReadOnly: false,
2686 };
2687
2688 const renderPassDescriptor = {
2689 colorAttachments: [],
2690 depthStencilAttachment: depthStencilAttachment,
2691 };
2692
2693 const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor);
2694 passEncoder.end();
2695
2696 this._pendingCommandEncoders.push(commandEncoder.finish());
2697 this._hasPendingDraws = true;
2698 }
2699
2700 _applyStencilTestIfClipping() {
2701 // This is done via pipeline state in WebGL so this is a no-op

Callers

nothing calls this directly

Calls 5

activeFramebufferMethod · 0.80
endMethod · 0.80
finishMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected