Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: RenderWindow crashes when creating in fullscreen style on Intel GPU  (Read 1756 times)

0 Members and 1 Guest are viewing this topic.

Maksat

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Hello! I've finally released my EasyPianoGame on Steam: https://store.steampowered.com/app/1126220/EasyPianoGame/

I knew a problem about crashing in fullscreen style for a long time. I could not solve it at that moment and just used
sf::VideoMode::getFullscreenModes();
sf::RenderWindow window (FSModes[0], "", sf::Style::None);
 
and forgot afbout it.

After launch, some players started complaining about resolution problems and I decided to add resolution change feature.
So what is going on: When I create fullscreen window like this
sf::RenderWindow window(sf::VideoMode::getFullscreenModes()[0], "", sf::Style::Fullscreen);
 
it crashes. Not necessarily every time but often enough. And also some times the program crashes when the window closes. It happens when I run program on Intel GPU. In AMD GPU it works fine, but super slow and heavily loads the CPU, this is another problem.

Here is example code:
#include <SFML/Graphics.hpp>

int main()
{
        auto FSModes = sf::VideoMode::getFullscreenModes();

        sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
        window.setFramerateLimit(60);

        sf::CircleShape shape(100.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::KeyPressed)
                                switch (event.key.code)
                                {
                                case sf::Keyboard::Escape:
                                        window.close();
                                        break;
                                case sf::Keyboard::Num1:
                                        window.create(FSModes[3], "", sf::Style::None);
                                        break;
                                case sf::Keyboard::Num2:
                                        window.create(FSModes[3], "", sf::Style::Default);
                                        break;
                                case sf::Keyboard::Num3:
                                        window.create(FSModes[3], "", sf::Style::Fullscreen);
                                        break;
                                case sf::Keyboard::Num4:
                                        window.create(FSModes[0], "", sf::Style::None);
                                        break;
                                case sf::Keyboard::Num5:
                                        window.create(FSModes[0], "", sf::Style::Fullscreen);
                                        break;
                                }

                        if (event.type == sf::Event::MouseButtonPressed)
                        {
                                auto pos = sf::Mouse::getPosition();
                                shape.setPosition(pos.x - shape.getRadius(), pos.y - shape.getRadius());
                        }
                }

                window.clear();
                window.draw(shape);
                window.display();
        }

        return 0;
}
 

Non full-screen window style switches work fine, but when you switch to full-screen style, with a probability of 50% it will crash. Debugger shows unhandled exception in ig7icd32.dll

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: RenderWindow crashes when creating in fullscreen style on Intel GPU
« Reply #1 on: October 08, 2019, 11:29:51 am »
Congrats on the Early Access! I'll definitely give it a try later.

Sounds like an outdated & buggy Intel driver.
What's your Intel Graphics Chip and what driver version are you running?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Maksat

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: RenderWindow crashes when creating in fullscreen style on Intel GPU
« Reply #2 on: October 08, 2019, 01:46:47 pm »
Thank you!

OMG! A year ago, I tried a lot of different driver versions for Intel HD graphics 4000 and did not succeed. This time I was sure that the matter was not in the driver and did not touch it. When I saw your reply, I decided to check and update if there are new versions. Problem solved! The new driver was 6 months older. Thanks for the quick response!

But why in other applications I did not notice problems with the full screen mode? After all, at a lower level, it all comes down to using the same piece of code (commands for full-screen mode in our case)?

And why it's working so slow on AMD discrete graphics card? The simple example above runs at about 40-50 FPS whith a long lags and uses 30% of my laptops i3-3120M CPU. Yes it is very old, but when it's running on integrated Intel GPU it uses almost 0%. I'll try to update AMD driver too, just in case =)