🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

glLinkProgram is agonizingly slow

Started by
2 comments, last by Overfloater 2 years, 11 months ago

So I have been working on a custom engine, to move a mod I originally made on Half-Life 1 onto it. In the mod I had already rewritten the renderer and disabled the original rendering pipeline, and this new renderer uses GLSL shaders and VBOs and FBOs. The mod in total uses about 1240 shaders if on-demand shader loading is disabled. In the mod, these shaders take about ten seconds to compile, all of them at once that is.

When I made my custom engine, I moved my renderer from the mod version into the engine, with only minor modifications to the basic classes. This also includes the class that manages GLSL shaders. However in the custom engine, the shaders take an agonizingly long time to compile. I can showcase the statistics below:

Half-Life 1:

Custom engine:

Please disregard the GL version, as I forgot to remove the constraint from the copy I did these stats on. Changing the version also had no effect. Also I ran both of these with the shader cache nuked, so both applications had to create the cache from scratch.

The custom engine itself runs under SDL2, and is 64-bit. So far I haven't been able to find why glLinkPrograms is so slow, when compared to the mod version. I tried nuking the nVidia shader cache completely, and letting both applications run. The Half-Life 1 mod version compiles lightning fast, while the custom engine is agonizingly slow. However once the custom engine compiles all the shaders and caches them, it becomes marginally faster on second initialization.

Edit: Link to the pastebin example of a shader that takes over a second to load/link:

https://pastebin.com/u58zjNKi

Any help is greatly apprechiated.

None

Advertisement

Hmmm… can't help, but i have the same problem with Vulkan Compute shaders. Project took half an hour to compile its shaders on NV, while on AMD it's a second. Shader Cache helps after it's compiled once, but something seems wrong.

@JoeJ Hey, I just wanted to give a heads up. Turns out, for me it was the Visual Leak Detector that was causing this problem. It didn't occurr to me before, because I thought that VLD only checks the application itself, and not it's dependencies too. Once I removed it from being linked in, the issue resolved itself. So if you are having similar problems, try to see if a tool you're using is interfering.

None

This topic is closed to new replies.

Advertisement