Page 1 of 1

Turn off automatic batching in version 11?

Posted: Wed Apr 18, 2018 12:23 am
by Rickton
Is there any way to turn off the automatic spritebatching? Something's causing a weird display issue for me that wasn't there when I was on 10.2 (the tile that the player character's sprite is moving to flashes briefly with a black border around it), and I want to disable the batching to see if it's related.

Re: Turn off automatic batching in version 11?

Posted: Wed Apr 18, 2018 5:50 am
by raidho36
It's most definitely not related. Batching simply moves multiple quads for rendering at a time, as opposed to doing it one by one. You can use flushBatch function to force it to render whatever's in the batch and clear it.

Re: Turn off automatic batching in version 11?

Posted: Thu Apr 19, 2018 1:02 am
by Rickton
Yeah, I know what batching is, I was using it manually before 11 came out.
If something's wrong, it's my code interacting with the batching in some weird way, but I'd like to be able to turn the auto-batching off so I know whether I need to even look in that direction. I agree it's probably a dead end, but I didn't have this problem in 10.2 and I do now in 11, and I don't see what else changed that could be causing it, so it'd be nice to be able to check.

Re: Turn off automatic batching in version 11?

Posted: Thu Apr 19, 2018 1:27 am
by slime
Rickton wrote: Thu Apr 19, 2018 1:02 amI don't see what else changed that could be causing it, so it'd be nice to be able to check.
The internals of love.graphics have been substantially rewritten since 0.10. It takes advantage of more OpenGL 3+ features when available than before, which runs more risk of encountering bugs inside graphics drivers.

You can't turn off batching because there's no other codepath. You can test using OpenGL 2 features instead of OpenGL 3 (set the environment variable LOVE_GRAPHICS_USE_GL2=1 in a command prompt before running love from that command prompt), which will force love to use a different / often slower method of sending automatically batched vertices to the GPU, if your system was previously using OpenGL 3 features.

SpriteBatches use a different rendering path than love.graphics.draw(image) as well. If the issue only happens when a spritebatch is used but not when love.graphics.draw(image) is used (or vice versa) it can help narrow down where the problem is happening.

In any case I'd recommend making sure your graphics drivers are as up to date as possible.

Re: Turn off automatic batching in version 11?

Posted: Thu Apr 19, 2018 9:00 pm
by Rickton
slime wrote: Thu Apr 19, 2018 1:27 am
Rickton wrote: Thu Apr 19, 2018 1:02 amI don't see what else changed that could be causing it, so it'd be nice to be able to check.
The internals of love.graphics have been substantially rewritten since 0.10. It takes advantage of more OpenGL 3+ features when available than before, which runs more risk of encountering bugs inside graphics drivers.

You can't turn off batching because there's no other codepath. You can test using OpenGL 2 features instead of OpenGL 3 (set the environment variable LOVE_GRAPHICS_USE_GL2=1 in a command prompt before running love from that command prompt), which will force love to use a different / often slower method of sending automatically batched vertices to the GPU, if your system was previously using OpenGL 3 features.

SpriteBatches use a different rendering path than love.graphics.draw(image) as well. If the issue only happens when a spritebatch is used but not when love.graphics.draw(image) is used (or vice versa) it can help narrow down where the problem is happening.

In any case I'd recommend making sure your graphics drivers are as up to date as possible.
Cool, thanks for the information. One more question, is there any way to tell if something's being automatically batched vs straight up drawn? I've got some stuff I'm manually batching, and some other stuff that's probably a candidate for batching, but since it's not necessarily being drawn consecutively I'm not sure what's being batched and what's not (although when I check the number of draw calls it's pretty high so that makes me think it's not).