Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Massive ImGui input lag #118

Open
duckdoom4 opened this issue Jul 30, 2024 · 0 comments
Open

Massive ImGui input lag #118

duckdoom4 opened this issue Jul 30, 2024 · 0 comments

Comments

@duckdoom4
Copy link

duckdoom4 commented Jul 30, 2024

After following and implementing the chapter on ImGui, (which I think I've done correctly since everything seems to work fine) I noticed a large input lag when I drag the ImGui window.

engine.2024.07.30.-.12.33.05.04.mp4

It's a bit hard to tell due to a bug in gforce experience's recorder not moving the cursor image, but if you look at the cursor compared to the window movement you should be able to notice the delay. As you can see in the video my FPS is stable at 60, so it's not that.

My guess is that it's due to vsync wait order:

VulkanEngine::run(){
  // Update input using SDL_PollEvent/ ImGui_ImplSDL2_ProcessEvent
  // Render ImGui
 // call draw
}

VulkanEngine::draw(){
  // Wait for fence -> Already done on my GPU
  // vkAcquireNextImageKHR -> Wait for vsync
  // Wait done, so now we use the input that was collected before the wait to renderer. Aka. 'last frame's' data
}

If I understand it correctly, the vsync wait should actually happen after present / before SDL_PollEvent. That way we fetch the input etc. right before we render the frame

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant