Skip to content

Extern definitions for WebGPU #4145

Open

Description

@kainino0x

Closure doesn't yet have extern definitions for WebGPU.
Over in Emscripten, we are finally switching to externs instead of doing ["this"] everywhere (except everywhere we forgot and so it's broken).
emscripten-core/emscripten#21144

There you can see some barebones externs I generated from the WebGPU spec's WebIDL. I think it's enough for minification to work correctly(?) but it doesn't provide much else - no function arguments, in particular.

Would there be interest in bringing this into Closure as-is, or would it need more complete definitions?

Activity

  1. frigus02 commented on Jan 24, 2024

    @frigus02
    Contributor

    Link for easy reference: https://github.com/emscripten-core/emscripten/blob/fb4bdc78cf3b99d634838418882f199e18309a5c/src/closure-externs/webgpu-externs.js

    Thanks for the offer. On first glance I'd say they look nice. I'm going to check with the team if we want to include them as is.

  2. kainino0x commented on Jan 24, 2024

    @kainino0x
    MemberAuthor

    If it helps, both Safari and Firefox have made strong signals about the API - Chrome shipped with positive signals from other browsers (the only caveat being that they hadn't/haven't finished implementing).
    Firefox has had it on Nightly for a while (not yet shipping to stable): https://developer.mozilla.org/en-US/docs/Web/API/WebGPU_API#browser_compatibility
    Safari recently enabled it behind a flag in Safari Technology Preview: https://www.webkit.org/blog/14885/release-notes-for-safari-technology-preview-185/

  3. frigus02 commented on Jan 25, 2024

    @frigus02
    Contributor

    We talked internally. We'd rather not include the externs with JSCompiler by default, yet, because the API is currently only live Chrome.

    Related: We're also thinking about generating externs using tsickle from TypeScript typings. That way we'd get better about adding new browser APIs to externs. But at the same time we'd only get them once at least 2 browser engines implement them, since that seems to be TS' policy.

    I hope that makes sense. I'd kinda like to keep the issue open, though. We do need to add WebGPU externs eventually.

  4. kainino0x commented on Jan 25, 2024

    @kainino0x
    MemberAuthor

    Sounds good! We're happy to use our own externs in Emscripten for now. Hopefully if anyone is searching they'll find this issue and be able to copy them.

    We're currently maintaining TypeScript types for WebGPU outside of upstream TypeScript: https://github.com/gpuweb/types
    We've considered pushing to get them upstream, but since we're currently maintaining extra features over what TypeScript's generated types would look like (documentation pulled from the WebGPU spec, and some extra strictness), there hasn't been much pressure. And I'm sure TypeScript will add them themselves once it reaches whatever their threshold is.

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