Page 1 of 1

[RESOLVED][0.8.0]SpriteBatch work slow with big image(64x64)

Posted: Sun Dec 16, 2012 2:27 pm
by AntonioModer
(Copy from https://bitbucket.org/rude/love/issue/5 ... mage-64x64)

Accelerator in Use: Mobile Intel(R) 965 Express Chipset Family
Driver Version: 6.14.10.5218
Operating System: Windows XP* Professional, Service Pack 3 (5.1.2600)

Image size = 64x64
FPS with SpriteBatch == FPS without SpriteBatch
What's the use?


Test scene:
https://bitbucket.org/rude/love/issue-a ... Batch.love

Re: [0.8.0] "SpriteBatch" work slow with big image(64x64 and

Posted: Sun Dec 16, 2012 8:43 pm
by Lafolie
You're drawing 10,000 sprites. I get an increase in fps (about 15) when switching, fps isn't always the greatest benchmark. When will you ever need 10,000 sprites?

Re: [0.8.0] "SpriteBatch" work slow with big image(64x64 and

Posted: Mon Dec 17, 2012 3:49 am
by slime
See my comment on your issue in the love source tracker.
slime wrote:You are drawing 10,000 overlapping sprites on the screen at once. Because the sprites use color blending, your GPU probably has to output a pixel for every single texel on every single sprite, regardless of whether it's visible in the final output or not.

Because of overdraw and blending, your GPU is processing up to 40,960,000 output pixels per frame, even though the screen size is only 480,000 pixels (that's a factor of 85x more pixels.) This is not a problem with spritebatches, it's a problem with what you're using them for. ;)
In other words: "Why doesn't my budget GPU perform well when I do something silly?" :P

Re: [0.8.0] "SpriteBatch" work slow with big image(64x64 and

Posted: Mon Dec 17, 2012 12:28 pm
by Ruirize
You're drawing the sprites with the same texture.

Batching these has little performance benefit.

Re: [0.8.0] "SpriteBatch" work slow with big image(64x64 and

Posted: Mon Dec 17, 2012 3:57 pm
by slime
Ruirize wrote:You're drawing the sprites with the same texture.

Batching these has little performance benefit.
That's not true.

Re: [0.8.0] "SpriteBatch" work slow with big image(64x64 and

Posted: Mon Dec 17, 2012 5:18 pm
by Przemator
I'm using about 10000 sprites in my game. I have this grass texture of 256x256 px. With a size of 1 m equal to 10 px, i need to cover the area of 2 km. I think, maybe I have no performance issues because 99% of the sprites are being "drawn" outside the visible window, so the GPU automatically does not render them. Anyway, recently I switched to quad + image wrapping, which is said to be even faster.

Re: [0.8.0] "SpriteBatch" work slow with big image(64x64 and

Posted: Mon Dec 17, 2012 7:47 pm
by AntonioModer
I understand this finally. And I made an example "spriteBatchExampleCorrect".
https://bitbucket.org/rude/love/issue-a ... rrect.love
explanation:
1. posting.php?mode=reply&f=4&t=12056#pr72198
2. my: Sprites should not overlap
Thank you slime :)
spriteBatchExampleCorrect (2500 sprites draw from spriteBatch)
spriteBatchExampleCorrect (2500 sprites draw from spriteBatch)
Безымянный.png (13.28 KiB) Viewed 5179 times