Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update requestDevice:always_return_device #4292

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/webgpu/api/operation/adapter/requestDevice.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -518,18 +518,12 @@ g.test('always_returns_device')
const device = await t.requestDeviceTracked(adapter);
assert(device instanceof GPUDevice, 'requestDevice must return a device or throw');

if (featureLevel === 'core') {
if (featureLevel === 'core' && adapter.features.has('core-features-and-limits')) {
// Check if the device supports core, when featureLevel is core and adapter supports core.
// This check is to make sure something lower-level is not forcing compatibility mode.

// MAINTENANCE_TODO: Simplify this check (and typecast) once we standardize how to do this.
const adapterExtensions = adapter as unknown as {
featureLevel?: string;
};
t.expect(
// Old version of Compat design.
adapterExtensions.featureLevel === 'core' ||
// Current version of Compat design.
device.features.has('core-features-and-limits'),
device.features.has('core-features-and-limits'),
'must not get a Compatibility adapter if not requested'
);
}
Expand Down