fix(image-pipeline): apply wasm/webgl lint hygiene cleanups
This commit is contained in:
@@ -25,8 +25,8 @@ function assertWasmSimdRuntimeSupport(): void {
|
|||||||
throw new Error("WebAssembly SIMD is unavailable.");
|
throw new Error("WebAssembly SIMD is unavailable.");
|
||||||
}
|
}
|
||||||
|
|
||||||
const module = new WebAssembly.Module(WASM_SIMD_PROBE_MODULE);
|
const wasmModule = new WebAssembly.Module(WASM_SIMD_PROBE_MODULE);
|
||||||
void new WebAssembly.Instance(module);
|
void new WebAssembly.Instance(wasmModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadWasmKernelModule(): WasmKernelModule {
|
export function loadWasmKernelModule(): WasmKernelModule {
|
||||||
|
|||||||
@@ -326,13 +326,13 @@ describe("wasm backend fallback behavior", () => {
|
|||||||
vi.stubGlobal("SharedArrayBuffer", undefined);
|
vi.stubGlobal("SharedArrayBuffer", undefined);
|
||||||
vi.stubGlobal("Worker", undefined);
|
vi.stubGlobal("Worker", undefined);
|
||||||
|
|
||||||
const module: WasmKernelModule = {
|
const wasmModule: WasmKernelModule = {
|
||||||
applyPreviewStep: vi.fn(),
|
applyPreviewStep: vi.fn(),
|
||||||
applyFullPipeline: vi.fn(),
|
applyFullPipeline: vi.fn(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const backend = createWasmSimdBackend({
|
const backend = createWasmSimdBackend({
|
||||||
loadModule: () => module,
|
loadModule: () => wasmModule,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(() => {
|
expect(() => {
|
||||||
@@ -343,6 +343,6 @@ describe("wasm backend fallback behavior", () => {
|
|||||||
height: 1,
|
height: 1,
|
||||||
});
|
});
|
||||||
}).not.toThrow();
|
}).not.toThrow();
|
||||||
expect(module.applyPreviewStep).toHaveBeenCalledTimes(1);
|
expect(wasmModule.applyPreviewStep).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -380,8 +380,9 @@ describe("webgl backend poc", () => {
|
|||||||
height: 1,
|
height: 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
const sourceTexture = (fakeGl.createTexture as any).mock.results[0]?.value;
|
const createTextureMock = vi.mocked(fakeGl.createTexture);
|
||||||
const outputTexture = (fakeGl.createTexture as any).mock.results[1]?.value;
|
const sourceTexture = createTextureMock.mock.results[0]?.value;
|
||||||
|
const outputTexture = createTextureMock.mock.results[1]?.value;
|
||||||
expect(sourceTexture).toBeTruthy();
|
expect(sourceTexture).toBeTruthy();
|
||||||
expect(outputTexture).toBeTruthy();
|
expect(outputTexture).toBeTruthy();
|
||||||
|
|
||||||
@@ -393,9 +394,11 @@ describe("webgl backend poc", () => {
|
|||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
const bindTextureCalls = (fakeGl.bindTexture as any).mock.calls as Array<[number, unknown]>;
|
const bindTextureMock = vi.mocked(fakeGl.bindTexture);
|
||||||
const bindTextureOrder = (fakeGl.bindTexture as any).mock.invocationCallOrder as number[];
|
const drawArraysMock = vi.mocked(fakeGl.drawArrays);
|
||||||
const drawOrder = (fakeGl.drawArrays as any).mock.invocationCallOrder[0] as number;
|
const bindTextureCalls = bindTextureMock.mock.calls;
|
||||||
|
const bindTextureOrder = bindTextureMock.mock.invocationCallOrder;
|
||||||
|
const drawOrder = drawArraysMock.mock.invocationCallOrder[0] ?? Number.POSITIVE_INFINITY;
|
||||||
const lastBindBeforeDrawIndex = bindTextureOrder
|
const lastBindBeforeDrawIndex = bindTextureOrder
|
||||||
.map((callOrder, index) => ({ callOrder, index }))
|
.map((callOrder, index) => ({ callOrder, index }))
|
||||||
.filter(({ callOrder, index }) => callOrder < drawOrder && bindTextureCalls[index]?.[0] === fakeGl.TEXTURE_2D)
|
.filter(({ callOrder, index }) => callOrder < drawOrder && bindTextureCalls[index]?.[0] === fakeGl.TEXTURE_2D)
|
||||||
|
|||||||
Reference in New Issue
Block a user