Skip to content

r300: some cleanups and simplifications in vertex shaders

What does this MR do and why?

The cleanup here is the removal of most of the backend constant folding, however that unfortunately needs a custom NIR pass for R300/R400 to overcome some shortcomings of ntt (bool to float happens too late se we are not able to clean up after), it can go away once we get rid of ntt.

Additionally we stop allocating registers for vs in ntt, thus resulting in more ssa-like form and more optimization opportunities (- ~1% inst, but accompanied by similar regs increase). I was also hoping for some CPU-time reduction, however that did not happen. Due to how the backend dataflow analysis is working, while we save some time by skipping the ntt regalloc, the backend search for a readers now always walks through the whole shader (previously we would end when the original reg is overwritten which never happens with a ssa). The big picture is however that once we do this also for fs (the more difficult part yet to come), we don't have to keep the ntt regalloc (once we merge ntt) and more importantly, if we are careful to keep the ssa-like form from nir, we can get rid of register rename pass doing just that and hopefully even simplify the backend dataflow analysis.

The first and last patch is also sort of a bandaid for #8908 I'm not sure about the ultimate solution there yet, but this shoudl siginifcanty reduce the chance that some problems go unnoticed.

There is technically a regression in a debug builds where the new assert from the last commit would hit the glsl-vs-copy-propagation-1.shader_test. It was passing previously, but is failing now after a test change piglit!822 (merged) due to DCE issue #9279 (closed) and would assert after this series. The problem from #8908 was already there but we were lucky so the test was passing. We could also add just a debug warn, but users are not supposed to run with asserts anyway and I really want to have this as an assert (I'm hoping we can uncover more bugs like for the DCE here).

Edited by Pavel Ondračka

Merge request reports