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

Method _updateSize

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

Source from the content-addressed store, hash-verified

535 }
536
537 _updateSize() {
538 if (!this.device || !this.depthFormat) return;
539 if (this.depthTexture && this.depthTexture.destroy) {
540 this.flushDraw();
541 const textureToDestroy = this.depthTexture;
542 this._postSubmitCallbacks.push(() => textureToDestroy.destroy());
543 this.depthTextureView = null;
544 }
545 this.depthTexture = this.device.createTexture({
546 size: {
547 width: Math.ceil(this.width * this._pixelDensity),
548 height: Math.ceil(this.height * this._pixelDensity),
549 depthOrArrayLayers: 1,
550 },
551 format: this.depthFormat,
552 usage: GPUTextureUsage.RENDER_ATTACHMENT | GPUTextureUsage.COPY_SRC,
553 });
554 this.depthTextureView = this.depthTexture.createView();
555
556 // Clear the main canvas after resize
557 this.clear();
558 }
559
560 _getCanvasColorTextureView() {
561 const canvasTexture = this.drawingContext.getCurrentTexture();

Callers 1

_initContextMethod · 0.95

Calls 4

flushDrawMethod · 0.95
clearMethod · 0.95
pushMethod · 0.45
createTextureMethod · 0.45

Tested by

no test coverage detected