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

Question Shader Variant runtime prewarm unexpectedly slow. Why?

Discussion in 'General Graphics' started by mitaywalle, Apr 26, 2023.

  1. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    246
    Hello.
    Our pipeline to prewarm shaders:

    Editor time:
    - collect android logcat messages with compiled shader variants
    - parse them to ShaderVariantCollection. ShaderVariant
    - remove invalid variants

    Runtime:
    - filter variants by runtime situation (for example - use shadow or not)
    - for each variant
    - Temp ShaderVariantCollection. Add(variant)
    - Temp ShaderVariantCollection. WarmUp()
    - Temp ShaderVariantCollection. Clear()
    - skip frame

    And eveything work as expected, but: warmup take huge time, but not for simple compile by rendering.
    Honor 10 XLite: ~700 ms for first warmup after install, variant with 6 Keywords.
    Redmi 9C: ~18 000 ms for first warmup after install, variant with 7 Keywords.

    - Unity 2020.3.18f1
    - Android


    Screenshot_20230426_190958_ru.SOFFGames.gco.jpg

    Can anyone tell me - why?

    A bit later I'll add more info here.
     
    Last edited: May 24, 2023
  2. mitaywalle

    mitaywalle

    Joined:
    Jul 1, 2013
    Posts:
    246
  3. TXiongyi

    TXiongyi

    Joined:
    Feb 17, 2021
    Posts:
    3
    same here, we used automation to collect list of common shader variant and prepare to warm it up during game loading, significantly slow when tested on android low end phone (oppo 16)
     

    Attached Files: