Much slower fill rate in 11.x vs 10.2

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.
Ross
Citizen
Posts: 98
Joined: Tue Mar 13, 2018 12:12 pm
Contact:

Much slower fill rate in 11.x vs 10.2

Post by Ross »

Hey all,

I've been profiling my project and I noticed that there's a pretty huge (~6x) performance difference between Löve 11 and Löve 10 when it comes to fill rate — how many times I am writing pixels to the screen.

Here's a minimal .love that I've used to test this:
Perf Test Love.love
(3.94 KiB) Downloaded 224 times
All it does is show the average DT and draw rectangular sprites over the whole window, with a transparent color. Use the up and down keys to draw more or fewer sprites, or space to toggle them all on and off.

My machine specs:
  • Windows 7, 64-bit.
  • CPU: Intel i5-3570K - 3.4 GHz
  • GPU: Intel HD 4000
  • I tried two different graphics drivers: The one windows thinks is "the best" and the one Intel lists as the latest (2018) for my hardware.
Running the test project, maximized on a 1920x1080 screen
  • With Löve 11.0/11.1/11.2 - I can only draw the sprite 2 times before DT goes above 16.6ms. (60 fps)
  • With Löve 10.2 - I can draw the sprite 12 times before DT goes above 16.6ms.
Incidentally, I also tried basically identical test projects with a couple other engines: Godot 3.0.6 and Defold 1.2.142. The Godot version made it up to 6 sprites, and the Defold version was on par with Löve 10.2 at 12 sprites.

So, the question is: What changed with Löve 11? Can it be fixed? Is there something I can do to with my projects to bring the performance back up, or should I just stick with 10.2 for now?

I also haven't tested this on other machines yet. If some other people could try it and see if it's the same for them, that would be great.
User avatar
zorg
Party member
Posts: 3441
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Much slower fill rate in 11.x vs 10.2

Post by zorg »

perf.png
perf.png (6.31 KiB) Viewed 7345 times
Now, i think the issue may be with the fact that löve's OpenGL requirements rose with 11.x, but i did read on these forums that there's some flag or something you can set so it forces löve to use a lower OpenGL version; that may fix your performance issue.

