Imagination PowerVR SDK Blog

Fragment Compiler Optimisations


#1

Hello,





Using my wrapper OGL2 -> OGLES2 wrapper (gl-wes-v2) i have ported the glN64 graphics plugin to be used with Ari64’s MIPS->ARM Dynarec + Mupen64Plus for Nintendo64 emulation on OMAP3 devices. This plugin heavily utilises glTexEnv blending operations to simulate the Combiner modes of the RSP. To emulate these commands my wrapper produces fragment shader code which are then feed to the shader compiler. I’m wondering what kind of compile time optimisations, if any, are already being done by the OMAP3 fragment shader compiler?





For instance, is it worthwhile to optimize out one and zero propagation in my wrapper before it reaches the shader compiler? Or will the compiler do this for me?





Will it optimise cases like this:





lowp vec4 arg0, arg1, arg2;


arg0 = gl_FragColor;


arg1 = arg0;


arg2 = arg0 * arg1;





to this:





lowp vec4 arg2;


arg2 = gl_FragColor * gl_FragColor;





Getting good fragment shader performance is going to be crucial for this project.





Cheers,


Adventus


#2

Yes, the compiler is able to do these optimisations.