Skip to content

Commit

Permalink
Update types; switch to GPUCanvasConfiguration viewFormats array (#3977)
Browse files Browse the repository at this point in the history
  • Loading branch information
beaufortfrancois authored Oct 4, 2024
1 parent b0bc9b2 commit 3cc9878
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 16 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 7 additions & 8 deletions src/webgpu/web_platform/canvas/configure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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');
});

Expand Down Expand Up @@ -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().
Expand Down

0 comments on commit 3cc9878

Please sign in to comment.