Skip to content

[meta] Draw-time validation #1907

Open
Open

Description

@kvark

Draw calls are the hottest operation in the API tight loops. It's highly desirable for WebGPU to minimize the overhead associated with them. Here are the things we either have to validate, or may need to validate, per draw:

  1. ensure that there is an active pipeline
  2. ensure the active bind groups have compatible layouts with the pipeline layout of the active pipeline
  3. check that index range is within the bound index buffer slice - Figure out whether indirectBuffer OOB is a validation error #1834
  4. check that vertex/instance range is within all of the relevant vertex buffer slices (some are per-vertex, some are per-instance).
  5. check the minimum binding sizes for buffer bindings, which weren't specified in bind group layout - Make minBufferBindingSize optional #874. For each such binding, we need to consider the size passed to bind group creation (for the active bind groups) and compare it with the shader requirements, reflected by the active pipeline.
  6. (not needed right now) check texture sample type and storage texture format - Case for optional GPUBindGroupLayoutEntry entries #851
  7. (rejected by the group) check all the intersections of writable buffer bindings (as well as writable storage textures) for fragment stage - Should the API enforce that writable storage buffer bindings don't alias each other? #1842

Activity

  1. Kangz commented on Jul 7, 2021

    @Kangz
    Contributor

    This list is kind of concerning. 4) 5) 6) and 7) are all variable-length checks too and much more expensive than 1-3 (dirty bits can help for 1) and 2)). 5) can be mitigated by the application, but 4) is always a variable-length computation with overflow checks etc and makes me sad. That's also part of why 6) and 7) look unattractive.

  2. litherum commented on Jul 12, 2021

    @litherum
    Contributor

    I’d really love to see measured costs here.

  3. added this to the post-V1 milestone on Jan 20, 2022
  4. kainino0x commented on Jan 20, 2022

    @kainino0x
    Contributor

    Meeting: Moving this meta bug to post-V1, but if there are particular validations that we want to discuss moving for V1 we should file them separately.

  5. kdashg commented on Jan 22, 2022

    @kdashg
    Contributor
    WGSL meeting minutes 2022-01-19
    • [meta] Draw-time validation #1907 draw time validation
      • KG: when do we want this implemented by?
      • MM: what are the exit criteria?
      • KN: it's essentially - can we move any of these out of draw time validation?
        • Which are expensive enough that we want to?
        • Probably could come up with a way to do this post-V1. Come up with new API for specifying things ahead of time.
      • KG: think we should mark this as post-V1, and if someone feels strongly, we can revisit it.
      • KN: agree we've probably talked about these enough that we're happy with them
      • MM: if anyone wants to move specific items, think they can do that - but for this specific one, nothing actionable in this timeframe.
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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions