Author Topic: Mobile shaders  (Read 5122 times)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Mobile shaders
« on: May 09, 2013, 01:02:46 pm »
Interesting video presentation about mobile shader, how optimize,...

http://video.unity3d.com/video/3861086/unite-11-fast-mobile-shaders

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Mobile shaders
« Reply #1 on: May 14, 2013, 07:27:49 am »
Should be called "Tegra bashing"...which is always a good thing to do... ;)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Mobile shaders
« Reply #2 on: May 22, 2013, 02:16:43 pm »
Here are some insights about mobile shaders.
   - Mali-400 can not work with number > 65535 at any precision
   - Tegra 3 and PowerVR SGX 540 probably do not perform jumps at lines (everything is calculated, conditions do not help in performance)
   - on all GPUs is much faster generate shaders (by #ifdef or connecting blocks) than use conditions
   - on Mali-400 is 10% faster do code below, than do same thing in fragment shader (although all varying variable need linear interpolation to every pixel).
Code: [Select]

varying vec2 texSample0;
varying vec2 texSample1;
varying vec2 texSample2;
varying vec2 texSample3;
varying vec2 texSample4;
...
texSample0 = texture0;
texSample1 = vec2(shiftX, shiftY) + texture0;
texSample2 = vec2(shiftX, -shiftY) + texture0;
texSample3 = vec2(-shiftX, shiftY) + texture0;
texSample4 = vec2(-shiftX, -shiftY) + texture0;
   - result of pow(x, y) where x or y is < 0 is zero on Tegra 3
   - on Tegra 3 can not be used array[index] where index is not constant value (can not be used uniform for index)
« Last Edit: May 22, 2013, 04:17:34 pm by Thomas. »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Mobile shaders
« Reply #3 on: May 22, 2013, 07:10:26 pm »
There's a page in wiki that tracks findings like this. Maybe you want to add yours to it...

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Mobile shaders
« Reply #4 on: May 22, 2013, 08:29:32 pm »
I updated wiki page. Do not hesitate to correct my English :-[