Is it possible to get Unity to report which shader variant instigated a call to Shader.CreateGPUProgram? We are already using a ShaderVariantCollection to warm up shaders. If we were able to get the device to report which variant caused a new GPU program it would allow us to make sure the proper variants are included in the collection.
I downloaded 2018.4.6f1 and it wasn’t showing up in the Editor either. However I checked the text of the actual asset file and it’s showing up there. Will test in build to see if it’s working - thanks again! EDIT - it works!!
Huh…so after diagnosing the shader hitches we’ve been experiencing, some of them make perfect sense, but the majority of them should have already been warmed up by the ShaderVariantCollection!
The scene I was testing with is part of an AssetBundle, so duplication is a potential issue. However, our shader and ShaderVariantCollection assets are part of their own bundle that gets loaded on startup, so I would think that the assets wouldn’t be subject to duplication in this particular case.
Additionally, our project is set to never unload shader assets.
For anyone curious as to what was causing those bad re-compilations - changing all shader keywords to use “shader_feature” and not using any “multicompile” seemed to do the trick.
Even though shaders with the correct list of keywords had already been warmed up, for some reason Unity seems to think that it hasn’t been warmed up if you enable a global multicompiled keyword. Since I already put the logic in place to build the variants we need, simply switching to shader_feature got rid of this issue.
I think I’m experiencing a similiar issue. I created a ShaderVariantCollection and yet I’m seeing a huge CreateGPUProgram spike (~72 ms) on device upon spawning some impact effects for the very first time.
I enabled the shader compilation log and it reported:
However my ShaderVariantCollection for Sprite/Diffuse looks like this:
It looks like those variants are included except for the STEREO_MULTIVIEW_ON that seems to be missing and I cannot find on any entry in the ShaderVariantCollection. Unfortunately I’m not too experienced with shaders but should the STEREO_MULTIVIEW_ON be included to fix the issue?
Unity 2018.4.12f1
EDIT: Tested it and the missing STEREO_MULTIVIEW_ON is definitely the culprit.
I selected the “use player log” check box, and i found the file “Player.log”, but i can’t see anything about shader compilation. @aleksandrk you know why? Thank you
Why should it?
The intention here is to provide information on when actual shader compilation happens in the player. I don’t see any value for this info about the editor