-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
EGL pixel format selection and OpenGL version parsing fixes #2438
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2438 +/- ##
=======================================
Coverage 25.84% 25.84%
=======================================
Files 226 226
Lines 19419 19424 +5
Branches 4714 4715 +1
=======================================
+ Hits 5018 5020 +2
+ Misses 13868 13850 -18
- Partials 533 554 +21
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
So, I tried it out and my simple sfml green circle app crashed at the start with the error |
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.
So, now that sfml 3 actually works on android, I tried this and the results are... questionable.
In normal sfml 3 I get these warnings/errors when running the app:
With these changes, I get the following:
But yeah generally, it does remove the OpenGL 0.0 error, but there still are errors.
My code for testing
#include <SFML/Graphics.hpp>
using namespace sf;
int main()
{
sf::RenderWindow window;
window.create(sf::VideoMode::getDesktopMode(), "SFML works!", sf::Style::Fullscreen);
window.setFramerateLimit(10);
sf::CircleShape shape(400.f);
shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
window.close();
if (event.type == sf::Event::LostFocus)
window.setActive(0);
if (event.type == sf::Event::GainedFocus)
window.setActive(1);
if (event.type == sf::Event::KeyReleased)
if (event.key.code == sf::Keyboard::Escape)
window.close();
}
if (!window.hasFocus())
continue;
window.clear(Color::Black);
window.draw(shape);
window.display();
}
}
That is the expected output with these changes. Because we are assuming version 1.1 if the version query fails, there is nothing for the settings check to warn about. The context is still not being able to be set active, thus the error messages. Are you running the code in debug configuration? If you run the code in debug configuration, |
1ca88b1
to
1fcb516
Compare
1fcb516
to
2d60a84
Compare
Rebased to master. |
2d60a84
to
037058f
Compare
Rebased to master. |
…r context types and make OpenGL context version parsing more tolerant of garbage data. Fixes #2395
037058f
to
ea7cd83
Compare
We've seen that in certain situations e.g. running on certain Android platforms (#2395) or running tests on the GitHub actions VMs, the OpenGL implementation can become pretty broken and start returning values that don't follow the specification. Because failing to parse an OpenGL context version doesn't really hinder us from continuing operation if everything else works, this change just assumes a conservative version and continues instead of causing the application to terminate.
The EGL pixel format selection procedure before this change relied on
eglChooseConfig()
. Using this function to select a pixel format bears the same problems as itswgl
andglX
counterparts (which we don't use): The way the SFML API is designed, the user has to resort to guessing a conservative configuration to request or else it will fail and graphics becomes unusable or even causes the application to terminate (see #2395).eglChooseConfig()
takes a set of attributes that it tries to match exactly to a pixel format available on the system. If an exact match isn't found it will just fail. The other context implementations are a bit more "user friendly" in this respect, if an exact match isn't found they will still return something that is a close enough match and emit a warning to the console if a certain attribute could not be met. This gives the user helpful feedback and allows them to adjust their requested settings based on e.g. tester feedback. This changeset makes EGL pixel format selection follow the same procedure as the other context types.Fixes #2395
Closes #2422