Jump to content

  • Log In with Google      Sign In   
  • Create Account

ios opengles 2.0 lowp cause problem, right? and why?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 wantnon_cn   Members   -  Reputation: 115

Like
0Likes
Like

Posted 12 December 2012 - 02:30 PM

i am working on a iOS 3d game, because i don't have a real device in hand, so i have being test it in iOS simulator, and it always run well.
today i got a itouch4 with 5.0.1 system and test my game on it.
i found a strange problem:
in shader, i set the texCoord to lowp, and the texture become mess on device (but nothing wrong in simulator), and when i modified it to mediump it fixed.
there are some other wrong effect, and they are also finally solved by change lowp to mediump or highp.
that is a little strange because even though we known a little precision loss many cause some flaws, but i never expected the flaw may so serious as to get totally wrong effect.
and this is not the most strange thing, i also found that after i changed some of the lowp to mediump or highp, the game runs much more fluent on the device than before.
so i start to suspect that may be lowp have some support issue on real device. does the system (here is iOS 5.0.1) not support lowp well?
anyone else have the similar annoying experience with lowp?
i also want to known if i should change all the lowp to mediump or highp (or may be better all change to highp)?

Edited by wantnon_cn, 12 December 2012 - 02:36 PM.


Sponsor:

#2 C0lumbo   Crossbones+   -  Reputation: 2263

Like
0Likes
Like

Posted 12 December 2012 - 03:05 PM

My rule of thumb is:

lowp for colours.
mediump for normals and UVs.
highp for positions.

You can lookup the ranges and precisions in the spec, you shouldn't be surprised that lowp is no good for UVs since the range is only -2 to 2, and the precision is too low to represent a large (256+) sized texture to texel accuracy (IIRC).

It's difficult to test your chosen precision produces correct results, because the compiler is always free to give you a higher precision than the one you request, so you just have to test on the various different types of hardware.

In general, I wouldn't expect that increasing precision would improve performance, but there's always edge cases. For instance, lowp UVs have to be converted upwards when you pass them into sampler functions and conversions carry a small penalty - this may explain it since iOS is very sensitive to pixel shader performance. Also, I seem to remember an issue of severe performance problems if your vertex shader output precisions mismatch with their corresponding pixel shader input precisions.

Edited by C0lumbo, 12 December 2012 - 03:06 PM.


#3 wantnon_cn   Members   -  Reputation: 115

Like
0Likes
Like

Posted 13 December 2012 - 06:00 PM

I seem to remember an issue of severe performance problems if your vertex shader output precisions mismatch with their corresponding pixel shader input precisions.

so, if in vertex shader i do not specify a precision for a vertex shader output varying variable, and in the fragment shader i specify it with lowp or highp, will this cause a mismatch problem (have a risk of low performance) ?

Edited by wantnon_cn, 13 December 2012 - 06:02 PM.


#4 C0lumbo   Crossbones+   -  Reputation: 2263

Like
0Likes
Like

Posted 14 December 2012 - 02:05 AM


I seem to remember an issue of severe performance problems if your vertex shader output precisions mismatch with their corresponding pixel shader input precisions.

so, if in vertex shader i do not specify a precision for a vertex shader output varying variable, and in the fragment shader i specify it with lowp or highp, will this cause a mismatch problem (have a risk of low performance) ?


Possibly - I'd recommend you be as explicit as possible with precision rather than using the default precision. That said, I'm afraid I don't know the full details - it was an issue that suddenly hit a project after an OS revision a couple of years ago, and we modified our shaders accordingly, but there's a good chance that the problem has been fixed by Apple. Still, it seems like a good idea to avoid a precision change between vertex shader output and fragment shader input anyway.

#5 wantnon_cn   Members   -  Reputation: 115

Like
0Likes
Like

Posted 14 December 2012 - 11:53 AM

Possibly - I'd recommend you be as explicit as possible with precision rather than using the default precision.

ok, i will take your advice and specify the precision explicitly to insure the matching.

Edited by wantnon_cn, 14 December 2012 - 11:54 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS