Shader Optimization

So I’ve been doing a lot of optimizing lately in preparation for a few public demos that are coming up. Our target platform, Ouya, was having a very hard time rendering so I went through the usual motions of trying to decrease draw calls. The naive approach was terrible and doing some smart draw order sorting got us to about 32 calls which ran better but still too poorly for any sort of showing.

I went and further optimized and after testing again noticed that the frame rate hadn’t changed suggesting that the bottleneck was elsewhere. My original assumption was fill rate as we do use a render target for some more advanced effects. But just to be sure, I disabled the one custom shader we use and left the targets in and suddenly framerate was both up and stable at playable levels.

My question is how do I go about optimizing my shaders? I’m not familiar enough with libmojo to even know where to look and the fact that OpenGL shaders are structured so differently than HLSL has me confused with finding a starting point for investigation.

I do have a lot of texture sampling happening for some of my effects which I can try to work around but I was wondering if there was anything else I could do pre/post compilation to speed things up.

Also useful would be anyone else with Ouya experience that knows what the biggest bottlenecks are with the platform.


I should also mention I am using MonoGame from source and the Ouya api from source as well. I am planning on looking into how the cocos2d backend handles shaders unless somebody can let me know that it’s not worth the time/identical to how the monogame backend does it.