Skip to content

CTS expects wrong result of mapAsync on invalid buffer #4708

Description

@sagudev

On invalid buffer CTS expects:

{ validationError: true, earlyRejection: false, rejectName: 'OperationError' },

and both firefox and chromium pass it, but spec says we should return abort and no validation error:

  1. If any of the following conditions are unsatisfied:

    this must be valid.

    Set deviceLost to true.

    Issue the map failure steps on contentTimeline.
    Return.

If deviceLost:

Reject p with an AbortError.

This might also be spec issue as introduction PR of spec text talks about device loss, but here it's actually buffer invalidity part of code: gpuweb/gpuweb#5114 (this is buffer not device).

Activity

  1. sagudev commented on Sep 24, 2026

    @sagudev
    CollaboratorAuthor
  2. kainino0x commented on Sep 25, 2026

    @kainino0x
    Collaborator

    I think this is a spec typo, and it was meant to say this.[[device]] must be valid.

    Right now, the spec says "if buffer is invalid, set deviceLost=true", which doesn't make any sense.

  3. sagudev commented on Sep 25, 2026

    @sagudev
    CollaboratorAuthor

    But we should still be check buffer validity, no?

    EDIT: Usually we do https://www.w3.org/TR/webgpu/#abstract-opdef-valid-to-use-with, but maybe we want separate errors for device invalid vs. buffer invalid

  4. sagudev commented on Sep 25, 2026

    @sagudev
    CollaboratorAuthor

    there also does not seem to be any test for mapAsnyc on destroyed device

  5. kainino0x commented on Sep 25, 2026

    @kainino0x
    Collaborator

    But we should still be check buffer validity, no?

    Ah yes, true... probably accidentally missed that because the this must be valid of course makes it look like it is checked. It could also be the case that at some point I thought this.[[internal state]] is "available" requirement would check that. It doesn't, though.

    there also does not seem to be any test for mapAsnyc on destroyed device

    Offhand I'm not sure, but you're probably right.

  6. sagudev commented on Sep 26, 2026

    @sagudev
    CollaboratorAuthor

    I prepared spec update gpuweb/gpuweb#10971 which raise AbortError (deviceLost=true) when device is invalid (lost) and raise OperationError on invalid buffer (in that order) as I think that was the original intention. Based on new CTS test this also matches the behavior of dawn.

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