Shader performance drops drastically after a while

Shader performance drops drastically after a while
0.0 0



I am trying to use a very simple shader for a fullscreen background. I use the ShaderNode code in the test application and I provided my own fragment shader which looks like that :

#ifdef GL_ES
precision mediump float;
uniform vec2 resolution;
void main(void)
float time = CC_Time1];
vec2 uv = floor( 20.0 * gl_FragCoord.xy / resolution.xy * vec2(resolution.x / resolution.y, 1.0) + vec2(time, cos(time * 0.25)));
float c = mod(uv.x + uv.y, 2.0) > 0.0 ? 0.0 : 1.0;
gl_FragColor = vec4(c, c, c, 1.0);

Pretty simple stuff…

I am testing on my Galaxy Nexus device, everything runs perfectly at first but after a bit over a minute, even though the framerate is still not suffering at all, it’s like the GPU is skipping frames or something but the shader update is not smooth at all and the longer the application runs the worse it gets. In fact I encounter the same problem when running the shaders test from testcpp on that device and I’m not talking about the very slow shaders in the samples, but something like the heart beat sample.

Anyone has any ideas what could be causing that? I tried using DDMS in eclipse to profile but when I capture a frame render I don’t see anything wrong. I am pretty new to shaders and android debugging/profiling but I am thinking something may be wrong with the engine. Still gonna try to find the culprit but I am not sure where to look at.


Performance problem with shader on android

I have ran into this problem too. It’s related to precision of floating-point operations in the shader. Some more details are here