Apart from that, 11.x actually auto-batches those draw calls, so it should actually be WAY more performant than the 0.10.x versions.
(hence why the image i attached doesn't mean much; i can usually drew out ~40k shapes a frame without dropping below 60 FPS in 0.10.y, could probably do more with 11.x...i just got bored of spamming the up button)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Ross
Citizen
Posts: 98
Joined: Tue Mar 13, 2018 12:12 pm
Contact:

Re: Much slower fill rate in 11.x vs 10.2

Post by Ross »

OK, I didn't find the flag you were talking about, but I did come across `love.graphics.getRendererInfo`, which gave some interesting information:

Löve 10.2 is using: OpenGL 4.0.0 - Build 9.17.10.2932

Löve 11.x is using: OpenGL 3.3.0 - Build 9.17.10.2932

So it seems like there is some issue with Löve 11 not detecting, or just not using, the maximum supported OpenGL version on my system. I don't know if that would cause the 6x slow down, but it seems promising.
User avatar
zorg
Party member
Posts: 3441
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Much slower fill rate in 11.x vs 10.2

Post by zorg »

Found it: viewtopic.php?f=3&t=85065&p=219751&hili ... =1#p219721
It may or may not be helpful though... you could also try to see whether using SpriteBatches helps with regards to drawing more each frame without tanking the fps or not.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Ross
Citizen
Posts: 98
Joined: Tue Mar 13, 2018 12:12 pm
Contact:

Re: Much slower fill rate in 11.x vs 10.2

Post by Ross »

OK, thanks! Setting that flag actually worked, though in the exact opposite way from its intended purpose...? If I do SET LOVE_GRAPHICS_USE_GL2=1 and run the project with Löve 11, then it uses OpenGL 4.0.0, and renders just as fast as Löve 10.2. Otherwise it uses OpenGL 3.3.0 and runs way slower.

My brother tested it with his newer machine. Love 11 is also using OpenGL 3.3.0 for him:

Code: Select all

$ ./love-versions/love-0.10.2-win64/love.exe .
OpenGL  4.6.0 NVIDIA 389.27     NVIDIA Corporation      GeForce GTX 1060/PCIe/SSE2

$ ./love-versions/love-11.2.0-win64/love.exe .
OpenGL  3.3.0 NVIDIA 389.27     NVIDIA Corporation      GeForce GTX 1060/PCIe/SSE2
So, this seems like a bug in version 11? Or I'm misunderstanding the whole OpenGL version thing. Why would would Löve choose to use a lower version when a much higher one was available?

It was asked in the other thread but never answered: Is it possible to set "love_graphics_use_gl2" from the conf file or from inside a Löve game somehow?

With the tiny numbers of sprites I'm talking about, batching or not really doesn't make any difference. I'm only concerned with my fill rate / overdraw bottleneck here. I tried stopping Löve 11's auto-batching using love.graphics.flushBatch, and there was no perceivable difference. If I keep the sprites small instead of filling the screen with them, I have no performance problems. With small sprites, Löve 10.2 draws 1000 sprites with 1000 draw calls no problem. The difference I'm talking about is between drawing 2 million pixels and drawing 24 million pixels.
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Much slower fill rate in 11.x vs 10.2

Post by slime »

in love 11 with a system capable of OpenGL 3, love explicitly requests a Core Profile OpenGL 3.3 context. In love 0.10 or if LOVE_GRAPHICS_USE_GL2 is set, love requests a legacy OpenGL 2 context but the OpenGL specification allows drivers to actually use a higher version than requested, as long as the features of the higher version are a superset of the requested version (i.e. as long as nothing that you'd use in OpenGL 2 is different in the version chosen by the driver).

In any case, in love 0.10 or when LOVE_GRAPHICS_USE_GL2 is set love doesn't use any OpenGL 4 features, just mostly OpenGL 2 ones.

I have no idea why your GPU performance would be so different - the only per-pixel difference that there should be between standard love 11, and love 11 with LOVE_GRAPHICS_USE_GL2 set, is the former will use the GLSL 3.30 shading language whereas the latter will use GLSL 1.20. The shading language version shouldn't be affecting performance though (it just allows shaders to use more features if they want - but love's default shader should be effectively identical).
KayleMaster
Party member
Posts: 234
Joined: Mon Aug 29, 2016 8:51 am

Re: Much slower fill rate in 11.x vs 10.2

Post by KayleMaster »

I tried the same test, and although I didn't get much of a performance difference (it was nearly the same actually), love 11 uses OpenGL 3.3, while 10.2 uses 4.6.
What's the reasoning of this? Why does Love 11 use a lower version of OpenGL by default? I mean, I know you said "in love 11 with a system capable of OpenGL 3, love explicitly requests a Core Profile OpenGL 3.3 context" - why not request the latest available version?
Nelvin
Party member
Posts: 124
Joined: Mon Sep 12, 2016 7:52 am
Location: Germany

Re: Much slower fill rate in 11.x vs 10.2

Post by Nelvin »

A performance difference that high sounds like something fundamentally goes wrong.

It kind of sounds like the slow version is, for whatever reason, using a fallback to a software renderer - but I'm not sure if that's even an option these days, with shader based rendering?
Ross
Citizen
Posts: 98
Joined: Tue Mar 13, 2018 12:12 pm
Contact:

Re: Much slower fill rate in 11.x vs 10.2

Post by Ross »

OK, thanks, slime! That makes sense.

@Nelvin Yeah, something is weird. I'm wondering if my issue is a bug in the drivers for my specific hardware, though I did try two different versions. My brother also tested it on his older laptop with an Intel HD 3000. It uses OpenGL 3.1.0 with both versions of Löve and has no performance problems. Of course the other game engines I tested worked fine, so it has something to do with Löve, but who knows.

I guess that's a "No" to this question:
Ross wrote: Wed Nov 28, 2018 12:52 pm Is it possible to set "love_graphics_use_gl2" from the conf file or from inside a Löve game somehow?
[Edit] OK, I figured out how to make a shortcut to "set love_graphics_use_gl2=1" and run a löve game from a local path at the same time. That should do the trick for windows anyway.
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Much slower fill rate in 11.x vs 10.2

Post by slime »

FYI the fill rate issue should be fixed by this change (coming in love 11.3): https://bitbucket.org/rude/love/commits ... caceaad5e8
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 87 guests