Thanks to popcornmix, we found that the if statement dependence was due to optimization in the shader, and the reason for the hanging was a for-loop in the shader which doesn't work nicely with the pi's legacy driver i.e. the shader is too complex. More details https://github.com/raspberrypi/userlan...