MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / uploadTexture

Function uploadTexture

e2e/webgpu-psnr.spec.ts:147–167  ·  view source on GitHub ↗
(
        texture: BrowserGpuTexture,
        width: number,
        height: number,
        pixels: Uint8Array
      )

Source from the content-addressed store, hash-verified

145 } = await import(psnrModulePath) as BrowserPsnrModule;
146
147 const uploadTexture = (
148 texture: BrowserGpuTexture,
149 width: number,
150 height: number,
151 pixels: Uint8Array
152 ) => {
153 const bytesPerRow = Math.ceil((width * 4) / 256) * 256;
154 const upload = new Uint8Array(bytesPerRow * height);
155 for (let y = 0; y < height; y++) {
156 upload.set(
157 pixels.subarray(y * width * 4, (y + 1) * width * 4),
158 y * bytesPerRow
159 );
160 }
161 device.queue.writeTexture(
162 { texture },
163 upload,
164 { bytesPerRow, rowsPerImage: height },
165 { width, height }
166 );
167 };
168
169 const runCase = async (
170 width: number,

Callers 2

runCaseFunction · 0.70
runTiledParityCaseFunction · 0.70

Calls 1

writeTextureMethod · 0.65

Tested by

no test coverage detected