Created attachment 96398 [details]
uses GLSL 1.30, has wrong graphincs color with Intel Sandybridge chipset.
game renders fine with Gallium Software renderer when launched with
environment variable from the terminal.
Mesa 10.2.0-devel (master branch)
Intel Sandybridge Mobile (device id: 0116)
Intel GMA 4500MHD (device id: 2a42) with export MESA_GLSL_VERSION_OVERRIDE=130
Created attachment 96399 [details]
Correct Rendering (rendered with Gallium llvmpipe)
Created attachment 96400 [details]
Incorrect Rendering (rendered with Mesa DRI Intel Sandybridge Mobile)
I have tested this bug and reproduced successfully in my Sandybridge laptop with git master Mesa.
Debugging the shaders (which are placed in media/shaders/ folder of the game), I found that the issue is inside postprocess.frag which does these two things among others:
1) It uses a simplification for the convolution which produces errors on the output which could be due to rounding errors. It produces the random pixel noise that can be seen clearly in the pitch and in the shadows.
2) It does a gamma correction which produced the color errors in the bottom half of the screen (which seems to be the part not affected by the fog algorithm).
So I did some changes to postprocess.frag shader to figure out which is the source of the problem:
1) I disabled the convolution by substituting this line:
vec3 fragColor = base * (1 - SSAO); // SSAO
by this line:
vec3 fragColor = base;
So the pixel noise disappeared which, at the end, allowed me to focus only in the color issue.
2) I disabled the gamma correction and I saw a good output. As GammaCorrection() is calling to the pow() function, I created my own pow function (called my_pow()) in order to compare both outputs.
I also modified the gamma correction value to be 2.0 to simplify my_pow() function because GammaCorrection() would end up being a simple sqrt(color) when choosing this specific gamma value.
So I compared two different cases:
* No convolution with original GammaCorrection() (pow()), gamma = 2.0.
* No convolution with modified GammaCorrection() (my_pow()), gamma = 2.0.
I found that the second case shows a proper output (attached image) while the first case it is showing the same ugly color output.
Furthermore, I tested on a NVIDIA graphics card with nouveau driver (Mesa 10.1) with the original (untouched) game and the game with both modifications. In all cases the output is fine, indicating that its GLSL's pow() function is well implemented.
I'm going to attach several files:
* Sandybridge output of each test case: no convolution, with original pow() and with my_pow() call in GammaCorrection().
* NVIDIA output of each test case: no convolution. With original pow() and with my_pow() call in GammaCorrection().
* The postprocessing fragment shader file with my modifications if you want to play with it, reproduce the error and understand what it's happening.
In summary, it seems that the error is present in the implementation of the GLSL's pow() function for Intel graphics.
I hope this information could help someone to fix this error. If you need more information or you don't understand something, please tell me so.
Created attachment 96538 [details]
Modified Postprocess.frag file
Created attachment 96539 [details]
SandyBridge no convolution, original pow()
Created attachment 96540 [details]
SandyBridge no convolution, my_pow()
Created attachment 96541 [details]
NVIDIA no convolution, original pow()
Created attachment 96542 [details]
NVIDIA no convolution, my_pow()
this bug also affects
Mesa DRI Intel(R) Haswell Desktop
Device id: 0412
-- GitLab Migration Automatic Message --
This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/1425.