[dawn][vk] Implement dynamic array BGLs

In Vulkan the equivalent concept to dynamic binding arrays are
descriptor arrays with all the VK_KHR_descriptor_indexing flags
enabled. The allocation strategy for the VkDescriptorSet needs to change
as the sets may have varying size even if used on the same layout. This
in turns requires a different, simpler version of the
DescriptorSetAllocator to be used.

In order to minimize the amount of additional branching that happens
because of the bindless path (which is cold, but static-only bindgroups
are perf critical), BindGroupLayoutVk is split into two subclasses that
dispatch to the regular DescriptorSetAllocator or a new
DescriptorSetAllocatorDynamicArray. (I tried 4 different approaches and
the current one seems to be the less disgusting one)

Changes in this CL are:

 - Remove logic in DescriptorSetAllocator to handle pool sizes of 0 as
   this is no longer a Vulkan error to do, and VVLs don't complain
   anymore.
 - Add DescriptorSetAllocatorDynamicArray that creates descriptor sets
   with variable counts and doesn't do any recycling or suballocation of
   the underlying VkDescriptorPool (apps should create few dynamic array
   bindgroups).
 - Split vulkan::BindGroupLayout into a base class and a child class for
   StaticBindingOnly.
 - Factor out the code that computes information related to static
   bindings into its own function.
 - Add a BindGroupLayoutDynamicArray that creates a
   VkDescriptorSetLayout with a variable count and uses
   DescriptorSetAllocatorDynamicArray.
 - In BindGroupLayoutInternalBase, decide that the dynamic array will
   directly follow the static bindings, and have separate getters that
   return either a BindingNumber or a BindingIndex.

This change can barely be tested on its own, but end2end tests with
BindGroup dynamic array creation in follow up CLs found a bunch of bugs
and will provide coverage.

Bug: 439522242
Change-Id: Ia24227aed66831caa4cb8d3bfe1407ed420fdca2
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/257774
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
9 files changed
tree: b3f722dcb150acb831433a28125e4b8d7a9a75ed
  1. .github/
  2. .vscode/
  3. build_overrides/
  4. docs/
  5. generator/
  6. include/
  7. infra/
  8. scripts/
  9. src/
  10. test/
  11. third_party/
  12. tools/
  13. webgpu-cts/
  14. .bazelrc
  15. .clang-format
  16. .clang-format-ignore
  17. .clang-tidy
  18. .git-blame-ignore-revs
  19. .gitattributes
  20. .gitignore
  21. .gitmodules
  22. .gn
  23. .style.yapf
  24. .vpython3
  25. AUTHORS
  26. BUILD.bazel
  27. BUILD.gn
  28. CMakeLists.txt
  29. CMakeSettings.json
  30. CODE_OF_CONDUCT.md
  31. codereview.settings
  32. CONTRIBUTING.md
  33. CPPLINT.cfg
  34. DEPS
  35. DIR_METADATA
  36. go.mod
  37. go.sum
  38. go_presubmit_support.py
  39. LICENSE
  40. OWNERS
  41. PRESUBMIT.py
  42. README.chromium
  43. README.md
  44. WATCHLISTS
  45. WORKSPACE.bazel
README.md

Build Status Matrix Space

Dawn, a WebGPU implementation

Dawn is an open-source and cross-platform implementation of the WebGPU standard. More precisely it implements webgpu.h that is a one-to-one mapping with the WebGPU IDL. Dawn is meant to be integrated as part of a larger system and is the underlying implementation of WebGPU in Chromium.

Dawn provides several WebGPU building blocks:

  • WebGPU C/C++ headers that applications and other building blocks use.
    • The webgpu.h version that Dawn implements.
    • A C++ wrapper for the webgpu.h.
  • A “native” implementation of WebGPU using platforms' GPU APIs: D3D12, Metal, Vulkan and OpenGL. See per API support for more details.
  • A client-server implementation of WebGPU for applications that are in a sandbox without access to native drivers
  • Tint is a compiler for the WebGPU Shader Language (WGSL) that can be used in standalone to convert shaders from and to WGSL.

Helpful links:

Documentation table of content

Developer documentation:

User documentation: (TODO, figure out what overlaps with the webgpu.h docs)

License

BSD 3-Clause License, please see LICENSE.

Disclaimer

This is not an officially supported Google product.