This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

chain calculations slow down sharply as the items became large

hi,all,

I have got a problem when run opengles shader on mali-t760 gpu. In the fragment shader i calcuate the color as follow:

    vec4 color = (((((Coef5*color+Coef4)*color + Coef3)*color+Coef2)*color + Coef1)*color+Coef)*color;

this formule is much slower than

   vec4 color = coef*color;  (almost 8ms slower.)

why this happen as other GPUs(such as PC gpu) do not have this problem which is just 2ms slower at most.

  • What device are you running on, and at what screen resolution?

    this formule is much slower than

    Sure - it's doing more than 5 times more work per pixel. Don't you expect it to be 5 times slower?

    A mobile GPU is generally much smaller and lower power than a PC GPU, but running at similar resolution, so you would expect the mobile GPU to take longer to render the same thing, and therefore it will slow down faster the more work you add  ...

    You can download the Mali offline compiler from http://malideveloper.arm.com; if you compile your shader offline the compiler will give you some statistics on stdout about how many instructions and registers your code is using. Mali can do one instruction per core per pipe per clock (coarse approximation), so you can use this compute a rough expectation of performance. E.g. if you have a 500MHz GPU with two cores, and a 1080p screen, and you want to hit 60 FPS, then you only get ...

    (500M * 2) / (1920 * 1080 * 60) = 8 cycles per pixel

    Even this is assuming 100% utilization, no cache misses, and no stalls, which isn't realistic, so 6 cycles per pixel is probably a more realistic target.

    HTH,
    Pete