Search Unity

Unity reuploading mesh data for static object every frame.

Discussion in 'General Graphics' started by phil_lira, Aug 26, 2015.

  1. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    I'm optimizing my game with Adreno Profiler and it flags Heavy API calls on some drawcalls.

    The heavy call Adreno Complains is glBufferData(....., GL_DYNAMIC_DRAW).

    dynamic_draw.JPG

    I'd like to know why is Unity marking them as dynamic since the mesh is marked as static in editor. (The only thing that's not static is Navigation)

    culling.jpg

    Any Ideas?
     
  2. smd863

    smd863

    Joined:
    Jan 26, 2014
    Posts:
    292
    I think that is related to the "Read/Write Enabled" check box on the import screen for the mesh. That lets you modify it from script and Unity will use the GL_DYNAMIC_DRAW usage hint since it knows you want to modify the data.

    Although I wouldn't expect it to be uploading it each frame unless you are actually making changes each frame. Try unchecking that box and I would hope Unity will then load the mesh data once with GL_STATIC_DRAW and leave it alone.
     
  3. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    584
    That was it! Thanks!