Porting from GLES 1.0 to GLES 2.0

This topic contains 1 reply, has 2 voices, and was last updated by  Joe Davis 4 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #30997

    jimvonmoon
    Member

    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:
    [CODE]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. Smile

    [CODE]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;

    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. Smile

    [CODE]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. Smile

    #36223

    Joe Davis
    Member

    Hi,

    If the scene you are rendering is identical to your OpenGL ES 1.x scene, it sounds very strange that OpenGL ES 2.0 would incur a cost like this when blending is enabled. Are you drawing the same number of particles in both cases? Can you send .apks to devtech@imgtec.com with and without blending enabled so we can look into this for you?

    Thanks,
    Joe

Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.