nir: Clean up metadata handling
In my quest to improve NIR function handling, metadata started getting in the way. In particular, the way we only call nir_metadata_preserve()
if the pass makes ensuring that progress makes it difficult to verify that metadata dirtying is happening properly. This series approaches this problem as follows:
- A couple misc. NIR fixes
- Make
nir_metadata_preserve
take the pass' progress Boolean as a parameter so the pass calls it every time regardless of progress. - Fix up a bunch of passes which weren't calling
nir_metadata_preserve()
properly. - Change
NIR_PASS()
andNIR_PASS_V()
to require thatnir_metadata_preserve()
is always called by the pass. - Fix a bunch of passes I found during the refactor in 2. which were doing their dirty tracking either wrong or at too coarse a granularity.
- Add infrastructure to
NIR_PASS()
andNIR_PASS_V()
to verify that, if a pass reports no progress, it does not modify the nir shader in any way. This is done by cloning before and then serializing the before and after shaders and comparing the serialized version.
Note to all NIR-based driver owners
This MR is likely to cause your driver to start assert failing if you have internal driver passes which are not updating metadata correctly. I've tried to fix things up as best as I can but without the ability to run those drivers, stuff is liable to break. Please provide patches to your drivers which I'll add to the series.