Difference between revisions of "GPU guide"

From JPCT
Jump to: navigation, search
(Created page with '=== What you should know about different GPUs === Android runs on a variety of different GPUs (Graphics Processing Units). All of them have some issues that you should know abou…')
 
Line 11: Line 11:
 
*Missing polygons: This can happen with large polygons that are in parallel with the x/y-plane. They simply disappear in some situations. A solution is to either rotate them in a way that they aren't parallel to the x/y-plane anymore or split them into smaller ones. This problem is rare.
 
*Missing polygons: This can happen with large polygons that are in parallel with the x/y-plane. They simply disappear in some situations. A solution is to either rotate them in a way that they aren't parallel to the x/y-plane anymore or split them into smaller ones. This problem is rare.
 
*Missing polygons on first render pass: This happens on models with high polygon counts. Looks like as if the chip's internal binning can't handle the polygon count in the first pass. Solution: None that i know of. One option might be not to show the first render pass or simply live with it. This problem is rare for normal mobile applications.
 
*Missing polygons on first render pass: This happens on models with high polygon counts. Looks like as if the chip's internal binning can't handle the polygon count in the first pass. Solution: None that i know of. One option might be not to show the first render pass or simply live with it. This problem is rare for normal mobile applications.
 +
 +
==== Adreno ====
 +
 +
Adreno chips suck when it comes to shaders.
 +
 +
*Avoid any kind of loops in the shader, may they be static or dynamic. They will compile fine but chances are, that the result will either render complete nonsense or crash your device. Solution: Replace loops with unrolled code and/or a bunch of if/then statements.
 +
 +
==== Mali ====
 +
 +
Mali chips are pretty common. Their rendering accuracy is below PowerVR's chips, which is why you might see some rendering artifacts on Mali powered device on applications that look fine on PowerVR. Mali chips don't support highp in the fragment shaders while PowerVR does.
 +
 +
*Mali chips can't handle numbers >~65500: In your shaders, don't calculate sin/cos/sqrt or similar on numbers larger than ~65500. The results will be all wrong and your shader won't work. Solution: Don't do it, try to use lower values instead.

Revision as of 15:18, 18 December 2012

What you should know about different GPUs

Android runs on a variety of different GPUs (Graphics Processing Units). All of them have some issues that you should know about. This isn't meant to be an all-encompassing list, but it mentions some problems and workarounds that surfaced during the development of jPCT-AE. Keep in mind that not all problems surface on all devices/drivers and in all applications.

PowerVR

Overall, PowerVR's chips and drivers are pretty decent. There are a few problems though:

  • The shader compiler creates shaders that render everything in black: This seems to be a bug in the shader compiler. The only solution that i found was to add some additional variables to the shader that serve no real purpose but somehow fix the problem. This problem is very rare.
  • Missing polygons: This can happen with large polygons that are in parallel with the x/y-plane. They simply disappear in some situations. A solution is to either rotate them in a way that they aren't parallel to the x/y-plane anymore or split them into smaller ones. This problem is rare.
  • Missing polygons on first render pass: This happens on models with high polygon counts. Looks like as if the chip's internal binning can't handle the polygon count in the first pass. Solution: None that i know of. One option might be not to show the first render pass or simply live with it. This problem is rare for normal mobile applications.

Adreno

Adreno chips suck when it comes to shaders.

  • Avoid any kind of loops in the shader, may they be static or dynamic. They will compile fine but chances are, that the result will either render complete nonsense or crash your device. Solution: Replace loops with unrolled code and/or a bunch of if/then statements.

Mali

Mali chips are pretty common. Their rendering accuracy is below PowerVR's chips, which is why you might see some rendering artifacts on Mali powered device on applications that look fine on PowerVR. Mali chips don't support highp in the fragment shaders while PowerVR does.

  • Mali chips can't handle numbers >~65500: In your shaders, don't calculate sin/cos/sqrt or similar on numbers larger than ~65500. The results will be all wrong and your shader won't work. Solution: Don't do it, try to use lower values instead.