https://bugs.freedesktop.org/show_bug.cgi?id=90887 Bug ID: 90887 Summary: PhiMovesPass in register allocator broken Product: Mesa Version: git Hardware: All OS: All Status: NEW Severity: normal Priority: medium Component: Drivers/DRI/nouveau Assignee: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Reporter: j-r-BGeptl67XyCzQB+pC5nmwQ@public.gmane.org QA Contact: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org Created attachment 116339 --> https://bugs.freedesktop.org/attachment.cgi?id=116339&action=edit Candidate Fix for nv50 PhiMovesPass The PhiMovesPass depends on strict correspondence between phi argument and incoming flow edge order. Unfortunately it destroys this correspondence itself in the needNewElseBlock case resulting in the wrong (potentially uninitialized) registers being copied. The attached patch fixes problems in the following games on NVA5 (Debian Jessie, wine git): Costume Quest (with FXAA option), Lifeless Planet, and Eidolon. These are not present when using the LLVMPIPE driver. I have analyzed the situation starting with Lifeless Planet (but simplifying the shader until I could handle the problem): the postprocessing shader modifies part of the rendered image with a shader like this 1. sample the vincinity of the current position 2. sample the current position 2. compute something based on all of these pixels 3. if some condition is reached 4. do some more computations (including TEXL) 5. replace current position value sampled above by computed value 6. return current position value or computed value (see if) The PhiMovesPass detects needNewElseBlock conditions and splits the 'else' edge incoming from the if thereby switching the order of incoming edges leading to adding copies from the sampled value to the if branch (discarding the computed values) and copies from the (unitialized) computed values to the new else block corrupting the result for all pixels except the ones where the condition is true (where it produces the originally sampled value). The fix slightly modifies the needNewElseBlock logic to not detach/attach the incoming edge. Costume Quest (with FXAA) and Eidolon look correct with this fix. Lifeless Planet is much better but still somewhat bad, but that may be intended (it looks similarly crappy with LLVMPIPE). The latter may also be a problem with wine). NB: This might be related to bug #90347. The shader code given there looks like it could trigger this case, but I haven't tried it. -- You are receiving this mail because: You are the QA Contact for the bug. You are the assignee for the bug.