MCPcopy Create free account
hub / github.com/processing/p5.js / _beginActiveRenderPass

Method _beginActiveRenderPass

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

Source from the content-addressed store, hash-verified

568 }
569
570 _beginActiveRenderPass() {
571 if (this.activeRenderPass) return;
572
573 // Use framebuffer texture if active, otherwise use canvas texture
574 const activeFramebuffer = this.activeFramebuffer();
575
576 const colorAttachment = {
577 view: activeFramebuffer
578 ? (activeFramebuffer.aaColorTexture
579 ? activeFramebuffer.aaColorTextureView
580 : activeFramebuffer.colorTextureView)
581 : this._getCanvasColorTextureView(),
582 loadOp: "load",
583 storeOp: "store",
584 // If using multisampled texture, resolve to non-multisampled texture
585 resolveTarget: activeFramebuffer && activeFramebuffer.aaColorTexture
586 ? activeFramebuffer.colorTextureView
587 : undefined,
588 };
589
590 // Use framebuffer depth texture if active, otherwise use canvas depth texture
591 const depthTextureView = activeFramebuffer
592 ? (activeFramebuffer.aaDepthTexture
593 ? activeFramebuffer.aaDepthTextureView
594 : activeFramebuffer.depthTextureView)
595 : this.depthTextureView;
596 const renderPassDescriptor = {
597 colorAttachments: [colorAttachment],
598 depthStencilAttachment: depthTextureView
599 ? {
600 view: depthTextureView,
601 depthLoadOp: "load",
602 depthStoreOp: "store",
603 depthClearValue: 1.0,
604 stencilLoadOp: "load",
605 stencilStoreOp: "store",
606 depthReadOnly: false,
607 stencilReadOnly: false,
608 }
609 : undefined,
610 };
611 const commandEncoder = this.device.createCommandEncoder();
612 const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor);
613 this.activeRenderPassEncoder = commandEncoder;
614 this.activeRenderPass = passEncoder;
615 }
616
617 _finishActiveRenderPass() {
618 if (!this.activeRenderPass) return;

Callers 1

_drawBuffersMethod · 0.95

Calls 2

activeFramebufferMethod · 0.80

Tested by

no test coverage detected