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

Author Topic: Rendering in multithread cause crash. (On linux)  (Read 11903 times)

0 Members and 1 Guest are viewing this topic.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: Rendering in multithread cause crash. (On linux)
« Reply #15 on: January 15, 2015, 10:53:50 am »
You can use zillions of buffers, it won't eliminate the problem. When you render, you want to render the least state of your world. This typically gives the well-known input->update->render cycle, which makes sense, exactly in that order.

Input will modify the world's state. And rendering is dependent on the world state. So each step is basically waiting for the previous one to complete. In multi-threading language, this means synchronization, and that again means you lose nearly all advantages of multi-threading and get a lot of trouble.

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: Rendering in multithread cause crash. (On linux)
« Reply #16 on: January 15, 2015, 10:58:04 am »
Yes so you must have a design which doesn't need synchronisation otherwise you lost all benefits with the threads.

I have another message here :

[xcb]request 43 length 4 would exceed buffer size.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: Rendering in multithread cause crash. (On linux)
« Reply #17 on: January 15, 2015, 11:15:45 am »
Good luck with not synchronizing things that depend on each other. ;)

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: Rendering in multithread cause crash. (On linux)
« Reply #18 on: January 16, 2015, 09:18:02 am »
Hmmm..., I've found why it crash, you're creating the window in the glcontext, this is very bad. :/

When I create an sf::Context into an SDL_Window, it doesn't display anything. :/

So I've to create an SDL context into each render target class. :/
« Last Edit: January 16, 2015, 09:53:13 am by Lolilolight »