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

Author Topic: Does SFML batch render draw calls?  (Read 17544 times)

0 Members and 1 Guest are viewing this topic.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Does SFML batch render draw calls?
« Reply #15 on: February 04, 2009, 03:05:27 pm »
Quote
Edit: testing is not the point. I just mean not enabling and disabling everything for each Draw() call.

That's what I do when PreserveOpenGLStates is not set. But there are still many states to set for each drawable.

Quote
Nah, I expect the sprite to be drawn when calling Display(), so maybe you could put everything that needs to be drawn in a list and draw all that only when calling Display().

What about screenshots? PostFx? They both depend on what's currently drawn in the window.

Quote
When batching is available will you gain anything from it even if you don't draw a lot of sprites? Will batching improve performance on all drawables (including strings)? How many sprites can you draw before you notice a performance decrease? I don't use a lot of sprites, I do draw a lot of text how ever.

I don't think batching will be automatic, you will have to do it explicitely if you want to use it.
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Does SFML batch render draw calls?
« Reply #16 on: February 04, 2009, 06:45:15 pm »
Quote
Nah, I expect the sprite to be drawn when calling Display(), so maybe you could put everything that needs to be drawn in a list and draw all that only when calling Display().

I don't think this would increase performance. If you're drawing instantly or "just later" shouldn't increase any speed.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Does SFML batch render draw calls?
« Reply #17 on: February 04, 2009, 09:13:57 pm »
Quote from: "Laurent"
Quote
Edit: testing is not the point. I just mean not enabling and disabling everything for each Draw() call.

That's what I do when PreserveOpenGLStates is not set. But there are still many states to set for each drawable.

For example ?


Quote from: "Laurent"
Quote
Nah, I expect the sprite to be drawn when calling Display(), so maybe you could put everything that needs to be drawn in a list and draw all that only when calling Display().

What about screenshots? PostFx? They both depend on what's currently drawn in the window.

Are screenshots supposed to capture what has not been flushed ?

And couldn't post-fx effects be added in a what-is-to-be-done-when-displaying list ?



I'm interested in batching as I've begun a small 2D strategy game with three friends of mine and I noticed about 20% CPU usage (for one core) when drawing about 200 sprites. I expect to have much more to do with all the tiles of the map (about 20x20 grounds + some units => more than 400 tiles). And 40% CPU usage is really much for so few things..
Want to play movies in your SFML application? Check out sfeMovie!

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Does SFML batch render draw calls?
« Reply #18 on: February 04, 2009, 09:23:54 pm »
Quote from: "Tank"
Quote
Nah, I expect the sprite to be drawn when calling Display(), so maybe you could put everything that needs to be drawn in a list and draw all that only when calling Display().

I don't think this would increase performance. If you're drawing instantly or "just later" shouldn't increase any speed.

But you could know what are the render states required next, and skip the useless changes.
Want to play movies in your SFML application? Check out sfeMovie!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Does SFML batch render draw calls?
« Reply #19 on: February 04, 2009, 11:01:23 pm »
Quote
For example ?

Just a few actually: disabling alpha test, depth buffer and lighting. All others are not constant during the execution.

Quote
Are screenshots supposed to capture what has not been flushed ?

Screenshots are supposed to capture what has been drawn so far.

Quote
And couldn't post-fx effects be added in a what-is-to-be-done-when-displaying list ?

PostFx are supposed to be applied to what has been drawn so far.

For the two last things, I could end up writing a rendering commands queue, but I don't really want to do that ;)

Quote
I don't think this would increase performance. If you're drawing instantly or "just later" shouldn't increase any speed.

Drawing all at once enables to sort items to minimize rendering states switches. That's batching actually.
Laurent Gomila - SFML developer

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Does SFML batch render draw calls?
« Reply #20 on: February 05, 2009, 09:43:32 am »
Yeah, by grouping the batch jobs, it is.