Hello everybody!
Recently I have begun porting my little Android game from Java + GLES 1.0 to C++ + GLES 2.0. My device is Samsung Galaxy S (GT-I9000 with PowerVR SGX540).
Everything was going smoothly until I run into some blending performance issues. I believe that it’s a blending related problem because my drawing algorithms haven’t changed and my shaders are pretty simple. Also when I disable blending my performance jumps sky high (though graphics look terrible).
I didn’t have such problem when I was using GLES 1.0, I was able to push much, much, MUCH more blended geometry to GPU without much performance penalty. So my question is: are there any GLES 2.0 specific conditions under which blending can cause such performance loss? Some GLES states, some rendering surface parameters maybe? I’ve tried many things but with no success.
If it helps - those slowdowns occur in my particle engine and particles are rendered with following shaders:
Vertex shader:
attribute vec3 attrPosition;
attribute vec2 attrUV;
attribute float attrAlpha;
uniform mat4 uniModelViewProjectionMatrix;
varying vec2 varUV;
varying float varAlpha;
void main()
{
gl_Position = uniModelViewProjectionMatrix * vec4(attrPosition, 1);
varUV = attrUV;
varAlpha = attrAlpha;
}[/CODE]
Fragment shader:precision mediump float;<br><br>uniform sampler2D uniTexture;<br><br>varying vec2 varUV;<br>varying float varAlpha;<br><br>void main()<br>{<br> gl_FragColor = texture2D(uniTexture, varUV) * vec4(1, 1, 1, varAlpha);<br>}
But like I said - I don’t think that it is a shader related problem because when I turn off blending everything runs great. I use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); but changing it doesn’t help anything.
I would appreciate any ideas because I am running out of options here. Thanks.
attribute vec3 attrPosition;<br>attribute vec2 attrUV;<br>attribute float attrAlpha;<br><br>uniform mat4 uniModelViewProjectionMatrix;<br><br>varying vec2 varUV;<br>varying float varAlpha;<br><br>void main()<br>{<br> gl_Position = uniModelViewProjectionMatrix * vec4(attrPosition, 1);<br> varUV = attrUV;<br> varAlpha = attrAlpha;<br>}
Fragment shader:
precision mediump float;
uniform sampler2D uniTexture;
varying vec2 varUV;
varying float varAlpha;
void main()
{
gl_FragColor = texture2D(uniTexture, varUV) * vec4(1, 1, 1, varAlpha);
}[/CODE]
But like I said - I don’t think that it is a shader related problem because when I turn off blending everything runs great. I use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); but changing it doesn’t help anything.
I would appreciate any ideas because I am running out of options here. Thanks.
precision mediump float;<br><br>uniform sampler2D uniTexture;<br><br>varying vec2 varUV;<br>varying float varAlpha;<br><br>void main()<br>{<br> gl_FragColor = texture2D(uniTexture, varUV) * vec4(1, 1, 1, varAlpha);<br>}
But like I said - I don’t think that it is a shader related problem because when I turn off blending everything runs great. I use glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); but changing it doesn’t help anything.
I would appreciate any ideas because I am running out of options here. Thanks.