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

Update glfw/vulkan backend to use explicit context and add single-threaded multiple context demo. #1

Open
wants to merge 5 commits into
base: docking-explicit
Choose a base branch
from

Conversation

FunMiles
Copy link
Contributor

In this PR, the first commit adds the backend support in glfw/vulkan for multiple contexts to the docking branch.
The second commit changes the demo app to show a running example of three contexts each running a demo-window with docking enabled.

Note that the second diff creates a new class ThreadWindow. This class will be used almost unmodified in an upcoming demo with multi-threading active. The difference is that in this commit, wait_for_main which runs a functor on the main thread executes directly, as there is only one thread. In the multi-threading demo, that function passes the functor to the main thread and waits until it has finished.

@FunMiles FunMiles changed the title Update glfw backend to use explicit context and add single-threaded multiple context demo. Update glfw/vulkan backend to use explicit context and add single-threaded multiple context demo. Jan 22, 2024
@FunMiles
Copy link
Contributor Author

The third commit demoes multi-threaded Vulkan work combined with imgui.
Note that the approach of running on the main thread all interactions with the event system and for presenting the graphics impacts the frame rate at least on Mac-OS. Compare:

  • with one context/producer thread, 120fps
  • with two contexts/producer threads, 60fps
  • with three contexts/producer threads, 40fps

@FunMiles
Copy link
Contributor Author

The performance is improved with having a shorter lock on the mutex for main thread job queue.

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

Successfully merging this pull request may close these issues.

1 participant