Shaders coming from dx10 state trackers have a RET before the END. And the epilog needs to be placed before the RET (otherwise it will get ignored). Hence figure out if a RET is in main, in this case we'll place the epilog there rather than before the END. (At a closer look, there actually seem to be problems with control flow in general with output redirection, that would need another look. It's enough however to fix draw's aa line emulation in some internal bug - lines tend to be drawn with trivial shaders, moving either a constant color or a vertex color directly to the output).
v2: add assert so buggy handling of RET in main is detected
f6718baabc tgsi: Recognize RET in main for tgsi_transform
src/gallium/auxiliary/tgsi/tgsi_transform.c | 62 +++++++++++++++++++++++++----
1 file changed, 55 insertions(+), 7 deletions(-)