I'm pretty new to Love myself, and haven't (yet!) needed to worry about spritebatches. But then 11.0 came out, and I thought I read that it automatically batches draw calls into a spritebatch. So I still haven't looked into that because I thought it was already happening. Did I misunderstand something?
Is there an effective way to cut down lag?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Is there an effective way to cut down lag?
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Re: Is there an effective way to cut down lag?
You're right, I forgot about the new 11.0 auto-batching feature (still not related to quads).milon wrote: ↑Wed Apr 11, 2018 1:28 pm I'm pretty new to Love myself, and haven't (yet!) needed to worry about spritebatches. But then 11.0 came out, and I thought I read that it automatically batches draw calls into a spritebatch. So I still haven't looked into that because I thought it was already happening. Did I misunderstand something?
I haven't found any docs on how that's controlled, if it is controllable at all. The similar performance with 0.10 and 11.0 in the example I posted suggests that either auto-batching is inactive by default, or that the bottleneck is something else (e.g. total amount of pixels changed/rewritten).
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Is there an effective way to cut down lag?
It isn't, it's always on.
I just took a peek at the included resources. I suspect you're drawing lots of different images. Automatic batching is limited to (mostly) the same things as manual batching, so whenever you do some major graphics setting change (which includes a texture change), the batch ends and a new one begins. If you switch to a single ball image you'll probably see autobatching kick in. Note that this is why it's advisable to still batch manually wherever possible, so you can be sure it happens.
Can I also suggest looking at love.graphics.getStats, and in particular at the number of draw calls?
Re: Is there an effective way to cut down lag?
To clarify, I'm not the OP and I didn't write the game that was posted in the thread. I just posted this example:bartbes wrote: ↑Wed Apr 11, 2018 5:11 pmI just took a peek at the included resources. I suspect you're drawing lots of different images. Automatic batching is limited to (mostly) the same things as manual batching, so whenever you do some major graphics setting change (which includes a texture change), the batch ends and a new one begins.
From my reading of the release notes, "shapes" includes rectangles:pgimeno wrote: ↑Tue Apr 10, 2018 4:54 pm With this example program, I get ~320 FPS at 800x600 and ~123 FPS when maximized (approx. 1280x1024):
I get the same FPS in 0.10 and 11.0.Code: Select all
love.window.setMode(800, 600, {vsync=false, resizable=true}) local MAX = love._version_major > 0 and 1 or 255 function love.draw() love.graphics.clear() love.graphics.setColor(0,0,MAX) local w, h = love.graphics.getDimensions() love.graphics.rectangle("fill", 0, 0, w, h) love.graphics.rectangle("fill", 0, 0, w, h) love.graphics.rectangle("fill", 0, 0, w, h) love.graphics.rectangle("fill", 0, 0, w, h) love.graphics.rectangle("fill", 0, 0, w, h) love.graphics.rectangle("fill", 0, 0, w, h) love.graphics.rectangle("fill", 0, 0, w, h) love.graphics.rectangle("fill", 0, 0, w, h) love.graphics.rectangle("fill", 0, 0, w, h) love.graphics.setColor(MAX,MAX,MAX) love.graphics.print(love.timer.getFPS()) end function love.keypressed(k) if k == "escape" then love.event.quit() end if k == "f" then love.window.maximize() elseif k == "n" then love.window.restore() end end
11.0 release notes wrote: Improved performance when drawing Textures, shapes, lines, and points by automatically batching their draw calls together when possible.
Re: Is there an effective way to cut down lag?
Am I correct that this means (generally speaking) that when I draw a bunch of sprite quads from a single image file, Love will attempt to batch them all together? And thanks for the tip about manual batching - I'll put that back on my to do list.bartbes wrote: ↑Wed Apr 11, 2018 5:11 pm ...Automatic batching is limited to (mostly) the same things as manual batching, so whenever you do some major graphics setting change (which includes a texture change), the batch ends and a new one begins. If you switch to a single ball image you'll probably see autobatching kick in. Note that this is why it's advisable to still batch manually wherever possible, so you can be sure it happens.
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Is there an effective way to cut down lag?
I know, I was replying to your post though.
That's the idea.
Re: Is there an effective way to cut down lag?
Oh, then I don't understand what you mean here:
The test I posted includes no resources and it only draws rectangles, all the same size. The results I got refer to that text. What included resources do you mean? Where am I drawing lots of different images?
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests