diff options
author | Jason Ekstrand <[email protected]> | 2017-11-30 16:55:45 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-12-05 22:01:54 -0800 |
commit | 93b4cb61eb2a16794d5f4a2f55a70cdcd8a5d521 (patch) | |
tree | 7239b37229dde209befeb98431e90290e2d143c8 /src/compiler/spirv/vtn_alu.c | |
parent | 32c859125b916c24ab76bd52db6e37a1a22f4858 (diff) |
spirv: Allow OpPtrAccessChain for block indices
The SPIR-V spec is a bit underspecified when it comes to exactly how
you're allowed to use OpPtrAccessChain and what it means in certain edge
cases. In particular, what if the base pointer of the OpPtrAccessChain
points to the base struct of an SSBO instead of an element in that SSBO.
The original variable pointers implementation in mesa assumed that you
weren't allowed to do an OpPtrAccessChain that adjusted the block index
and asserted such. However, there are some CTS tests that do this and,
if the CTS does it, someone will do it in the wild so we should probably
handle it. With this commit, we significantly reduce our assumptions
and should be able to handle more-or-less anything.
The one assumption we still make for correctness is that if we see an
OpPtrAccessChain on a pointer to a struct decorated block that the block
index should be adjusted. In theory, someone could try to put an array
stride on such a pointer and try to make the SSBO an implicit array of
the base struct and we would not give them what they want. That said,
any index other than 0 would count as an out-of-bounds access which is
invalid.
Reviewed-by: Kristian H. Kristensen <[email protected]>
Diffstat (limited to 'src/compiler/spirv/vtn_alu.c')
0 files changed, 0 insertions, 0 deletions