[gles][ios] Refactors calculations into utility functions