zeux/volk

Access violation in volkInitialize

benreid24 opened this issue · 2 comments

I am running into a similar issue to #58 and am getting a write access violation in the same location. Weirdly, however, the violation only occurs when I remove code from a virtual method. The code being removed is not executed prior to the access violation. (Example commit of what I mean: benreid24/BLIB@3046839).

volk mem

It appears that somehow the vkGetInstanceProcAddr variable is getting placed in readonly (or otherwise protected) memory. In the screenshot you can see that it has a non-null value prior to the assignment, and it's the assignment itself that is failing. I don't know how that could be corrupted at runtime because it's a direct access to a global variable. I am running Windows 10 with an Nvidia 1080 and using Visual Studio (MSVC) to build and run. Verified that the same issue also happens on a different machine (similar specs but different Nvidia GPU).

I unfortunately do not have a minimal reproducible example, but the error should be reproducible by running this example: https://github.com/benreid24/BLIB/blob/volk-working/examples/Graphics/main.cpp. The volk-broken and volk-working branches illustrate the error. To build after cloning:

  • git submodule update --init --recursive
  • cmake -S . -B ./build (use your generator of choice)
  • cmake --build ./build --target graphics
zeux commented

Something like this can happen due to symbol conflicts if your final executable includes a dependency on libvulkan1.dll (which is both redundant and prohibited when volk is used). It's possible that the presence or absence of some code in your executable causes a change in linking order somehow which makes this issue dependent on seemingly unrelated code. The libvulkan1.dll dependency could come directly from CMake settings or possibly from a dependency?

I would also recommend updating to latest volk; I think you're using 1.3.256, and there was a possibly related issue in volk's own CMakeLists.txt that could manifest depending on the configuration, which was fixed in 3f3e0cb (1.3.261 and later)

Good call! I updated to the latest volk and the issue stopped. Thanks for the help!