This little series is a first pass at implementing the VK_KHX_multiview extension. The basic method employed is to multiply the number of instances in each draw call by the number of views in the subpass. We then emit shader code to sort out the gl_InstanceId and gl_ViewIndex builtin variables. Properly computing gl_ViewIndex takes a bit of work because gl_InstanceId % bitcount(subpass->view_mask) is not quite the view index we want. We have to convert from this "compacted" view index to the actual view index by use of a remap table.
This implementation is good enough to get us going with the extension and passes the currently available CTS tests. However, it does not yet support input attachments. Jason Ekstrand (12): compiler: Add a system value and varying for ViewIndex spirv: Bump the SPIR-V header to the latest public version spirv: Add support for SPV_KHR_multiview anv/nir: Delete the apply_dynamic_offsets prototype anv: Add the KHX_multiview boilerplate anv/pass: Store the per-subpass view mask anv/pipeline: Call nir_gather_info later anv/pipeline: Add a subpass field to anv_pipeline anv/pipeline: Add shader lowering for multiview anv/cmd_buffer: Pull indirect draw parameter loading into a helper anv/cmd_buffer: Emit instanced draws for multiple views anv: Enable VK_KHX_multiview and SPV_KHR_multiview src/compiler/nir/nir.c | 4 + src/compiler/nir/nir_intrinsics.h | 1 + src/compiler/shader_enums.c | 2 + src/compiler/shader_enums.h | 4 + src/compiler/spirv/nir_spirv.h | 1 + src/compiler/spirv/spirv.h | 34 ++++- src/compiler/spirv/spirv_to_nir.c | 4 + src/compiler/spirv/vtn_variables.c | 4 + src/intel/Makefile.sources | 1 + src/intel/vulkan/anv_device.c | 23 ++- src/intel/vulkan/anv_entrypoints_gen.py | 1 + src/intel/vulkan/anv_nir.h | 5 +- src/intel/vulkan/anv_nir_lower_multiview.c | 235 +++++++++++++++++++++++++++++ src/intel/vulkan/anv_pass.c | 19 +++ src/intel/vulkan/anv_pipeline.c | 19 ++- src/intel/vulkan/anv_private.h | 9 ++ src/intel/vulkan/genX_cmd_buffer.c | 173 +++++++++++++++++++-- src/intel/vulkan/genX_pipeline.c | 10 +- 18 files changed, 521 insertions(+), 28 deletions(-) create mode 100644 src/intel/vulkan/anv_nir_lower_multiview.c -- 2.5.0.400.gff86faf _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev