1

I have the following fragment shader.

varying highp vec2 tCoord;

void main() {
    vec4 hc = texture2D(hair, tCoord);
    gl_FragColor = hc;
}

In my program, I am drawing around 15 images on the screen (only 2D, no 3D manipulation). I allow the all the image to be moved with a finger. So when the images are on the screen, I get 40 fps, but when I move them offscreen (with my finger), I get 60 fps. (This eliminates any bottle-neck in the program or the vertex shader). I am running this on a Galaxy Tab 7".

Since this is a very simple shader, I would expect 60 fps all the time. Any reason why this is slow?

6
  • 2
    To rule out textures as bottleneck, try drawing 1x1 textures instead (the "images" will then be unicolored rectangles, but who cares). Drawing 1x1 textures means that the data is minimal, and anything that needs to be fetched comes out of the cache. If that modification makes the framerate jump to 60, you are texture bound. If it changes nothing, it's most likely a fillrate issue. Commented Jun 21, 2011 at 21:47
  • How would I go about "drawing 1x1 textures instead"? Change the textures I'm drawing? Also, if they are 1x1, they won't fill up the entire screen (as they do now), so it will be an improved framerate just because the fragment shader runs less times. Commented Jun 21, 2011 at 21:49
  • 1
    To make them fill the screen use a textured quad instead of glDrawTexOES Commented Jun 21, 2011 at 22:04
  • 1
    Just bind any 1x1 texture (no matter what color) instead of the real ones. If that makes a difference, it's texture bound. Commented Jun 21, 2011 at 22:23
  • If it is texture bound, how can I make it faster? Commented Jun 22, 2011 at 4:45

2 Answers 2

2

highp probably is not accelerated on embedded hardware such as most android devices. Does it help at all to use default precision? Why do you think you need so much precision for texture coordinates on a low-res screen?

Sign up to request clarification or add additional context in comments.

1 Comment

I changed everything to lowp, and it still is the same fps.
0

i worked on a tegra platfrom with android 3.2.1 and opengl es 2.0.

if you can live without the need of the variable in between, try assigning directly. i experienced variable creation and assignment to be costly as 3-5 fps. texture2d also costs something in that range in fps.

varying highp vec2 tCoord;

void main() {
    gl_FragColor = texture2D(hair, tCoord);
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.