-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Add wgpu multiviewport support #7557
base: docking
Are you sure you want to change the base?
Conversation
@ocornut & @eliasdaler The changes that have been done are:
Hopefully this sorts out multiviewport for desktop versions. Warning It seems to hang when trying to clean up the surface in some sort of race condition I assume. If I put a breakpoint inside the surface release code and resume the program hang is gone. I think the vulkan surface gets cleaned up before the internal swapchain gets deleted, this results in the program hanging. This issue seems to not happen on my windows machine, as it seems to be an issue with the vulkan part. Oddly enough it only happens when I drag the child window in and drop it, if I use the main window to encompass the child window there is no hang/crash. |
@@ -318,7 +330,10 @@ static bool InitWGPU(GLFWwindow* window) | |||
wgpu::Surface surface = wgpu::glfw::CreateSurfaceForWindow(instance, window); | |||
if (!surface) | |||
return false; | |||
wgpu_preferred_fmt = WGPUTextureFormat_BGRA8Unorm; | |||
wgpu::SurfaceCapabilities capabilities; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be questioned, so I will explain this.
This gets the first available texture format and presentation mode for the surface, on linux current with dawn since there is no FiFo presentation mode for vulkan the example will not work for linux.
This solves it, it will get the first available presentation mode which in most system the first one is FiFo and on linux will be Mailbox.
commit 3cd29e4 Author: Zelif <[email protected]> Date: Wed May 15 09:30:41 2024 +1000 Add Docking flag commit fb98ed9 Author: Zelif <[email protected]> Date: Sat May 11 08:53:39 2024 +1000 Changed window creation to be a user callback commit 8d08e0b Author: Zelif <[email protected]> Date: Sun May 5 05:34:59 2024 +1000 Updated wgpu example for multiviewport - Added instance to init model - Added Present mode for any new window to adhere by - Added Multiviewport render and update code - Changed Texture format and Present mode to select the first available mode for capabilities (some surface creation such as laptops might not support FiFo)
3cd29e4
to
14a89bc
Compare
Fixed IM_ASSERT for present mode to be ~0 not 0
Supersedes #7132
Add Multiviewport support to the WebGPU backend and example.
Tasks outstanding:
Note
Linux users(using Dawn):
Due to an intel bug on linux/vulkan, the Mailbox present mode is the only thing available using vulkan backend. This disables Vsync. Using both AMD/Nvidia seems fine to edit dawn's code directly but that isn't a solution.The old manual swapchain creation and usage and selecting FiFo is still working.Fixed with this commit:
https://dawn.googlesource.com/dawn/+/780bbd6fce6b8e81569406fdb4b490613d158733%5E%21/#F2