Main Menu

Mobile shaders

Started by Thomas., May 09, 2013, 01:02:46 PM

Previous topic - Next topic

Thomas.

Interesting video presentation about mobile shader, how optimize,...

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

EgonOlsen

Should be called "Tegra bashing"...which is always a good thing to do... ;)

Thomas.

#2
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).

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)

EgonOlsen

There's a page in wiki that tracks findings like this. Maybe you want to add yours to it...

Thomas.

I updated wiki page. Do not hesitate to correct my English :-[