Created attachment 101033 [details]
Ambient occlusion on Intel: enabled
Here is some screenshots of incorrect rendering in Planetary Annihilation. If AO enabled I get really weird behavior when move or zoom camera: shadow is moving all the time. It's working fine on R600g with same version of Mesa
Here is video on youtube:
I also will attach screenshots with correct (R600g, HD6950) and incorrect (i965, HD4600) rendering. I tested it on vanilla Ubuntu 14.04 drivers as well as Oibaf PPA.
GL trace using fairly recent build of APITrace (500MB unpacked):
Created attachment 101034 [details]
Ambient occlusion on Intel: disabled
Created attachment 101035 [details]
Ambient occlusion on R600g: enabled
Created attachment 101036 [details]
Ambient occlusion on R600g: disabled
I think I found the cause:
In sao_apply.fs random angle is calculated in the following way:
> ivec2 ssC = ivec2(gl_FragCoord.xy);
> float randomPatternRotationAngle = (3 * ssC.x ^ ssC.y + ssC.x * ssC.y) * 10;
This means that randomPatternRotationAngle will have huge values thus sin and cos may give quite imprecise values. It is precise enough on Radeon and Nvidia but not enough on Intel GPUs.
The documentation Volume 7: 3D-Media-GPGPU states:
> DirectX 10 and below Absolute error <= 0.0008 for the range of +/- 32767 * pi
> Outside of the above range the function will remain periodic,
> producing values between -1 and 1.
In practice passing values greater than 32767 * pi to cos or sin gives unusable output for most purposes (I'm not exactly sure if it is true for all Intel GPUs).
The easy fix will be calculating randomPatternRotationAngle like this:
> float randomPatternRotationAngle = mod(3 * ssC.x ^ ssC.y + ssC.x * ssC.y, 6.28318530718);
After the change there is no more artifacts.
To summarize, I think that is not a mesa issue. I notified http://support.uberent.com about it (#771156 ticket id in their internal system).