-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Added "PerformGlSwapOnCpu" as fix for OpenGL in AngleEGL #19803
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
base: master
Are you sure you want to change the base?
Conversation
You can test this PR using the following package version. |
|
throw new OpenGlException("Unable to consume provided texture"); | ||
var snapshot = surf.Snapshot(); | ||
var raster = skiaOptions?.PerformGlSwapOnCpu == true ? snapshot.ToRasterImage() : null; | ||
var context = _gpu.GlContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try doing GrContext.Flush() or reading back 1 (one) pixel from the snapshot instead. I suspect that the underlying cause is some synchronization issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kekekeks I set the PerformGlSwapOnCpu to false. and added the following code
var snapshot = surf.Snapshot();
+ _gpu.GrContext.Flush();
+ using var bitmap = new SKBitmap(1, 1, SKColorType.Rgba8888, SKAlphaType.Premul);
+ bool success = snapshot.ReadPixels(bitmap.Info, bitmap.GetPixels(), bitmap.RowBytes, 0, 0);
var raster = skiaOptions?.PerformGlSwapOnCpu == true ? snapshot.ToRasterImage() : null;
While success is true, the image is still not displayed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a repro we could try?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there is a known issue with Skia 3.x and EGL. Are you experiencing the problem with 2.88?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, this issue is presenting on the Samples.ControlCatalog. However, from the bug referenced, I believe it may be a somewhat system dependant / intermittent issue, hence why I added it as a optional flag. If it's working on your system please let me know what data you require and I can hopefully provide it.
I'm using the default version of Skia on Avalonia which I believe is 3.119
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kekekeks I've just re-read your comment. I attempted to downgrade to Skia 2.88 but there was too many errors in the downgrade for me to fix.
@cla-avalonia agree |
What does the pull request do?
Added SkiaOptions.PerformGlSwapOnCpu, this causes the surface snapshot to be moved to the CPU which seems to increase stability although would cause a performance decrease
What is the current behavior?
AngleEGL is unable to render the OpenGL context. This has been reported as working on certain PC's but it seems to be a fairly common issue based on #18713
What is the updated/expected behavior with this PR?
On a PC where AngleEGL is unable to render, setting SkiaOptions.PerformGLSwapOnCpu = true, should fix the issue.
How was the solution implemented (if it's not obvious)?
ToRasterImage() on the snapshot will move the snapshot to the CPU, it's then drawn as expected
Breaking changes
None known of
Obsoletions / Deprecations
None
Fixed issues
#18713