Shader loading is VERY slow on WP8

When I load a new level, most of the CPU time is consumed by Shader.Parse calls. I consider that a bug as I use ~10 - 15 shaders per scene and it is far slooower than loading ~30 MB of textures per scene.

Worst case, however, is when I load asset bundles at the in-game shop (and I do that a lot in my scripts). For each bundle Unity loads some shaders which are already in the scene resulting in ~1 sec pause per bundle. That makes the shop very laggy.

When I run the game in the editor things are as they should be. Shader uploads are lightning fast and tasks like texture uploads are the slow ones.

I will greatly appreciate fast help as I plan to submit my game tomorrow!

Hi,

let’s get down to obvious things first: are you building the game in master config?

Hi,

yes, I use Master builds in VS whenever possible. Loading behavior is as laggy as in the debug mode with profiler, so I guess that the problem remains the same.

I will build master bundle with all required shaders inside to see if that will fix the lags during load of the other asset bundles with linked dependency. I will know then for sure if that’s shader issue or just wrong profiler data.

I will report the result asap.

Ok, I can confirm that shader loading cause these lags.

I’ve externalized all shaders into a single asset bundle and shop runs completely smoothly right now. I just need to warmup somehow these shaders to avoid lags on the first usage of each of them and everything will be ok.

Still, shader loading is far too slow. Such big lag shouldn’t be caused by just one shader (I hope at least). Earlier, I’ve tried to optimize loading time of my scenes, but Shader.Parse was also the limit as it consumes most of the scene loading time.

For example, that makes Application.loadLevelAsync completely unuseable as the async loading causes massive lags to the running game (~400ms lag per shader!). I’ve tried to introduce animated loading screen, but it was way to laggy and I’ve had to cut it out :frowning:

I test my game on Nokia Lumia 520.

Do you think you could make a repro project illustrating the issue and submit it as a bug?

Sure. 611943 is the case number.

Thanks!