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

Vulkan sometimes present while unfinished #4919

Closed
valaphee opened this issue Dec 21, 2023 · 7 comments
Closed

Vulkan sometimes present while unfinished #4919

valaphee opened this issue Dec 21, 2023 · 7 comments
Labels
api: vulkan Issues with Vulkan type: bug Something isn't working

Comments

@valaphee
Copy link
Contributor

Description
Sometimes, during the configuration of the surface, at start or when resizing, the frames get presented even though they are still written to, which leads to flickering.

The frame rate also increases from 1200 FPS to 2000 FPS which lead me to this conclusion.

Repro steps
Run wgpu water example in release mode with Vulkan backend.

Expected vs observed behavior
The rendering finishes before presenting, even though shouldn't there be triple buffering?

Extra materials
https://github.com/gfx-rs/wgpu/assets/32491319/ca41f826-d735-43ee-9d72-cd90935930b1
(epilepsy warning)

Platform
Latest commit of wgpu 79e51692, Windows 11 Build 22631, AMD Radeon RX6900 XT, with latest drivers 23.11.1

@valaphee valaphee changed the title Vulkan already presenting during rendering Vulkan sometimes present while unfinished Dec 21, 2023
@valaphee
Copy link
Contributor Author

valaphee commented Dec 23, 2023

It's most likely not fixable in wgpu, as I couldn't reproduce it on my AMD iGPU, and Nvidia GPU. There is also no error reported when enabling validation layers.

It might be also solved by using semaphores instead of fences for presenting, as the fences sometimes just get ignored
#4775

@ids1024
Copy link
Contributor

ids1024 commented Jan 4, 2024

The rendering finishes before presenting, even though shouldn't there be triple buffering?

https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPresentModeKHR.html specifies which presentation modes can result in tearing and which cannot. These map to https://docs.rs/wgpu/0.18.0/wgpu/enum.PresentMode.html, which also mentions which can have tearing.

Looks like the examples are all using PresentMode::Fifo, so I believe that means this shouldn't be happening.

It's most likely not fixable in wgpu, as I couldn't reproduce it on my AMD iGPU, and Nvidia GPU. There is also no error reported when enabling validation layers.

I don't think validation layers catch everything, and incorrect use of Vulkan may work on some drivers but not others. Though driver bugs are definitely a possibility too.

@valaphee
Copy link
Contributor Author

valaphee commented Jan 5, 2024

I assume its also a driver bug, or some race condition when creating the fence, as most of the times the fence just works fine, and its also only occuring in release mode, not debug.

But its definitely not tearing because the frame is not finished and already presented, which is the opposite of tearing.

@cwfitzgerald
Copy link
Member

Wait does this only happen on the water example?

@valaphee
Copy link
Contributor Author

Got it also reproduced in the mipmap example, but its barely visible, the fps just jumped from 2000fps to 2800fps.

@cwfitzgerald
Copy link
Member

cwfitzgerald commented May 8, 2024

@valaphee can you try #5681 to see if this fixes your issue?

@valaphee
Copy link
Contributor Author

Unfortunately I didn't got it reproduced on trunk, as I switched to Linux (and only have a clean install of Windows);

you can probably close this issue.

@cwfitzgerald cwfitzgerald closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vulkan Issues with Vulkan type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants