This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

a problem with texture2D on Mali gpu, opengl es 2.0

there is a common 4 channel per byte texture, used as an offset map. Which means, r and b channel act as x-axis offset, g and a channel act as y-axis offset. so I need to convert a float [-1, 1] into two bytes, and restore it somewhere after.

It works well on Qualcomm chipset but some noticeable error on Mali gpu, when restore float from bytes. Here is the shader. "offset" will be used to update gl_Position.

    vec4 color = texture2D(inputImageTexture2, inputTextureCoordinate);

    vec2 offset = (color.xy * 255.0 + color.zw) / 127.5 - 1.0;

If original float is 0, then r = 127, b = 128. I have make sure that each pixel writen on inputImageTexture2 is (127, 127, 128, 128). The excepted "offset" value here should be very closed to 0.

But on Mali gpu its value is too big to cause a noticeable movement. About 1 or 2 pixels, 1280*720.

On the other hand. If change shader like this, everything is OK.

    vec4 color = texture2D(inputImageTexture2, inputTextureCoordinate);

    color = vec4(127, 127, 128, 128);

    vec2 offset = (color.xy * 255.0 + color.zw) / 127.5 - 1.0;

I'm wondering whether texture2D has some different implement on Mali? How could I fix this problem?