Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Regression feature(not bug): Static & Dynamic Batching combining V buffers but not Draw Calls

Discussion in 'General Graphics' started by oleg-chumakov, Oct 9, 2015.

  1. oleg-chumakov

    oleg-chumakov

    Joined:
    Oct 30, 2013
    Posts:
    18
    Hi. Here is my story in 4 steps.

    1. Creating empty project with default settings


    2. Creating simple scene with batched primitives. Checking via profiler - everything is ok, draw calls was batched 8 objects in 1 draw call, awesome!


    3. Building for iOS and checking the GPU frame. Em... every primitive have single draw call?



    4. Check one more time... really it's 8 single draw calls, one per batched primitive (all geometries are in Array Buffer #1 *Combined mesh).


    Also, if you're building the same for Android and connect Unity's profiler you will see that Low level GPU profiler draw calls metric is 8, but Unity profiler is showing 1.

    Sources: https://www.dropbox.com/s/fh8s4egmk3byb1y/batch.zip?dl=0
    Unity version: 5.2.1f1
    Bug #734712
     
    Last edited: Oct 9, 2015
  2. oleg-chumakov

    oleg-chumakov

    Joined:
    Oct 30, 2013
    Posts:
    18
    UPD in Unity 4.6.8f1 everything is ok, so it's regression bug

     
  3. valyard

    valyard

    Unity Technologies

    Joined:
    Jun 4, 2010
    Posts:
    291
    This is not a bug, this is how static batching works in Unity 5 — you get several draw calls instead of one but there are no state changes between them so this is uber fast.
     
    theANMATOR2b likes this.
  4. oleg-chumakov

    oleg-chumakov

    Joined:
    Oct 30, 2013
    Posts:
    18
    Em.. got it, it's little bit surprising for me. I believe that it's uber fast, but i don't see the point. The state changes already take place followed by draw 20 draw calls without any state changes inbetween. Why doesn't just render those 20 calls in 1 draw call ? In any case my personal opinion that Unity profiler's information is not synced with real GPU situation now.
     
  5. Rusfighter

    Rusfighter

    Joined:
    Jan 18, 2014
    Posts:
    60
    Can confirm this for Android. However if objects are dynamic batched , then there is only 1 drawcall... Seems more a bug to me...

    I still think it is much faster to have one opengl draw than several without state changes...
     
  6. ReJ

    ReJ

    Unity Technologies

    Joined:
    Nov 1, 2008
    Posts:
    378
    We pick fastest path for implementing batching depending on platforms / API.

    Submitting multiple drawcalls without changing state proved to be faster than filling in dynamic index buffer (that is necessary for static batching to combine multiple objects into single drawcall) on OpenGLES / Android and iOS.


    PS: just looking at number of drawcalls is not representative of performance in 2015.
     
    yiduonw and theANMATOR2b like this.