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

Method _accumulateMipLevel

src/webgpu/p5.RendererWebGPU.js:4092–4118  ·  view source on GitHub ↗
(framebuffer, mipmapData, mipLevel, width, height)

Source from the content-addressed store, hash-verified

4090 * Copy framebuffer content directly to WebGPU texture mip level
4091 */
4092 _accumulateMipLevel(framebuffer, mipmapData, mipLevel, width, height) {
4093 this.flushDraw();
4094 // Copy from framebuffer texture to the mip level
4095 const commandEncoder = this.device.createCommandEncoder();
4096
4097 // Get the underlying WebGPU texture from the framebuffer
4098 const sourceTexture = framebuffer.color.rawTexture().texture;
4099
4100 commandEncoder.copyTextureToTexture(
4101 {
4102 texture: sourceTexture,
4103 origin: { x: 0, y: 0, z: 0 },
4104 },
4105 {
4106 texture: mipmapData.gpuTexture,
4107 mipLevel: mipLevel,
4108 origin: { x: 0, y: 0, z: 0 },
4109 },
4110 {
4111 width: width,
4112 height: height,
4113 depthOrArrayLayers: 1,
4114 }
4115 );
4116
4117 this.device.queue.submit([commandEncoder.finish()]);
4118 }
4119
4120 /*
4121 * Create final MipmapTexture from WebGPU texture

Callers

nothing calls this directly

Calls 3

flushDrawMethod · 0.95
rawTextureMethod · 0.80
finishMethod · 0.80

Tested by

no test coverage detected