Sitelet https://github.com/gpuweb/gpuweb/issues/1613
Skip to content

Use the same interface for both GPUAdapter features and GPUDevice features #1613

Description

@toji

From https://gpuweb.github.io/gpuweb/#issue-414eeb44

In #1098 GPUAdapter.features was converted to use a setlike interface in order to allow privacy budget tracking. GPUDevice.features doesn't need the same privacy budget monitoring, because it can only contain feature names that the developer explicitly reqested, but it may still be preferable from an ergonomics standpoint to use the same interface in both places.

As it stands today, you have an odd disconnected in how you access the two interfaces:

if(adapter.features.has("feature-name")) {
  // ...
}

if (device.features.indexOf("feature-name") != -1) {
  // ...
}

If we were to make both of these use the same interface, it would probably be a good idea to rename the interface from GPUAdapterFeatures to something more generic. The spec issue suggests GPUSupportedFeatures, which sounds fine to me.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions