From 3cc9878acc0817cd93f53bcc35f389180496007f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Fri, 4 Oct 2024 03:15:04 +0200 Subject: [PATCH] Update types; switch to GPUCanvasConfiguration viewFormats array (#3977) --- package-lock.json | 14 +++++++------- package.json | 2 +- src/webgpu/web_platform/canvas/configure.spec.ts | 15 +++++++-------- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/package-lock.json b/package-lock.json index 368b20fce60d..bbf76cf1c524 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "@types/w3c-image-capture": "^1.0.10", "@typescript-eslint/eslint-plugin": "^6.9.1", "@typescript-eslint/parser": "^6.9.1", - "@webgpu/types": "^0.1.47", + "@webgpu/types": "^0.1.48", "ansi-colors": "4.1.3", "babel-plugin-add-header-comment": "^1.0.3", "babel-plugin-const-enum": "^1.2.0", @@ -1539,9 +1539,9 @@ "dev": true }, "node_modules/@webgpu/types": { - "version": "0.1.47", - "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.47.tgz", - "integrity": "sha512-vOUHDxj0azl7BSj4YAy6cc6q5s7F1KfF5GI1er/w6togN0MqzS/d8U+H0LH1XpLbFup+UaA7aMtia/aSx3DE0w==", + "version": "0.1.48", + "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.48.tgz", + "integrity": "sha512-e3zmDEPih4Rle+JrP5cT8nCCtDizoUpEaN72OuD1clbhXGERtn0wwuMdxOrBymu3kMLWKDd8hd+ERhSheLuLTg==", "dev": true, "license": "BSD-3-Clause" }, @@ -10077,9 +10077,9 @@ "dev": true }, "@webgpu/types": { - "version": "0.1.47", - "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.47.tgz", - "integrity": "sha512-vOUHDxj0azl7BSj4YAy6cc6q5s7F1KfF5GI1er/w6togN0MqzS/d8U+H0LH1XpLbFup+UaA7aMtia/aSx3DE0w==", + "version": "0.1.48", + "resolved": "https://registry.npmjs.org/@webgpu/types/-/types-0.1.48.tgz", + "integrity": "sha512-e3zmDEPih4Rle+JrP5cT8nCCtDizoUpEaN72OuD1clbhXGERtn0wwuMdxOrBymu3kMLWKDd8hd+ERhSheLuLTg==", "dev": true }, "abbrev": { diff --git a/package.json b/package.json index 321dabb3891f..a734cc0600fc 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "@types/w3c-image-capture": "^1.0.10", "@typescript-eslint/eslint-plugin": "^6.9.1", "@typescript-eslint/parser": "^6.9.1", - "@webgpu/types": "^0.1.47", + "@webgpu/types": "^0.1.48", "ansi-colors": "4.1.3", "babel-plugin-add-header-comment": "^1.0.3", "babel-plugin-const-enum": "^1.2.0", diff --git a/src/webgpu/web_platform/canvas/configure.spec.ts b/src/webgpu/web_platform/canvas/configure.spec.ts index 7ac98e23b158..47c13e5eed28 100644 --- a/src/webgpu/web_platform/canvas/configure.spec.ts +++ b/src/webgpu/web_platform/canvas/configure.spec.ts @@ -47,9 +47,9 @@ g.test('defaults') t.expect(configuration.device === t.device); t.expect(configuration.format === 'rgba8unorm'); t.expect(configuration.usage === GPUTextureUsage.RENDER_ATTACHMENT); - t.expect((configuration.viewFormats as GPUTextureFormat[]).length === 0); + t.expect(configuration.viewFormats.length === 0); t.expect(configuration.colorSpace === 'srgb'); - t.expect(configuration.toneMapping!.mode === 'standard'); + t.expect(configuration.toneMapping.mode === 'standard'); t.expect(configuration.alphaMode === 'opaque'); const currentTexture = ctx.getCurrentTexture(); @@ -107,9 +107,9 @@ g.test('device') t.expect(configuration.device === t.device); t.expect(configuration.format === 'rgba8unorm'); t.expect(configuration.usage === GPUTextureUsage.RENDER_ATTACHMENT); - t.expect((configuration.viewFormats as GPUTextureFormat[]).length === 0); + t.expect(configuration.viewFormats.length === 0); t.expect(configuration.colorSpace === 'srgb'); - t.expect(configuration.toneMapping!.mode === 'standard'); + t.expect(configuration.toneMapping.mode === 'standard'); t.expect(configuration.alphaMode === 'opaque'); // getCurrentTexture will succeed with a valid device. @@ -138,9 +138,9 @@ g.test('device') t.expect(newConfiguration.device === t.device); t.expect(newConfiguration.format === 'rgba8unorm'); t.expect(newConfiguration.usage === GPUTextureUsage.RENDER_ATTACHMENT); - t.expect((newConfiguration.viewFormats as GPUTextureFormat[]).length === 0); + t.expect(newConfiguration.viewFormats.length === 0); t.expect(newConfiguration.colorSpace === 'srgb'); - t.expect(newConfiguration.toneMapping!.mode === 'standard'); + t.expect(newConfiguration.toneMapping.mode === 'standard'); t.expect(newConfiguration.alphaMode === 'premultiplied'); }); @@ -461,8 +461,7 @@ g.test('viewFormats') }); }, !compatible); - const viewFormats = ctx.getConfiguration()!.viewFormats!; - assert(Array.isArray(viewFormats)); + const viewFormats = ctx.getConfiguration()!.viewFormats; t.expect(viewFormats[0] === viewFormat); // Likewise for getCurrentTexture().