Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question What is material.setpasscachemissed

Discussion in 'Editor & General Support' started by RubberBandGames, Feb 15, 2021.

  1. RubberBandGames

    RubberBandGames

    Joined:
    Jul 20, 2020
    Posts:
    170
    Hi,

    Trying to optimize my rendering,
    I have a lot of material.setpasscachemissed in the profiler was wondering if someone can give me some insight on this and how to fix this if it is a performance issue

    Thanks
     
  2. marcowiprojects

    marcowiprojects

    Joined:
    Oct 2, 2014
    Posts:
    5
    have they answered you? Did you find what it means?
    Thank you
     
  3. RubberBandGames

    RubberBandGames

    Joined:
    Jul 20, 2020
    Posts:
    170
    Nope, nobody helped in the end. Still not sure what it is
     
  4. oxysofts

    oxysofts

    Joined:
    Dec 17, 2015
    Posts:
    124
    I'd like to know what this is as well.
    Edit: For anyone stumbling upon this, the function was renamed at some point. There is more information if you search the old name: Material.SetPassUncached
     
    Last edited: Jul 19, 2021
  5. leozzyzheng2

    leozzyzheng2

    Joined:
    Jul 2, 2021
    Posts:
    60
    I found the solution, on some platforms(for example DX11 on windows), Unity will cache material's shader pass, but it has some requirements to your shader code.

    I my case, I type a Texture named "sampler2D _WindNoiseTex", but the real one in properties is named WindNoiseTex, no underline at beginning, so Unity can't cache this shader pass and create it everyframe, that's what you see as "material.setpasscachemissed" in Profiler.

    After I fix the typos, "material.setpasscachemissed" gones.
    I don't know the full requirements for the cache, so you might check all your params in shader code to make sure they are in properties or set by material by code(not sure the second suggestion is ture).

    P.S. I can't find this profiler marker on Android, the cache might not exist in mobile device, so it won't injure the performance on those platforms I guess.
     
    Last edited: Sep 5, 2022