Skip to content

anv: Implement VK_EXT_descriptor_indexing and friends

Faith Ekstrand requested to merge gfxstrand/mesa:review/anv-a64-ssbo into master

This merge request is trying to push ANV in a more modern direction. Whereas most other drivers have abandon binding tables in favour of descriptor buffers, we've been holding on to binding tables like our lives depended on it. This MR attempts to start moving us into the future. There are a lot of pieces:

  • Add a BO to the side of each descriptor set
  • Add descriptor BO support for push descriptors and re-enable push descriptors
  • Move the image param data into the descriptor BO. This means more pulling in compute shaders on gen8 and earlier but it means push space is no longer a constraint on the number of images we can have.
    • (Optional) Increase the max image count on gen8+
  • Switch SSBOs over to pushing a GPU address + size and using A64 messages in the shader to directly access the GPU address. This only works if we have softpin because I really didn't want to try put relocations in descriptor buffers.
  • (Optional) Switch UBOs over to using A64 messages and 48-bit GPU addresses. Should be reasonably easy but we want to make sure that we can still use the dual OWORD block read messages when the offset from the base address is constant.
  • Switch texturing over to pushing a pair of 32-bit bindless texture/sampler handles and using those in the shader. Bindless texturing requires SKL+ but bindless samplers just use the old Ivy Bridge. The only reason why I've restricted it to gen8+ is because I was lazy and didn't want to implement it in vec4.
  • Switch storage images over to bindless handles. This should be easy in theory but the back-end compiler plumbing is rather annoying.
  • Come up with a good algorithm in anv_nir_apply_pipeline_layout to choose when to use a bindless method and when to continue using the binding table.
  • Figure out how to handle residency in an update-after-bind world.

The end result is a driver that supports almost arbitrarily large descriptor sets. We can still fall back to binding tables when we can so that we don't have to do extra shader arithmetic, manual bounds-checking, and that sort of garbage all the time. This graceful fall-back also means that we can relatively easily handle bindless on SKL+ where it's fully supported but neatly fall back to 100% bindful on older platforms. On BDW, we get bindless for SSBOs because it does support the A64 stateful messages.

Along the way, these will let us implement a few new extensions:

  • VK_KHR_shader_atomic_int64 (requires A64 SSBO support)
  • VK_EXT_inline_uniform_block (requires descriptor BO support)
  • VK_EXT_descriptor_indexing (requires everything above and more)
Edited by Faith Ekstrand

Merge request reports

Loading