Skip to content

Commit

Permalink
Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
beaufortfrancois committed Nov 4, 2024
1 parent b5c735a commit 5b2d7b4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 36 deletions.
28 changes: 26 additions & 2 deletions src/webgpu/api/operation/adapter/info.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export const description = `
Tests GPUAdapter.info members formatting.
Tests for GPUAdapterInfo.
`;

import { Fixture } from '../../../../common/framework/fixture.js';
import { makeTestGroup } from '../../../../common/framework/test_group.js';
import { getGPU } from '../../../../common/util/navigator_gpu.js';
import { assert } from '../../../../common/util/util.js';
import { assert, objectEquals } from '../../../../common/util/util.js';

export const g = makeTestGroup(Fixture);

Expand Down Expand Up @@ -39,3 +39,27 @@ g.test('adapter_info')
`adapterInfo.device should be a normalized identifier. But it's '${adapterInfo.device}'`
);
});

g.test('device_matches_adapter')
.desc(
`
Test that GPUDevice.adapterInfo matches GPUAdapter.info`
)
.fn(async t => {
const gpu = getGPU(t.rec);
const adapter = await gpu.requestAdapter();
assert(adapter !== null);

const device = await t.requestDeviceTracked(adapter);
assert(device !== null);

assert(device.adapterInfo instanceof GPUAdapterInfo);
assert(adapter.info instanceof GPUAdapterInfo);

for (const k of Object.keys(GPUAdapterInfo.prototype)) {
t.expect(
objectEquals(device.adapterInfo[k], adapter.info[k]),
`device.adapterInfo.${k} is "${device.adapterInfo[k]}". Expected "${adapter.info[k]}"`
);
}
});
34 changes: 0 additions & 34 deletions src/webgpu/api/operation/device/info.spec.ts

This file was deleted.

0 comments on commit 5b2d7b4

Please sign in to comment.