www.jpct.net

General => Feedback => Topic started by: Thomas. on May 09, 2013, 01:02:46 pm

Title: Mobile shaders
Post by: Thomas. 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 (http://video.unity3d.com/video/3861086/unite-11-fast-mobile-shaders)
Title: Re: Mobile shaders
Post by: EgonOlsen on May 14, 2013, 07:27:49 am
Should be called "Tegra bashing"...which is always a good thing to do... ;)
Title: Re: Mobile shaders
Post by: Thomas. 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)
Title: Re: Mobile shaders
Post by: EgonOlsen 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...
Title: Re: Mobile shaders
Post by: Thomas. on May 22, 2013, 08:29:32 pm
I updated wiki page. Do not hesitate to correct my English :-[