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

When texture get loaded to GPU and what is Texture.AwakeFromLoad?

Discussion in 'Editor & General Support' started by Tafk, Apr 24, 2013.

  1. Tafk

    Tafk

    Joined:
    Feb 5, 2013
    Posts:
    20
    Looks like I misunderstanding some processes in Unity texture managment. In my Tower Defence game for iOS I have main GameObject which contains link to all my towers prefabs. As you can see in screenshot I have huge spike on loading scene with this GameObject. It's looks like most of time was spended on Texture.AwakeFromLoad. As I know from threads on this forums, Texture.AwakeFromLoad actually happens when texture get loaded to GPU (which happens when texture became visible, as I know). But I don't instantiate any GameObjects that contains those textures at level start, and no one of them visible at start. Or unity loads all used texture on scene start? If so, why some of textures loaded much slower then others if theirs compression, size are the same? I'll be very grateful if someone could explain me how and when Unity loads all required textures to GPU.

    p.s. couldn't see in attachments, so I uploaded it here - http://tau.rghost.ru/45514685/image.png
     
    Last edited: Apr 24, 2013
  2. Alexey

    Alexey

    Unity Technologies

    Joined:
    May 10, 2010
    Posts:
    1,602
    You mix 2 "load to GPU" in there:
    1. unity reads built data, and pass texture data to driver (that's Texture.AwakeFromLoad)
    2. some drivers (i cant say for sure minority or majority) will delay the real work on texture (you may need to do lots of stuff on texture data, like swizzling etc) until it is first time seen.

    I hope i clarified some ;-)
     
  3. Tafk

    Tafk

    Joined:
    Feb 5, 2013
    Posts:
    20
    Thank you for reply, Alexey. Yep, you clarified some, but not all I want to know. I still have some misunderstandings there.
    1. As you said, Texture.AwakeFromLoad called when unity reads built data, but when actually it happens? On scene load for all used on scene textures? Or on object instantiating?
    2. As you can see on my screenshot, I have different time of AwakeFromLoad execution for different textures with same compression parameters and same size. Why?
    3. Is 600ms counts as normal time for passing texture data to driver? Texture parameters: 2048x2048 (spritesheet for tk2d), compression - RGBA PVRTC 4bit. Target platform - iOS.
     
    Last edited: Apr 24, 2013