Skip to content

Allow prepare_windows to run off main thread.#11660

Merged
james7132 merged 1 commit intobevyengine:mainfrom
hymm:allow-window-off-main-thread
Feb 2, 2024
Merged

Allow prepare_windows to run off main thread.#11660
james7132 merged 1 commit intobevyengine:mainfrom
hymm:allow-window-off-main-thread

Conversation

@hymm
Copy link
Copy Markdown
Contributor

@hymm hymm commented Feb 2, 2024

Objective

Solution

  • Conditionally compile prepare windows for different OS's
  • Seems like it's only the call to create_surface that needs to run on the main thread here.
  • I've only tested this on windows, but I do see prepare windows running on other threads.

Changelog

  • Allow prepare windows to run off main thread on platforms that allow it.

@hymm hymm changed the title only set non send marker on ios and macos Allow prepare_windows to run off main thread. Feb 2, 2024
@hymm hymm requested a review from james7132 February 2, 2024 05:25
@Kanabenki Kanabenki added A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Performance A change motivated by improving speed, memory usage or compile times labels Feb 2, 2024
Copy link
Copy Markdown
Member

@james7132 james7132 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to resolve #9964. Tested on Windows:

image

I'm usually not a fan of having function parameters be conditionally enabled based on platform, but systems are really used (normally) as normal functions. Merging as trivial.

@james7132 james7132 added this pull request to the merge queue Feb 2, 2024
Merged via the queue into bevyengine:main with commit c99ca79 Feb 2, 2024
tjamaan pushed a commit to tjamaan/bevy that referenced this pull request Feb 6, 2024
# Objective

- Allow prepare windows to run off of the main thread on platforms that
allow it.
- Fixes bevyengine#9964 on most
platforms.

## Solution

- Conditionally compile prepare windows for different OS's
- Seems like it's only the call to `create_surface` that needs to run on
the main thread here.
- I've only tested this on windows, but I do see prepare windows running
on other threads.

---

## Changelog

- Allow prepare windows to run off main thread on platforms that allow
it.
@hymm hymm deleted the allow-window-off-main-thread branch February 9, 2024 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen A-Windowing Platform-agnostic interface layer to run your app in C-Performance A change motivated by improving speed, memory usage or compile times

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Render App systems are blocking the Main app's primary thread

3 participants