diff options
author | Kenneth Graunke <[email protected]> | 2015-03-30 16:09:51 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-04-01 13:30:13 -0700 |
commit | 25e214db0094306835a03225e1a37164c7c98bf7 (patch) | |
tree | eff4c1dcf366e15d83abf49279dc48a75236b874 | |
parent | 3d166b313db14523c2e618e0ebf22b83c86d6334 (diff) |
nir: Use _mesa_flsll(InputsRead) in prog->nir.
InputsRead is a 64-bit bitfield. Using _mesa_fls would silently
truncate off the high bits, claiming inputs 32..56 (VARYING_SLOT_MAX)
were never read.
Using <= here was a hack I threw in at the last minute to fix programs
which happened to use input slot 32. Switch back to using < now that
the underlying problem is fixed.
Fixes crashes in "Euro Truck Simulator 2" when using prog->nir, which
uses input slot 33.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
-rw-r--r-- | src/mesa/program/prog_to_nir.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c index 4e210d190de..5f00a8b2fd0 100644 --- a/src/mesa/program/prog_to_nir.c +++ b/src/mesa/program/prog_to_nir.c @@ -931,8 +931,8 @@ setup_registers_and_variables(struct ptn_compile *c) struct nir_shader *shader = b->shader; /* Create input variables. */ - const int last_input = _mesa_fls(c->prog->InputsRead); - for (int i = 0; i <= last_input; i++) { + const int num_inputs = _mesa_flsll(c->prog->InputsRead); + for (int i = 0; i < num_inputs; i++) { if (!(c->prog->InputsRead & BITFIELD64_BIT(i))) continue; nir_variable *var = rzalloc(shader, nir_variable); |