Search Unity

Question Shader Graph 10.2.2 - strip unused target variants

Discussion in 'Shader Graph' started by goran_okomotive, Feb 18, 2021.

  1. goran_okomotive

    goran_okomotive

    Joined:
    Apr 26, 2017
    Posts:
    60
    Dear community

    We are currently using the new master node feature for graphs, where we can define different SRP targets and make a graph available for URP and HDRP for example.

    Unfortunately it takes very long to compile these graphs for the first time and I suspect that Unity is compiling the variants for URP and HDRP. (here a picture of the window when I do a HDRP build):
    upload_2021-2-18_16-49-44.png

    For non-graph shaders I can strip them with the IPreprocessShaders interface. Any ideas how to strip the shader graph variants for a specific target?

    Thanks for any hints and tricks!
     
  2. ibbybn

    ibbybn

    Joined:
    Jan 6, 2017
    Posts:
    193
    Same here, except I get 16384vp.. multiple times until the build fails due to too many shader variants. This was not the case in 2020.1.17
     
  3. ibbybn

    ibbybn

    Joined:
    Jan 6, 2017
    Posts:
    193
    Nevermind, using Instancing Variants Strip All under Graphics and using a new shadervariants asset seems to work for builds.
     
  4. goran_okomotive

    goran_okomotive

    Joined:
    Apr 26, 2017
    Posts:
    60
    Thanks for mentioning this workflow. Still seams pretty useless to compile variants for a target which is not chosen. I hardly doubt that devs want to change render pipeline during runtime? And if so, there could be an checkbox / option in the graph inspector maybe?