This rework has been on my ToDo list for a long time. The real crowning patch is patch 12 which makes us compute offsets to UBOs and SSBOs on the fly instead of waiting until we have the full access chain. In theory, we could do something similar for images and textures where we pass around the resource index instead using derefs.
Along with the change for UBOs and SSBOs are advances to the vtn type system which make it much easier to handle pointers. One example of this improvement is patch 18 where we rework function handling a bit. Before, we had a bunch of magic to make SSA and pointer parameters work. For SSA parameters, We would make everything pointers (because that's what they are in NIR) and then vtn_ssa_value would automatically do a load when called on a pointer value. Instead of that, we now handle the two cases explicitly so it's a lot more clear exactly what's going on. Jason Ekstrand (18): nir/spirv: Move a "}" nir/spirv: Use the type from the deref for atomics nir/spirv: Add a storage_class_to_mode helper nir/spirv: Split up Uniform and UniformConstant storage classes nir/spirv: Rename some things from access_chain to pointer nir/spirv: Wrap access chains in a new vtn_pointer data structure nir/spirv: Use the correct stride for non-32-bit vectors nir/spirv: Simplify matrix loads/stores nir/spirv: Remove unneeded parameters from pointer_to_offset nir/spirv: Break variable creation out into a helper nir/spirv: Rework the way pointers get dereferenced nir/spirv: Compute offsets for UBOs and SSBOs up-front nir/spirv: Simplify type copying nir/spirv: Compact vtn_type nir/spirv: Beef up the type system a bit nir/spirv: Stop using glsl_type for function types nir/spirv: Use real pointer types nir/spirv: Rework function argument setup src/compiler/spirv/spirv_to_nir.c | 230 ++++---- src/compiler/spirv/vtn_cfg.c | 84 +-- src/compiler/spirv/vtn_private.h | 175 ++++-- src/compiler/spirv/vtn_variables.c | 1085 ++++++++++++++++++++---------------- 4 files changed, 916 insertions(+), 658 deletions(-) -- 2.5.0.400.gff86faf _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev