gpugpgpuglslesmali

Asymmetrical and inaccurate output from Mali-400MP GPU


I have the following simple fragment shader:

precision highp float;
main()
{
gl_FragColor = vec4(0.15, 0.15, 0.15, 0.15);
}

I'm rendering to texture using frame buffer object. When reading back values from the frame buffer I get the following:

38, 38, 38, 38, 39, 39, 39, 39,38, 38, 38, 38, 39 etc.

0.15*255 = 38.25 so I expect to get 38 uniformly for all pixels, which I do get on my desktop GPU (intel 4000) and on Tegra 3. I'll be glad if someone can shed some light on this issue. It is critical to anyone doing GPGPU for mobile devices as the Mali-400MP is used in Samsung Galaxi s2, s3 and s3 mini.


Solution

  • It looks like your output is being dithered, as in the error left over from one pixel is carried over to the next where it gets rounded up. Remember GL_DITHER is on by default in OpenGL, try doing a glDisable(GL_DITHER).