UniversalHookX: ImGui window doesn't show for Valheim - Vulkan
Awesome to see an imgui hook example for Vulkan. This is the only example I could find! ๐
When injecting for Valheim, it appears to inject fine. However the imgui menu is not showing.

Steps to reproduce
Download Vulkan SDK.
Un-comment #define ENABLE_BACKEND_VULKAN in backend.hpp.
Open project in Visual Studio 2022.
Re-include imgui_impl_vulkan files.
Compile project.
Start Valheim using Vulkan.
Inject dll.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 24 (11 by maintainers)
Just gonna copy and past my answer from the other thread.
I have found two issues with the Vulkan hook: First there is an issue with the semaphores of vkQueueSubmit. This leads to the application hanging.
The queue waits for the wait semaphores of vkQueuePresentKHR
pPresentInfo->pWaitSemaphoresbut doesnโt signal them again, so the original call of vkQueuePresentKHR just gets stuck on waiting for its original wait semaphores.I have fixed this by just setting the signal semaphores of vkQueueSubmit to the wait semaphores. This way it first waits then executes its bit and then signals them so vkQueuePresentKHR can do its part when the hook command buffer was executed.
I think there is really no need for the ImageAcquiredSemaphore and RenderCompleteSemaphore in the hook. They are only necessary for a stand alone ImGui application.
The second issue is that the dimensions of the frame buffer are not set at all. Strangely for me it still worked on NVIDIA cards but not on AMD cards. So the issue seems more like NVIDIA drivers/Vulkan runtimes are a bit more forgiving, dunnoโฆ I have fixed this by calling
GetClientRectifg_ImageExtentis still 0 and then setting the correct width and height in theVkFramebufferCreateInfo.and
I have addressed this and other issues in my repository where I wrote everything from scratch and without ImGu if you are looking for an alternative implementation:
https://github.com/belazr/EasyWinHax
Hope this helps!