godot: Godot 3.1 running slower than Godot 2.1.4
Godot 3.1 and onwards
Windows 7 ATI Radeon HD 4870 Intel Core Duo 2.13Ghz (OC at 3.6Ghz)
(Edited out irrelevant stuff)
On a straight comparison between Godot 2 and Godot 3 (in GLES2 mode), I found that Godot 3 renders things much slower, at least in 2D.
I don’t know if this is a problem on my end, or if it’s a GLES2 problem, but I’d like to find out. Below there’s a zip file with two equivalent simple projects built on each godot version (2.1.4 vs 3.1), and I would appreciate if someone could confirm that this also happens on their side.
Simple Cell Rendering Test.zip
Both projects display a 64x40 grid of tiles from a cp437 font image, in three different ways, and I get these frame rates:
godot 2.1.4 | godot 3.1
TileMap ~820 fps | ~215 fps # using a TileMap
Sprites ~215 fps | ~135 fps # using Sprite nodes
Draw ~420 fps | ~150 fps # using 'draw_texture_region_rect()' in _draw()
As you can see there’s a substantial difference.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 10
- Comments: 21 (10 by maintainers)
Just a heads up, I now have batching working in a proof of concept for GLES2. It puts performance on a par with Godot 2.1 (or faster possibly, I don’t know any details of 2.1), typically 3-10x faster. It puts the simple 2d games I have tested up to 500-1000fps or more in my Intel integrated GPU, or > 4000fps with small screen (i.e. they are now fill rate limited).
I have to test the method works ok on mobile / all platforms (with regard to vertex buffer usage and stalls, when taking into account the problems with the previous author’s batching PR), and do some usability improvements (most of my tests have been with tilemaps so far, I need to check the other drawing methods get the speed boost properly), but barring regressions / problems on mobile I should be able to make a PR soon.
If the GLES2 works fine it is likely I can do similar in the GLES3 version (I’m presuming they use the same rough rendering method, I haven’t looked yet).
Yesterday evening and this morning I profiled and had a look at the 2d rendering code for the OP’s example. It is bottlenecked by the graphics driver, and it turns out the quads could be drawn much more efficiently.
Biggest point (as others have suspected) is the quads should really be batched and drawn in one drawcall, or low number of drawcalls.
Secondly, some of the current code is reusing vertex buffers to draw multiple 2d items per frame. This is highly likely to lead to bad performance, pipeline stalls, and possibly other visual bugs depending on drivers.
Thirdly, there is currently no concept of state in the calling code. By keeping track of state and minimizing OpenGL state changes I have increased FPS by approx 40% in the example project.
I will shortly make a work in progress PR for the state changes and have a look at this with @clayjohn. The state change speedup is essentially free.
Batching should result in far higher performance increases (2d should really be fill rate limited) but may be more involved, we can probably get this working depending on interest (I saw there was a previous batching PR #20965 but it got reverted, possibly it was causing pipeline stalls, some care has to be taken with dynamic vertex buffers).
That’s strange, if you set the audio driver to
Dummyon the project settings (Audio -> Driver -> Dummy) do you still get those big numbers?GLES2 batching is now available in Godot 3.2.2 onwards, closing. 3.2.4beta1 onwards also features GLES3 batching.
I am getting these results on i5 5300U, HD Graphics 5500:
Godot 3.1.2 Draw - around 100 Sprites - around 90 Tilemap - around 120
Godot 2.1.6 Draw - 200 Sprites - 180 Tilemap - 230
that’s pretty low. i don’t know if i am doing something wrong.
This issue should be tagged as urgent to 3.2, it’s because on Android mobile the frame drops below 60 fps just with two layers of Tilemap, My friend’s making a game and his layers of tilemap alone made it run below 30 fps. I believe that this issue could make Godot 3.1 no viable for some kind of simple 2d games, or Am I overreacting?