Search Unity

Graphics PresentAndSync problem

Discussion in 'Android' started by BFGames, Apr 14, 2015.

  1. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Hello everyone.

    I am working on a game, but ran into a problem while testing it on my android tablet.
    The game runs a 6-7 FPS on my android Nexus 7, 2nd Generation. When i profile it i get this

    Graphics.PresentAndSync - uses a huge amount of my CPU.
    I tried with different rendering paths, i tested the scene only using the sprite diffuse shader. Changing the shader helps a bit but not much.

    The same game runs with 20-25 FPS on my old slow iPad2 on iOS, which makes it seem like an android thing.

    See image for the CPU usage in the profiler.

    Did anyone run into the same problems?

    DevicePresent.png

    Oh forgot to mention this, but i am using Unity 5.0.1
     
  2. proandrius

    proandrius

    Unity Technologies

    Joined:
    Dec 4, 2012
    Posts:
    544
    Can you try turning off VSync in quality settings?
     
  3. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Tried both Don't Sync and Every V Blank - same outcome.

    In a scene with a single sprite it uses around 12 ms! And its using the sprites diffuse shader :(
     
    Last edited: Apr 14, 2015
  4. florianpenzkofer

    florianpenzkofer

    Unity Technologies

    Joined:
    Sep 2, 2014
    Posts:
    479
    If you see much time being spent in 'Device.Present' it usually means that the thread is blocked by the graphics driver to wait for the GPU to catch up. The Unity CPU profiler measures the wall time.
    To check if the GPU is busy on the Nexus7(2013) you could use the Grapher in Qualcomm's AdrenoProfiler, it is pretty good and easy to use.

    In case you use the procedural skybox (the default in Unity 5) please try to disable it and clear with a solid color instead.
     
  5. Pharaoh

    Pharaoh

    Joined:
    Jan 8, 2014
    Posts:
    28
    Can you provide some guidelines how to achieve this?
     
  6. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Thx will look into that. My camera is set to Solid Color.
     
  7. BFGames

    BFGames

    Joined:
    Oct 2, 2012
    Posts:
    1,543
    Just check your camera's Clear Flags
     
  8. BenouKat

    BenouKat

    Joined:
    Feb 29, 2012
    Posts:
    222
    Hi guys,

    We are facing performance issue with Nexus 7 as well, the game runs "fine" (~20 FPS) in Unity 4.6. We test with Unity 5.1.1 and the performance are very low (~5-6 FPS), the other devices we got (Xperia, more recent Nexus, IPad, Samsungs, etc...) doesn't get a performance hit when switch to Unity 5.

    I have removed any Skybox from Lighting panel, and set my camera to Solid Color, but it doesn't change.

    Someone as a tip ? @BFGames did you manage to find the issue ?

    Thanks a lot.
     
  9. acorrow

    acorrow

    Joined:
    Jan 4, 2015
    Posts:
    32
    Hey guys,

    So i'm not sure where exactly the onset of this was for me, but I only noticed my performance issue AFTER my upgrade to Unity 5.2. I'm myself suspicious that it was REALLY the onset here, I likely just only noticed then. Regardless this is what i was seeing:

    Same issue, Graphics.PresentandSync was taking up about 70-80 ms. I went down the standard performance checklists, and like many others, was experiencing this in what I would consider a VERY basic scene (though more complex than most were seeing).

    So I went through the painstaking process of enabling and disabling piece by piece all the different graphical components in my game, and what I found was that my problem was a few icons I was displaying on a UGUI canvas (icon is an IMAGE). I added multiple OUTLINE components to the image, to give a styled look to the image. THOSE OUTLINES WERE THE ISSUE.

    After reading up on it (and someone please correct me if I'm wrong here) each time I added an outline to that image, the renderer now has to take a second pass as the entire image, essentially doubling the render time. Hence, I woudl expect if you add MULTIPLE outline components to a single image, and also since that image was a status/game icon, its ALWAYS displaying, then the render passes would be exponential? (this is where I'm likely going to be corrected... but anyway...). If not exponential, then likely just due to the fact that we are making many passes (I had 4 outlines on a single icon to create a styled effect).

    Removed multiple outlines on icons displayed on UGUI canvas... Back up to 60+/- fps on Android.

    Thoughts anyone? Anyone seeing issues like this specific to images/outlines and/or ugui objects in general?
     
    BFGames likes this.
  10. Ali_V_Quest

    Ali_V_Quest

    Joined:
    Aug 2, 2015
    Posts:
    138
  11. BenouKat

    BenouKat

    Joined:
    Feb 29, 2012
    Posts:
    222
    Salazar and bart_bender like this.
  12. juglarx

    juglarx

    Joined:
    Dec 27, 2014
    Posts:
    60
    Guys in my case this happend because i have some filters on the camera like antialisaing and flares layer. i desactivate this and i had back to 55-60 fps
     
  13. Techno-Buddhist

    Techno-Buddhist

    Joined:
    Apr 30, 2014
    Posts:
    1
    I had same problem but mine was because I must have inadvertently changed the shadow settings on my light. The Shadow Type -> Resolution had been set to "Very High Resolution", changed it to "Use Quality Settings" and all was well again! Hope it helps other people too.
     
  14. soleron

    soleron

    Joined:
    Apr 21, 2013
    Posts:
    580
    It's alive!
    Looks like this has to do with some deep performance settings. Any clues?
    I got the same issue. No shadows, no v-sync, and minimal unlit shaders using LWRP.
     
  15. mdYeet

    mdYeet

    Joined:
    Oct 21, 2020
    Posts:
    22
    wouldn't point at "some deep performance settings" , although there are plenty of settings dependent on where you deploy the build, make sure to look through everything. I had some random 50mb texture used for a skybox light material, and i thought i had an "empty scene"