Nexus 10 Z-Buffer Problem

Hi,

has anyone ever come across what looks like a very low precision z-buffer when running on Nexus 10? Video here: https://dl.dropboxusercontent.com/u/21495867/VID_20130508_151600.mp4

The same APK runs fine on Nexus 7, but the scene goes ‘wobbly’ on Nexus 10.

I use a 32-bit display buffer, and a 24-bit depth buffer.

I don’t have a Nexus 10, and am in the awkward process of sending builds to someone who does, making one change at a time to see if it fixes the problem…

So far I have tried requesting a 16-bit depth buffer - still broken.
Disabled 32-bit display buffer - still broken.

I do scale the screen down if the shortest edge is over 480px, by calling SetResolution with a reduced res. I remember when I did this on other android devices while AA was enabled, it produced a corrupt display. Is some form of AA hardwired on on Nexus 10?

There’s no way I can shade all the pixels on Nexus 10 and run at 60 frames per second.

I have built a non-scaled version and sent that for testing. I will report back…

yes, this is known issue (to be fixed in some upcoming unity release - honeslty i lost track of the versions ;-)).
So what is the problem you ask? Nexus10 have shader compiler which is a bit too strict regarding precision.
You should go through your shaders and check vprog output structure (mind you, unity builtin shaders are good, but the ones you wrote yourself or get somewhere, even from angry bots, may be hit by the issue). You are looking for

if you find smth like that - make sure that attribute with POSITION semantics is float4 not half.

Wicked man!

I wrote all my own shaders, (such as this: http://vamflax.com/ChopperMike/ShaderBreakdown.png), and use half4 in the SV_POSITION. Shouldn’t cause any performance issues as the game is pixel bound.

I guess I can go back to 32-bit display and 24-bit depth, and scaling the resolution?

If this works… will you marry me?

x

no perf issues - if you look into the code generated you will see that matrices are float (highp) already, so when you have your pos as half (mediump) it is already converted to float for sake of matrix multiplication. Also, you dont see the issue on other devices because compiler see what you are doing (and knows that gl_Position output should be highp) and does float upcast automatically. So no, no perf issues, promise

sure

i promise to think about it :wink:

Amazing. Thank you!! :smile:

OH YEAH!!!

That’s done it! Thank you a BILLION!

I’d like to add you to the updated credits if that’s okay? If so, what’s your full name and what title would you like?

SuperInternetHighFive™ to you sir!! :smile:

Regarding that shader, a blurry cubemap would probably be much faster and less complex.

Yeah, you’re probably right. I’ll experiment with game #2. Thanks dude! :smile: