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

Method _clearFramebufferTextures

src/webgpu/p5.RendererWebGPU.js:3379–3421  ·  view source on GitHub ↗
(framebuffer)

Source from the content-addressed store, hash-verified

3377 }
3378
3379 _clearFramebufferTextures(framebuffer) {
3380 this._finishActiveRenderPass();
3381 const commandEncoder = this.device.createCommandEncoder();
3382
3383 // Clear the color texture (and multisampled texture if it exists)
3384 const colorAttachment = {
3385 view: framebuffer.aaColorTexture
3386 ? framebuffer.aaColorTextureView
3387 : framebuffer.colorTextureView,
3388 loadOp: "clear",
3389 storeOp: "store",
3390 clearValue: { r: 0, g: 0, b: 0, a: 0 },
3391 resolveTarget: framebuffer.aaColorTexture
3392 ? framebuffer.colorTextureView
3393 : undefined,
3394 };
3395
3396 // Clear the depth texture if it exists
3397 const depthTexture = framebuffer.aaDepthTexture || framebuffer.depthTexture;
3398 const depthStencilAttachment = depthTexture ? {
3399 view: framebuffer.aaDepthTexture
3400 ? framebuffer.aaDepthTextureView
3401 : framebuffer.depthTextureView,
3402 depthLoadOp: "clear",
3403 depthStoreOp: "store",
3404 depthClearValue: 1.0,
3405 stencilLoadOp: "clear",
3406 stencilStoreOp: "store",
3407 depthReadOnly: false,
3408 stencilReadOnly: false,
3409 } : undefined;
3410
3411 const renderPassDescriptor = {
3412 colorAttachments: [colorAttachment],
3413 depthStencilAttachment: depthStencilAttachment,
3414 };
3415
3416 const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor);
3417 passEncoder.end();
3418
3419 this._pendingCommandEncoders.push(commandEncoder.finish());
3420 this._hasPendingDraws = true;
3421 }
3422
3423 _getFramebufferColorTextureView(framebuffer) {
3424 if (framebuffer.colorTexture) {

Callers 1

Calls 4

endMethod · 0.80
finishMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected