MacOS: Avoid rendering refresh while liveresizing #25026
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
To render while resizing Kodi would need to render in NSView drawrect, in the main thread. Since we currently render in the application thread there's no other way to solve this without simply avoid refreshing while doing live resizes. Resizing the window steals the gl context and we could simply be performing render operations. Also, locking or similar approaches have detrimental effect on the render performance because the context belongs to the view and we'd have to execute operations on the main thread.
So for now, let's just block refreshes while doing live resizes, the view gets refreshed at the end of the operation.
This was the approach the old sdl implementation used to follow.
For the future we should consider splitting the app rendering to an application component and later to another thread (so that platforms could decide which thread to use for rendering)
Motivation and context
Fixes #24954
How has this been tested?
Runtime tested on Macos, doing live resize
What is the effect on users?
App should not crash anymore on live resize. Solution isn't perfect (the previous rendered texture keeps on screen - scaled - until you stop resizing) but it's the possible solution
Screenshots (if appropriate):
Types of change
Checklist: