freedreno/ir3: fix indirect cb0 load_ubo lowering
authorRob Clark <robdclark@chromium.org>
Thu, 7 May 2020 20:24:46 +0000 (13:24 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 12 May 2020 23:51:46 +0000 (23:51 +0000)
commitd69f6fd8529b1dcefa443a8cb31bd362bb64a28c
tree6e98cef4ab054c59b27edae2ab7f75a58a5f5416
parentc4dc877cb5df63a6a86013e32695f72c604625ad
freedreno/ir3: fix indirect cb0 load_ubo lowering

We can no longer assume that `state->ranges[0]` is block 0.  It *often*
is, but when we encounter a "real" ubo that we lower to `load_uniform`
before a block 0 `load_ubo`, it could end up another entry in the table.
Resulting in the second pass after gathering ubo ranges, not finding a
valid range.  Which results in a `load_ubo` for a thing that is not
actually a ubo making it's way into ir3 frontend.  Resulting in grabbing
what we think is a ubo address out of some unrelated const register, and
trying to dereference that.  Which as you can imagine, fails in amusing
ways.

Fixes: fc850080ee3 ("ir3: Rewrite UBO push analysis to support bindless")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4954>
src/freedreno/ir3/ir3_nir_analyze_ubo_ranges.c