diff --git a/src/webgpu/api/operation/memory_sync/buffer/buffer_sync_test.ts b/src/webgpu/api/operation/memory_sync/buffer/buffer_sync_test.ts index e18dc59abf2e..6dda4b7205d9 100644 --- a/src/webgpu/api/operation/memory_sync/buffer/buffer_sync_test.ts +++ b/src/webgpu/api/operation/memory_sync/buffer/buffer_sync_test.ts @@ -285,6 +285,7 @@ export class BufferSyncTest extends GPUTest { // Create a 1x1 texture, and initialize it to a specified value for all elements. async createTextureWithValue(initValue: number): Promise { + // This is not hot in profiles; optimize if this gets used more heavily. const data = new Uint32Array(1).fill(initValue); const texture = this.trackForCleanup( this.device.createTexture({ @@ -446,6 +447,7 @@ export class BufferSyncTest extends GPUTest { // Write buffer via writeBuffer API on queue writeByWriteBuffer(buffer: GPUBuffer, value: number) { + // This is not hot in profiles; optimize if this gets used more heavily. const data = new Uint32Array(1).fill(value); this.device.queue.writeBuffer(buffer, 0, data); } @@ -919,12 +921,14 @@ export class BufferSyncTest extends GPUTest { } verifyData(buffer: GPUBuffer, expectedValue: number) { + // This is not hot in profiles; optimize if this gets used more heavily. const bufferData = new Uint32Array(1); bufferData[0] = expectedValue; this.expectGPUBufferValuesEqual(buffer, bufferData); } verifyDataTwoValidValues(buffer: GPUBuffer, expectedValue1: number, expectedValue2: number) { + // This is not hot in profiles; optimize if this gets used more heavily. const bufferData1 = new Uint32Array(1); bufferData1[0] = expectedValue1; const bufferData2 = new Uint32Array(1); diff --git a/src/webgpu/web_platform/reftests/canvas_colorspace.html.ts b/src/webgpu/web_platform/reftests/canvas_colorspace.html.ts index d4b5b24e1e82..3a763e8c28b3 100644 --- a/src/webgpu/web_platform/reftests/canvas_colorspace.html.ts +++ b/src/webgpu/web_platform/reftests/canvas_colorspace.html.ts @@ -5,6 +5,7 @@ import { kCanvasAlphaModes, kCanvasColorSpaces } from '../../capability_info.js' import { runRefTest } from './gpu_ref_test.js'; function bgra8UnormFromRgba8Unorm(rgba8Unorm: Uint8Array) { + // This is used only once. May need to optimize if reused. const bgra8Unorm = rgba8Unorm.slice(); for (let i = 0; i < bgra8Unorm.length; i += 4) { [bgra8Unorm[i], bgra8Unorm[i + 2]] = [bgra8Unorm[i + 2], bgra8Unorm[i]]; @@ -13,6 +14,7 @@ function bgra8UnormFromRgba8Unorm(rgba8Unorm: Uint8Array) { } function rgba16floatFromRgba8unorm(rgba8Unorm: Uint8Array) { + // This is used only once. May need to optimize if reused. const rgba16Float = new Float16Array(rgba8Unorm.length); for (let i = 0; i < rgba8Unorm.length; ++i) { rgba16Float[i] = rgba8Unorm[i] / 255; diff --git a/src/webgpu/web_platform/reftests/canvas_complex.html.ts b/src/webgpu/web_platform/reftests/canvas_complex.html.ts index a8da9cb5b36d..2c17be88754e 100644 --- a/src/webgpu/web_platform/reftests/canvas_complex.html.ts +++ b/src/webgpu/web_platform/reftests/canvas_complex.html.ts @@ -55,6 +55,7 @@ export function run( size: rows * bytesPerRow, usage: GPUBufferUsage.COPY_SRC, }); + // These are run only once per test, so there are no wasted reallocations below. let red: Uint8Array | Uint16Array; let green: Uint8Array | Uint16Array; let blue: Uint8Array | Uint16Array;