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

Method _returnVertexBuffersToPool

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

Source from the content-addressed store, hash-verified

1558 }
1559
1560 _returnVertexBuffersToPool() {
1561 // Return buffers marked for return back to their pools for all registered geometries
1562 for (const geometry of this._geometriesWithPools) {
1563 if (geometry._vertexBuffersToReturn) {
1564 for (const [dst, buffersToReturn] of Object.entries(geometry._vertexBuffersToReturn)) {
1565 if (buffersToReturn.length > 0) {
1566 // Move all buffers from ToReturn back to pool
1567 const pool = geometry._vertexBufferPools[dst] || [];
1568 while (buffersToReturn.length > 0) {
1569 const bufferInfo = buffersToReturn.pop();
1570 // Clear the data copy reference to prevent memory leaks
1571 bufferInfo.dataCopy = null;
1572 pool.push(bufferInfo);
1573 }
1574 geometry._vertexBufferPools[dst] = pool;
1575 }
1576 }
1577 }
1578 }
1579 }
1580
1581 // Called when geometry is reset - mark its buffers for return
1582 onReset(geometry) {

Callers 1

finishDrawMethod · 0.95

Calls 2

popMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected