这是indexloc提供的服务,不要输入任何密码
Skip to content

Synchronously query GPUAdapterInfo #4536

@kainino0x

Description

@kainino0x

Right now it is only possible to get GPUAdapterInfo by calling requestAdapterInfo, which is async.
However, in #4316 we removed the possibility that it would trigger a permission prompt, and I think we should consider it a breaking change to add a prompt - that is, we shouldn't do it (see #3962).

Because of this I don't think there is any reason that requestAdapterInfo as it exists today should be async:

  • It's easy to prefetch this info along with the adapter - no reason for a round trip.
    • Unless browsers need to keep fingerprintable (but not otherwise secure or private) data out of the content process?
  • Any dynamic measurement or modulation of the adapter info, done by the browser, does not need to be async: GPUAdapterInfo has 4 separate getters that can do that stuff. (In fact, this is already necessary: browsers shouldn't assume that just calling requestAdapterInfo gives the page everything in the GPUAdapterInfo struct. They don't get it until they access the properties.)
  • If we make requestAdapterInfo actually do anything extra (like via a flag that says "please give me everything you're willing to give me with a permission prompt"), the synchronously accessed GPUAdapterInfo can dynamically update to provide that data.

Strawperson proposal:

  • Add a [SameObject] readonly attribute GPUAdapterInfo info; to GPUAdapter.
  • It returns the same JS object every time you access it.
  • requestAdapterInfo still returns a new one each time for minor backward-compatibility reasons (unless we think it's better to change this and return the same one as adapter.info).
  • If the info available to the page changes, the attributes on the GPUAdapterInfo object start returning different values (like an empty string gets changed to a non-empty string).

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiWebGPU APIpotentially breakingCould require a breaking change to the API

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions