https://bugs.freedesktop.org/show_bug.cgi?id=93594
--- Comment #10 from Marek Olšák maraeo@gmail.com --- (In reply to Michel Dänzer from comment #9)
Note that AFAIK using things like derivatives in non-uniform control flow isn't supported by GLSL. What's the original GLSL shader?
True.
The GLSL shader is using discard followed by fwidth. This is undefined behavior.
Therefore, it's an application bug.
The easy workaround would be to disable register allocation in st/mesa to get a quasi-SSA form and trivially move KILL_IF to the end of the shader if the app is detected to be Talos Principle.