nir: Add NIR debug passes and MESA_NIR_DBG env variable to enable them
The idea is to have a collection of NIR passes which would help in debugging of common issues with shaders.
Passes:
-
nir_dbg_init_undef
- initializes all undefined SSAs, currently initializes them to zero. Helps in debugging of visual corruptions. From me it would have been helpful for: #2286, https://bugs.freedesktop.org/show_bug.cgi?id=108179, maybe https://bugs.freedesktop.org/show_bug.cgi?id=111411, and some other many other cases which I don't remember. -
nir_dbg_restrain_loops
- adds upper bound to all loops (hardcoded at the moment to be 32 interations). Helps to find out if shader hangs due to some infinite loop.
CC: @jekstrand