glfwInit takes 20 seconds

Viewed 50

I never had an issue with this until recently, but glfwInit() always takes 20 seconds to execute. I have seen the other stackoverflows and github issues pertaining to driver issues - but I do not have the same devices as the ones people talk about, and with the devices and drivers (fully updated) I do have, I have never had this issue until now.


    RB_CORE_INFO("Creating window {0} ({1}, {2})", props.title, props.width, props.height); // log macro - for example, will print at 10:30:00

    if (!gGlfwInitialized)
    {
        RB_CORE_TRACE("Initializing GLFW"); // prints at 10:30:00

        const int success = glfwInit(); // takes 20 seconds
        RB_CORE_ASSERT(success, "Could not initialize GLFW")
        RB_CORE_TRACE("GLFW Initialized"); // prints at 10:30:20

        glfwSetErrorCallback(GlfwErrorCallback);

        gGlfwInitialized = true;
    }

    RB_CORE_TRACE("Creating glfw window");
    mWindow = glfwCreateWindow(static_cast<int>(props.width), static_cast<int>(props.height), mData.title.c_str(),
                               nullptr, nullptr);

A snippet of my code, though I'm quite positive the issue is not my code. Whether my issue is glfw or windows 11 I am not sure, but I'm going mad trying to figure it out. Other work arounds and causes I've found online do not seem to be my case, as far as I can figure at least.

Any help is greatly appreciated.

For reference, I run Windows 11, fully updated and all drivers updated. RTX 3080 gpu and a Ryzen 5900x cpu. Some people have blamed Corsair keyboards, though I have a Ducky keyboard and it doesn't seem to be the cause either.

Note: I've rebooted many times since I first started having this issue a couple days ago.

Edit: It does seem the issue is related to this and this however these point to a device driver with VID_262 in the hardware ID. But as I do not have any with that particular VID_262 I'm not sure where to start looking. Using DevCon.exe I generated this list but even after unplugging every device one by one, I can't find the issue. As of this edit, I've not yet been able to try running this on another device.

1 Answers

So it turns out VCPKG is evil. I started having more issues - being that ImGui first compiled, but would give me read access violations when I used their NewFrame function. Then it turned into linking errors and a whole bunch of things that really started to confuse me. Even though I'm taking all my libraries from my own folder via premake, it seems Visual Studio has gotten confused and was trying to link both my generated lib files with lib files I had installed on vcpkg.

Turning off vcpkg has fixed both my linking errors and now makes glfw init very fast. I guess I should just uninstall vcpkg completely so it fixes the problem for other games or applications that use things like glfw.

Long story short, VCPKG is a nightmare on my system.

Related