gallivm/nir: Load all inputs into indirect inputs array
This should fix #9863 (closed).
The code in emit_load_var
that will attempt to read indirect inputs
expects the entire array of inputs to be there. So the reason the tests in the above issue
fail is because they generate indices in emit_load_var
that are out of bounds in bld->input_array
.
Additionally the code that populates bld->inputs_array
will populate the array using the count
of inputs_read
, without ensuring the inputs it copies map to the ones that are read.
This change populates bld->inputs_array
with the entire contents of bld->inputs
so indirect reads will always match up.
The code achieves this by storing the size of params->input
in a new parameter in struct lp_build_nir_soa_context
, and using this as the number of inputs, instead of counting the bits in the inputs read.
I'm pretty new to llvmpipe/lavapipe, so I'm not sure if this is the best way to fix this problem. One potential issue I see is that the original code seemed to have the intent to only populate inputs that are read into the indirect input array. But instead of actually doing that it used the number of inputs read and then iterates from 0 to inputs read to populate the indirect input array from inputs. If the code is actually trying to do this we would need some way to map from input indices to indices in the indirect access array. This change doesn't try to address this, so I'm open to feedback if you think this MR should try to address that problem.