Simulating fixed pipeline

I’m trying to simulate the fixed pipeline in gles 2.0


I’ve got all functionality covered, without any conditionals in both the vs and ps.


The performance is comparable to apple’s default implementation (it’s a 3gs) except in very fillrate heavy scenes, where I’ve got half the fps.





Are there any tips for doing this?


I assume apple took the implementation from you. Is there any way to get a peek at the shader code?





The shader that is causing problems uses 2 varyings (vec4 and vec3), a rather complicated vs (~400 cycles but very little vertices in the scene - ~2000) and an extremely simple ps (3 muls and 2 adds, one pvr4 texture, no alpha test)


With blending enabled (1, 1 - src color) it dies from fillrate apparently.





Exactly the same scene with apples fixed pipeline implementation flies at 30 fps.





Any sugestions?


Thank you


Apple’s implementation of ES 1.1 does not have to run within ES 2.0 so they have the option of utilising the SGX at a lower level than that which is available to a 3rd party, such as yourself. There may be specific optimisations applied for this particular case. In general, trying to equal or better an ES 1.1 implementation built over ES 2.0 in comparison to a raw ES 1.1 implementation written by someone with access to the full hardware specs is going to be an uphill struggle…





Obviously, it’s also possible that your shaders are not as optimal as possible within ES 2.0.





I’m curious to know why you are writing your own implementation?Gordon2010-04-16 11:03:42

I’m adding some shaders to an existing gles11 game that makes full use of combiners.


I’ve simplified the ps to only multiply the light color (lowp vec3) with texColor (lowp vec4).


Still, I’m getting the same performance.





I’ve changes the # of varyings and precision, no difference.


With a simplified vs it’s the same.


I assume it’s fillrate, since I have several fullscreen quads.





Are some blending factors more expensive than others?


I’ve read that in some cases, the blending calculations can be appended to the last ps operations.


Is there any way I can facilitate this?

Could you check if performance changes if you simply assign a constant to glFragColor, or just a texture without lighting? Do you have blending enabled, and if so, which blend factors are you using?





The driver should take care of adding blending to the shader, the application has no control over how this is done.