-1
\$\begingroup\$

On mobile platforms shader optimization is necessary and improve FPS.

But on desktop platforms is optimization still needed (and will improve FPS) or does the GPU driver handle it ?

\$\endgroup\$
2
  • \$\begingroup\$ Like any code, some optimization is done by the GPU, but it doesn't mean you can code your shader program inefficiently and expect the GPU to do magic. \$\endgroup\$
    – Vaillancourt
    Commented Aug 29, 2016 at 4:21
  • 2
    \$\begingroup\$ Impossible question to answer ("and will improve FPS") as with any optimization you do it when can profile it to be a problem - and if you can find it being a problem then yes optimizing it will make it better.. \$\endgroup\$
    – Mikael
    Commented Aug 29, 2016 at 8:56

2 Answers 2

1
\$\begingroup\$

You always need to optimize for any platform you're developing on. There are many ways in which you can write a working algorithm that isn't cache friendly or does useless computation.

Also, you should remember that there are many GPUs in existence and all can behave (performance-wise) differently on possibly the same algorithm because the architecture are different and many other factors can make GPUs range from fast to sluggish.

If you want to optimize your shaders, there is a tool called glsl-optimizer that is (mostly) used on mobile platforms and used directly in Unity, but you can still use it on desktop as it performs many optimizations (constants propagation, loop unrolling, etc...) on your code.

Also, if you want to optimize and profile your application, you can use tools such as apitrace, renderdoc or GLSL-Debugger (even though this one seems to be less actively developed).

EDIT: Also, you can look at this page for a comprehensive list of profilers and debuggers.

Hope this helps.

\$\endgroup\$
3
  • \$\begingroup\$ It seems that glsl-optimizer does not support OpenGL 1.5 and above \$\endgroup\$
    – Suici Doga
    Commented Sep 1, 2016 at 11:38
  • \$\begingroup\$ It's only the shader version, you can still use any OpenGL version you want. You will just need to tweak your shader versions to use #version 150 core or less. Well that's the hard part. Also, you're not going to find any other publicly available optimizer (at least that I know of) :/ \$\endgroup\$
    – CpCd0y
    Commented Sep 1, 2016 at 12:03
  • \$\begingroup\$ Here's an example of how I use it in my application. It optimizes most of the shaders, but not all of them because of the #version requirement. \$\endgroup\$
    – CpCd0y
    Commented Sep 1, 2016 at 12:07
0
\$\begingroup\$

I would recommend optimizing it anyway because you can't just let the GPU do all the magic. Try it out on as many rigs as you can as there will always be these random people that don't have good computers. I had this several times with some of my friends as I use the new macbook pro retina display and they use the old macbook pro with a decreased performance. It definitely helped a lot after I optimized my game for them.

\$\endgroup\$
1
  • \$\begingroup\$ So what tools should I use to optimize shaders \$\endgroup\$
    – Suici Doga
    Commented Aug 29, 2016 at 13:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .