()
| 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. |
nothing calls this directly
no test coverage detected