Describe the bug
I'm using OpenGlControlBase to render a scene via OpenTK. When the GPU bottlenecks (hits 100% usage), parts of my scene flicker in and out between frames. Objects seem to disappear starting in the positive X/Z corner (the last region to be drawn), and the missing sections always appear to be contiguous in draw order, so I believe the FBO is being presented before all the draw commands finish.
The flickering stops if I use glFinish() before scheduling the next render, but obviously this is not a real solution and destroys the framerate.
I'm not entirely sure why this manifests as flickering instead of tearing, maybe some part of the pipeline waits for writes to the texture to finish before it's used for rendering. I also don't know exactly how Avalonia is presenting the FBO, but from the symptoms my guess is that it uses another GL context to asynchronously draw it in the Avalonia frame (otherwise it wouldn't render until the control was done drawing).
To Reproduce
This may be difficult to reproduce, I'm seeing it when the dedicated GPU is overloaded, but the FBO is being drawn faster than the OpenGL control can finish drawing. It doesn't happen on my integrated GPU, probably because it stalls X11's presentation and the frame time is on the order of 100ms.
Expected behavior
There should be some mechanism for the OpenGL control to communicate it's done rendering before the FBO is presented. Alternatively, Avalonia should be doing its own double-buffering with FBOs and provide something like OpenTK's SwapBuffers() (even though it won't equate to a real GLX buffer swap).
Avalonia version
11.3.4
OS
Linux
Additional context
I can provide a video of the flickering if needed, but the actual program won't be much use because it's using several GB of non-standard assets (a large multi-LOD heightmap). Even a minimal example program will still probably be a bit large since it needs to bottleneck the GPU.
Describe the bug
I'm using
OpenGlControlBaseto render a scene via OpenTK. When the GPU bottlenecks (hits 100% usage), parts of my scene flicker in and out between frames. Objects seem to disappear starting in the positive X/Z corner (the last region to be drawn), and the missing sections always appear to be contiguous in draw order, so I believe the FBO is being presented before all the draw commands finish.The flickering stops if I use
glFinish()before scheduling the next render, but obviously this is not a real solution and destroys the framerate.I'm not entirely sure why this manifests as flickering instead of tearing, maybe some part of the pipeline waits for writes to the texture to finish before it's used for rendering. I also don't know exactly how Avalonia is presenting the FBO, but from the symptoms my guess is that it uses another GL context to asynchronously draw it in the Avalonia frame (otherwise it wouldn't render until the control was done drawing).
To Reproduce
This may be difficult to reproduce, I'm seeing it when the dedicated GPU is overloaded, but the FBO is being drawn faster than the OpenGL control can finish drawing. It doesn't happen on my integrated GPU, probably because it stalls X11's presentation and the frame time is on the order of 100ms.
Expected behavior
There should be some mechanism for the OpenGL control to communicate it's done rendering before the FBO is presented. Alternatively, Avalonia should be doing its own double-buffering with FBOs and provide something like OpenTK's
SwapBuffers()(even though it won't equate to a real GLX buffer swap).Avalonia version
11.3.4
OS
Linux
Additional context
I can provide a video of the flickering if needed, but the actual program won't be much use because it's using several GB of non-standard assets (a large multi-LOD heightmap). Even a minimal example program will still probably be a bit large since it needs to bottleneck the GPU.