-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
OpenGlControlBase stops rendering randomly. #17865
Labels
Comments
I'd think you need to give the renderer time to finish, that's what Dispatcher ensures. So probably by design. @kekekeks can you confirm that? |
If it's by design, i think we should prevent to call |
try use
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
A
OpenGlControlBase
control which continuously callRequestNextFrameRendering
inOnOpenGlRender
, will stop rendering after a random period of time.OnOpenGlRender
will never be called until until something else triggers rendering like resizing window.__To Reproduce
A continuously rendering
OpenGlControlBase
control and waiting for a memont.Expected behavior
No response
Avalonia version
11.2.3
OS
No response
Additional context
I have debugged and found the direct reason. It's related to compositor. But I am not sure how to fix it.
In
Compositor.RequestCompositionBatchCommitAsync
method:When
pending
isnull
(usually not), we will call_triggerCommitRequested
directly. It will callMediaContext.ICompositorScheduler.CommitRequested
finally.And in
MediaContext.ICompositorScheduler.CommitRequested
:The
compositor
is already in_requestedCommits
, andScheduleRender
will not be called. So the control won't render anymore.The call stack at this time is like this (the line numbers are decompiled by Visual Studio, just ignore them):
In
MediaContext.CommitCompositorsWithThrottling
:_requestedCommits
will be cleared afterCommitCompositor
. So callingMediaContext.ICompositorScheduler.CommitRequested
insidesCommitCompositor
will always cause this issue.So, apparently, a workaround is not calling
RequestNextFrameRendering
directly inOnOpenGlRender
but viaDispatcher.Post
.In this sample,
RequestNextFrameRendering
is called directly. But in this sample, it's called viaUIThread.Post
.Is this a bug or designed to calling
RequestNextFrameRendering
viaUIThread.Post
?The text was updated successfully, but these errors were encountered: