From d0e5e8356b5366b7a44ec0a2a497e57934622af9 Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Thu, 26 Oct 2023 19:34:35 +0900 Subject: [PATCH] remove `any` from samples --- src/sample/animometer/main.ts | 2 +- src/sample/bitonicSort/utils.ts | 20 ++++++++++---------- src/sample/computeBoids/main.ts | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/sample/animometer/main.ts b/src/sample/animometer/main.ts index b11d405c..1b92c07c 100644 --- a/src/sample/animometer/main.ts +++ b/src/sample/animometer/main.ts @@ -283,7 +283,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { const renderPassDescriptor = { colorAttachments: [ { - view: undefined as any, // Assigned later + view: undefined as GPUTextureView, // Assigned later clearValue: { r: 0.0, g: 0.0, b: 0.0, a: 1.0 }, loadOp: 'clear' as const, storeOp: 'store' as const, diff --git a/src/sample/bitonicSort/utils.ts b/src/sample/bitonicSort/utils.ts index fea2992f..86a42e01 100644 --- a/src/sample/bitonicSort/utils.ts +++ b/src/sample/bitonicSort/utils.ts @@ -38,11 +38,11 @@ export const createBindGroupDescriptor = ( ): BindGroupsObjectsAndLayout => { const layoutEntries: GPUBindGroupLayoutEntry[] = []; for (let i = 0; i < bindings.length; i++) { - const layoutEntry: any = {}; - layoutEntry.binding = bindings[i]; - layoutEntry.visibility = visibilities[i % visibilities.length]; - layoutEntry[resourceTypes[i]] = resourceLayouts[i]; - layoutEntries.push(layoutEntry); + layoutEntries.push({ + binding: bindings[i], + visibility: visibilities[i % visibilities.length], + [resourceTypes[i]]: resourceLayouts[i], + }); } const bindGroupLayout = device.createBindGroupLayout({ @@ -58,10 +58,10 @@ export const createBindGroupDescriptor = ( for (let i = 0; i < resources.length; i++) { const groupEntries: GPUBindGroupEntry[] = []; for (let j = 0; j < resources[0].length; j++) { - const groupEntry: any = {}; - groupEntry.binding = j; - groupEntry.resource = resources[i][j]; - groupEntries.push(groupEntry); + groupEntries.push({ + binding: j, + resource: resources[i][j], + }); } const newBindGroup = device.createBindGroup({ label: `${label}.bindGroup${i}`, @@ -137,7 +137,7 @@ export const SampleInitFactoryWebGPU = async ( export abstract class Base2DRendererClass { abstract switchBindGroup(name: string): void; - abstract startRun(commandEncoder: GPUCommandEncoder, ...args: any[]): void; + abstract startRun(commandEncoder: GPUCommandEncoder): void; renderPassDescriptor: GPURenderPassDescriptor; pipeline: GPURenderPipeline; bindGroupMap: Record; diff --git a/src/sample/computeBoids/main.ts b/src/sample/computeBoids/main.ts index ae8db740..4e8ee909 100644 --- a/src/sample/computeBoids/main.ts +++ b/src/sample/computeBoids/main.ts @@ -89,7 +89,7 @@ const init: SampleInit = async ({ canvas, pageState, gui }) => { const renderPassDescriptor = { colorAttachments: [ { - view: undefined as any, // Assigned later + view: undefined as GPUTextureView, // Assigned later clearValue: { r: 0.0, g: 0.0, b: 0.0, a: 1.0 }, loadOp: 'clear' as const, storeOp: 'store' as const,