Page 1 of 1

GZDoom slight delay during startup (temp problem)

PostPosted: Fri Nov 05, 2021 3:29 pm
by Enjay
I'm just wondering if anyone has an explanation for the following:

I had been using GZDoom (a git build from a few days ago) and doing a lot of going into GZDoom, checking how a shader looked, quitting immediately altering what I was working on and then repeating.

After doing this several times (maybe 20+), I noticed that GZDoom was taking a bit longer to start than normal. The startup window would get as far as the message that says "player 1 of 1 (1 nodes)" and then pause for around 5 seconds before the background behind the startup window became a full-screen instance of GZDoom and the game started in the usual way. Normally the point where the ~5 second delay happened is near-instantaneous for me.

I didn't think about it too much at the time but I noticed that it was still happening a few days later (even with nothing other than the default files loaded). I checked that I wasn't doing something that I hadn't intended to (e.g. loading something, or caching textures) and it all seemed fine. I even disabled my visus checker for a trial and that wasn't the issue either. I updated to the latest git build but the delay persisted.

Then, on a hunch, on the IWAD selection window, I changed from Vulkan to OpenGL and ran GZDoom. It started quickly (no 5 second delay). Then I quit and switched back to Vulkan and the delay was still gone.

So, any ideas why this might have happened?

Re: GZDoom slight delay during startup (temp problem)

PostPosted: Fri Nov 05, 2021 7:12 pm
by Rachael
What's happening is your shader cache is being invalidated. On Vulkan, GZDoom is responsible for the shader cache, and if it needs to be rebuilt it will do so. Not sure how much mods affect this, but usually shouldn't be too much. Updating your GZDoom version (even with dev builds) will likely require a cache rebuild too, though.

In OpenGL the cache is managed by your video card but only if you are on AMD or NVidia. If you are on Intel, or using Vulkan, then GZDoom will manage your cache.

You can find GZDoom's shader cache in the following folder on Windows: %localappdata%\zdoom\cache

Basically, GZDoom's fast startups only ever occur when nothing important has changed between the current session and the last, that would otherwise invalidate the cache data. If you play other games, then your video card drivers might clean out its own caches to make room for the other games' caches, as well.

Re: GZDoom slight delay during startup (temp problem)

PostPosted: Fri Nov 05, 2021 7:58 pm
by SanyaWaffles
I notice sometimes GZDoom will take a long, long time starting up if the graphics driver got replaced and I didn't restart. Restarting usually fixes it.

Re: GZDoom slight delay during startup (temp problem)

PostPosted: Fri Nov 05, 2021 8:14 pm
by dpJudas
Unless someone else added it, the vulkan backend will compile the GLSL shaders every time. I think Rachael may still be on to something though. It is possible that the driver keeps building up a cache internally of compiled SPIR-V shaders until you launch another application (GZDoom OpenGL in this case) which then maybe clears the cache. That would be my best guess of what is going on here.