MCPcopy Index your code
hub / github.com/processing/p5.js / _resetBuffersBeforeDraw

Method _resetBuffersBeforeDraw

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

Source from the content-addressed store, hash-verified

1338 }
1339
1340 _resetBuffersBeforeDraw() {
1341 this._finishActiveRenderPass();
1342
1343 // Set state to PENDING - we'll decide on first draw
1344 if (this._pInst.frameCount > 0) {
1345 this._frameState = FRAME_STATE.PENDING;
1346 }
1347
1348 // Clear depth buffer but DON'T start any render pass yet
1349 const activeFramebuffer = this.activeFramebuffer();
1350 const commandEncoder = this.device.createCommandEncoder();
1351
1352 const depthTextureView = activeFramebuffer
1353 ? (activeFramebuffer.aaDepthTexture
1354 ? activeFramebuffer.aaDepthTextureView
1355 : activeFramebuffer.depthTextureView)
1356 : this.depthTextureView;
1357
1358 if (depthTextureView) {
1359 const depthAttachment = {
1360 view: depthTextureView,
1361 depthClearValue: 1.0,
1362 depthLoadOp: 'clear',
1363 depthStoreOp: 'store',
1364 stencilLoadOp: 'load',
1365 stencilStoreOp: 'store',
1366 };
1367 const renderPassDescriptor = {
1368 colorAttachments: [],
1369 depthStencilAttachment: depthAttachment,
1370 };
1371 const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor);
1372 passEncoder.end();
1373 this._pendingCommandEncoders.push(commandEncoder.finish());
1374 this._hasPendingDraws = true;
1375 }
1376 }
1377
1378 /**
1379 * Promotes the current frame to use mainFramebuffer.

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