简体   繁体   English

glfwInit 需要 20 秒

[英]glfwInit takes 20 seconds

I never had an issue with this until recently, but glfwInit() always takes 20 seconds to execute.直到最近我才遇到这个问题,但是glfwInit()总是需要 20 秒才能执行。 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.我已经看到与驱动程序问题有关的其他 stackoverflows 和 github 问题 - 但我没有与人们谈论的设备相同的设备,并且我拥有的设备和驱动程序(完全更新),我从来没有遇到过这个问题,直到现在。


    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.我不确定我的问题是glfw还是Windows 11,但我想弄清楚它会发疯。 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.作为参考,我运行的是 Windows 11,完全更新并更新了所有驱动程序。 RTX 3080 gpu and a Ryzen 5900x cpu. RTX 3080 gpu 和 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.有些人指责海盗船键盘,虽然我有一个 Ducky 键盘,但这似乎也不是原因。

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.编辑:似乎问题与有关但是这些指向硬件 ID 中带有 VID_262 的设备驱动程序。 But as I do not have any with that particular VID_262 I'm not sure where to start looking.但由于我没有那个特定的 VID_262,我不知道从哪里开始寻找。 Using DevCon.exe I generated this list but even after unplugging every device one by one, I can't find the issue.使用 DevCon.exe 我生成了此列表,但即使在逐个拔下每个设备后,我也找不到问题所在。 As of this edit, I've not yet been able to try running this on another device.截至本次编辑,我还不能尝试在另一台设备上运行它。

So it turns out VCPKG is evil.所以事实证明 VCPKG 是邪恶的。 I started having more issues - being that ImGui first compiled, but would give me read access violations when I used their NewFrame function.我开始遇到更多问题——因为 ImGui 第一次编译,但是当我使用他们的 NewFrame 函数时会出现读取访问冲突。 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.即使我通过 premake 从我自己的文件夹中获取所有库,Visual Studio 似乎也感到困惑,并试图将我生成的 lib 文件与我在 vcpkg 上安装的 lib 文件链接起来。

Turning off vcpkg has fixed both my linking errors and now makes glfw init very fast.关闭 vcpkg 修复了我的两个链接错误,现在使 glfw init 非常快。 I guess I should just uninstall vcpkg completely so it fixes the problem for other games or applications that use things like glfw.我想我应该完全卸载 vcpkg,这样它就可以解决其他使用 glfw 之类的游戏或应用程序的问题。

Long story short, VCPKG is a nightmare on my system.长话短说,VCPKG 是我系统上的噩梦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM