spirv: Fix stride calculation when lowering Workgroup to offsets
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Wed, 3 Jul 2019 19:47:53 +0000 (12:47 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Mon, 15 Jul 2019 23:18:46 +0000 (16:18 -0700)
commit026cfa10995ff3316476fa19507fa27adc531de5
tree52086d86b7c0e83471b94a90140bdc29dd1a4f10
parent329799257b6a44aaeabee200664e2bb552f473fe
spirv: Fix stride calculation when lowering Workgroup to offsets

Use alignment to calculate the stride associated with the pointer
types.  That stride is used when the pointers are casted to arrays.

Note that size alone is not sufficient, e.g. struct { vec2 a; vec1 b;
} will have element an element size of 12 bytes, but the stride needs
to be 16 bytes to respect the 8 byte alignment.

Fixes: 050eb6389a8 "spirv: Ignore ArrayStride in OpPtrAccessChain for Workgroup"
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/spirv/spirv_to_nir.c