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.
color = vec4(127, 127, 128, 128);
I'm wondering whether texture2D has some different implement on Mali? How could I fix this problem?
Is it possible to share the complete shader which reproduces the problem? It's hard to work from fragments.
Also, which specific Mali GPU are you seeing the issue on?
Kind regards, Pete