Page 2 of 2

Re: Spritebatches and perspective

Posted: Wed Sep 21, 2016 3:24 pm
by KayleMaster
You can only trade limitations for other limitations so you are correct. I guess we won't know for sure until we measure it.

Re: Spritebatches and perspective

Posted: Wed Sep 21, 2016 4:19 pm
by raidho36
Exactly. The #1 principle you should use when optimizing things is "Don't Guess; Measure".

I'm eager to see what Vulkan upgrade could bring to the engine. New API is substantially better suited for large amounts of draw calls. Hopefully this will eliminate the need for sprite batching as well as using atlases.

Re: Spritebatches and perspective

Posted: Wed Sep 21, 2016 5:01 pm
by Positive07

Re: Spritebatches and perspective

Posted: Wed Sep 21, 2016 5:05 pm
by raidho36
Vulkan is a successor to OpenGL so it will get deprecated eventually. No point in clinging to it now.

Re: Spritebatches and perspective

Posted: Wed Sep 21, 2016 5:24 pm
by Positive07
Well remember that OpenGL 2.1 (the oldest supported version used by LÖVE) is 10 years old, so if we say that 10 years need to pass in order for LÖVE to deprecate an OpenGL version then in order to deprecate the latest (OpenGL 4.5) entirely that would be around 2024.

So yeah LÖVE will use Vulkan at some point, but not anytime soon.

Plus it is another backend that LÖVE needs to support and I don't think there is someone that is interested in writing code for that, with no observable benefit at the short run (there may be far more benefits in the long run, by changing LÖVE API's to better fit the Vulkan ones), and it being a really new API it is not completely stable nor supported by most GPU's.

So yeah, my point was, that I don't think LÖVE will use Vulkan anytime soon, ask slime or other dev if you want to, but there is no point in us discussing this since we won't decide on the future of LÖVE and we are derailing the thread so we better stop

Re: Spritebatches and perspective

Posted: Thu Sep 22, 2016 12:37 am
by slime
KayleMaster wrote:It doesn't send anything to the gpu, I use :flush to send the whole sprite batch to the gpu after adding the 4096 tiles using :add.
Correct. And many SpriteBatch:add calls every frame is still a lot more efficient than the same number of love.graphics.draw calls, since the former uses batching (both when transferring the data to the GPU and when drawing it) and the latter doesn't.
raidho36 wrote:I'm eager to see what Vulkan upgrade could bring to the engine. New API is substantially better suited for large amounts of draw calls. Hopefully this will eliminate the need for sprite batching as well as using atlases.
Vulkan's API is verbose and difficult to use - it requires a lot of code and careful use of its memory allocation and synchronization functionality... just to get roughly on par with OpenGL in terms of performance (and correctness).

Vulkan can reduce the overhead for draw calls, but the reality is that the underlying GPU hardware doesn't like small vertex counts in draw calls either. Batching will always bring better performance, lower power usage, and better utilization of the GPU.

That said, there are other things that can be done in love's code and APIs besides using a different graphics API, to improve performance in cases like this. Stay tuned... :)

Re: Spritebatches and perspective

Posted: Thu Sep 22, 2016 4:57 am
by Positive07
Oh, totally forgot about flushing! The "inefficient" 4096 add calls may be better than sorted draw calls, and far more efficient than 1x1 clusters

And damn you clickbait slime, you got me hooked!