Skip to content

queue.submit consumes command buffers #4659

@nical

Description

@nical

Description

queue.submit currently consumes and drop command buffers. I think that it makes sense for the rust API, however in WebGPU command buffers are only marked as invalid when submitted. It's a small detail but it means that wgpu_core can't drop the command buffers in submit, they have to be marked as invalid/destroyed and potentially used after submission in various API entry points (causing validation errors but not panics).

Two solutions:

  • Make wgpu match the spec and take command buffers by reference instead of by value in submit (implying they are marked invalid and not dropped).
  • Have wgpu_core optionally drop the handles (would be dropped when used throu wgpu, but not for direct users of wgpu_core such as gecko.

I am leaning on the latter since I think that it makes for a somewhat more idiomatic/nicer API for wgpu users although the implementation is more convoluted than doing the first solutions.

Thoughts ?

Repro steps

Running into double-destroyed command buffers in the CTS in firefox.

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