The best way to sort your scene is actually to do it in at least two stages/buckets. It is true that you need back-to-front sorting for translucent geometry for proper alpha-blending, but you want front-to-back sorting for best Z-buffer performance on opaque geometry. You can often get away with not bothering to sort opaque objects at all, leaving them unsorted should give better performance than sorting them back-to-front.
The whole point of batch processing is to identify geometry that is opaque or translucent, or that requires a certain texture, shader or state, and then before submitting the draw commands to the GPU you can cluster all of the similar geometry into batches. This way you only have to bother with depth sorting the hand full of batches that have a combination of states that actually require it, and you can sort in the proper direction.
Alpha blending and alpha testing are actually two separate things.
Blending occurs after a fragment is shaded and when its result is combined with something else in the color buffer to produce a new blended pixel.
Alpha testing is used to determine whether a fragment should be kept or discarded.
- On newer hardware it can be done in a fragment shader, using
- On older versions of OpenGL and OpenGL ES, you have the option of using the fixed-function alpha test.
As for which is faster, neither. Even if you perform an alpha test in a fragment shader at the very beginning of the shader and
discard, the sad truth is that most of the time your fragment shader will keep on executing and it is only after execution that the GPU actually discards the results of shading.
If your program is limited by the performance of blending, rather than fragment shading, then alpha testing might help. This is because any fragment that is rejected after fragment shading does not have to be blended. Usually fragment shading is the bigger bottleneck, though.
If you are thinking that alpha blending and alpha testing are the same thing, then chances are you are actually just using an alpha mask. In which case, depth sorting is not always necessary and you do not need to use alpha blending. Alpha blending is used when you have fragments with alpha values that lie somewhere inbetween 0.0 and 1.0.
Also note that you are dealing with tile-deferred rendering on iOS, because Apple uses all PowerVR GPUs. The only geometry you should sort using the CPU is translucent geometry on PowerVR GPUs, otherwise you are defeating the purpose of TBDR (tile-based deferred rendering).