KhronosGroup / SPIRV-Cross

SPIRV-Cross is a practical tool and library for performing reflection on SPIR-V and disassembling SPIR-V back to high level languages.
Apache License 2.0
1.96k stars 549 forks source link

MSL: Handle OpPtrAccessChain with ArrayStride #2346

Closed HansKristian-Work closed 1 week ago

HansKristian-Work commented 1 week ago

Case here is pointer to float3 with array stride of 12. Plain dereference will not work. To be more general, we can do pointer arith instead. For alignment, we have to cast the result to a packed_float3. All of this is rather awkward, but there aren't many great alternatives.

We're missing handling of Aligned mask for Load/Store, where we might have to cast a pointer to scalar types at last minute, which would make this reinterpret_cast chain even more ridiculous.

Fixes #2336.