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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
AntonioModer
Party member
Posts: 202
Joined: Fri Jun 15, 2012 5:31 pm
Location: Belarus
Contact:

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

Post 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
Last edited by AntonioModer on Mon Dec 17, 2012 8:04 pm, edited 1 time in total.
User avatar
Lafolie
Inner party member
Posts: 809
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

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

Post 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?
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
User avatar
slime
Solid Snayke
Posts: 3161
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post 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
User avatar
Ruirize
Prole
Posts: 20
Joined: Tue Dec 13, 2011 9:02 pm
Location: England
Contact:

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

Post by Ruirize »

You're drawing the sprites with the same texture.

Batching these has little performance benefit.
User avatar
slime
Solid Snayke
Posts: 3161
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

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

Post by slime »

Ruirize wrote:You're drawing the sprites with the same texture.

Batching these has little performance benefit.
That's not true.
User avatar
Przemator
Party member
Posts: 107
Joined: Fri Sep 28, 2012 6:59 pm

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

Post 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.
User avatar
AntonioModer
Party member
Posts: 202
Joined: Fri Jun 15, 2012 5:31 pm
Location: Belarus
Contact:

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

Post 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 5285 times
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests