I'd like to do texture splatting but I'm running into severe performance problems when using multiple texture reads in my fragment shader. With a single texture, I get a constant 60fps (vsync limited, with room to spare). Adding a second texture read, my performance drops down to 40fps and with the shader provided below, performance is down to 15fps.
Any ideas?
[source lang="plain"]# Simplified fragment shader for demonstration purposesvarying lowp vec2 v_texcoord;varying lowp vec4 v_color;uniform sampler2D texture0;uniform sampler2D texture1;uniform sampler2D texture2;uniform sampler2D texture3;uniform sampler2D texture4;void main(){ lowp vec4 alpha = texture2D(texture4, v_texcoord); lowp vec4 color = texture2D(texture0, v_texcoord); color = mix(color, texture2D(texture1, v_texcoord), alpha[0]); color = mix(color, texture2D(texture2, v_texcoord), alpha[1]); color = mix(color, texture2D(texture3, v_texcoord), alpha[2]); gl_FragColor = v_color * color;}[/source]
Edited by sth, 18 June 2012 - 07:06 AM.







