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

Simultaneous context operations causes crash on AMD hardware #778

Closed
binary1248 opened this Issue Jan 12, 2015 · 5 comments

Comments

Projects
None yet
3 participants
@binary1248
Member

binary1248 commented Jan 12, 2015

If user code makes SFML access any pixel format or OpenGL context functions simultaneously from multiple threads, the application might crash on AMD hardware.

See: http://en.sfml-dev.org/forums/index.php?topic=12895.0

Test with:

#include <SFML/Graphics.hpp>
#include <deque>
#include <iostream>

void threadFunc(int i)
{
    sf::Context context;

    std::cout << "Context " << i << " created.\n";

    for(;;)
    {
        sf::Texture texture;
        texture.create(100, 100);
    }
}

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "Test");

    std::deque<sf::Thread*> threads;

    for (int i = 0; i < 40; i++)
    {
        threads.push_back(new sf::Thread(threadFunc, i));
        threads.back()->launch();
    }

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

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

    while (!threads.empty())
    {
        threads.front()->terminate();
        delete threads.front();
        threads.pop_front();
    }
}

If it doesn't crash on the first attempt, run it multiple times.

@eXpl0it3r

This comment has been minimized.

Show comment
Hide comment
@eXpl0it3r

eXpl0it3r Jan 16, 2015

Member

Can not confirm on my AMD Radeon HD 7500M/7600M card.

Member

eXpl0it3r commented Jan 16, 2015

Can not confirm on my AMD Radeon HD 7500M/7600M card.

@MarioLiebisch

This comment has been minimized.

Show comment
Hide comment
@MarioLiebisch

MarioLiebisch Jan 16, 2015

Member

Probably with an AMD CPU rather than a GPU? Or both?

Member

MarioLiebisch commented Jan 16, 2015

Probably with an AMD CPU rather than a GPU? Or both?

@binary1248

This comment has been minimized.

Show comment
Hide comment
@binary1248

binary1248 Jan 16, 2015

Member

Maybe it wasn't obvious enough, but this is an OpenGL context management issue, so completely unrelated to CPU 😁. Besides... I've never heard of a specific CPU model causing any specific problems... Those kinds of things died out in the last millennium 😉.

Member

binary1248 commented Jan 16, 2015

Maybe it wasn't obvious enough, but this is an OpenGL context management issue, so completely unrelated to CPU 😁. Besides... I've never heard of a specific CPU model causing any specific problems... Those kinds of things died out in the last millennium 😉.

@MarioLiebisch

This comment has been minimized.

Show comment
Hide comment
@MarioLiebisch

MarioLiebisch Jan 16, 2015

Member

You can never be sure with AMD. :D

Member

MarioLiebisch commented Jan 16, 2015

You can never be sure with AMD. :D

@eXpl0it3r

This comment has been minimized.

Show comment
Hide comment
@eXpl0it3r

eXpl0it3r Mar 26, 2015

Member

Has been fixed through #779

Member

eXpl0it3r commented Mar 26, 2015

Has been fixed through #779

@eXpl0it3r eXpl0it3r closed this Mar 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment