OpenBVE icon indicating copy to clipboard operation
OpenBVE copied to clipboard

Drawing large numbers of strings on-screen causes FPS drops

Open adfriz opened this issue 2 years ago • 6 comments

Description

when playing any route using any train, the fps decreasing 20fps from around 60-70~ to 40-50~

Reproduction

play as usual, pressing ctrl +x to show fps and see the fps. press F10 and make sure fullscreen debug is displayed, now compare the fps between debug displayed and not displayed. even in 2D cab mode the fps still dropping when open debug menu.

Route

any

Train

any

Logs

no crash, no logs

Related information

  • Operating system: windows 10 20H2
  • Method of control (Keyboard and mouse)
  • Openbve 1.8.4.2 portable version
  • CPU : i3 2320m
  • GPU : NVIDIA GT630M

Although when playing i don't always open the debug menu, its weird why opening that menu is decreasing fps so much 🤔

adfriz avatar Dec 08 '22 03:12 adfriz

It definitely drops fps. I also checked. However, since it is a debug screen, it does not interfere with driving, so I thought it would be fine to leave it as it is. My PC's spec: OS:Ubuntu 20.04 LTS 64bit CPU:AMD® Ryzen 7 2700x eight-core processor × 16 Memory:31.3GB Graphic:AMD Radeon RX 590 Series (POLARIS10, DRM 3.40.0, 5.11.0-40-generic, LLVM 12.0.0)

Screenshot from 2022-12-09 20-15-55 Screenshot from 2022-12-09 20-16-04 Screenshot from 2022-12-09 20-15-41 Screenshot from 2022-12-09 20-15-47

ginga81 avatar Dec 09 '22 11:12 ginga81

The same is true of the ATS Debug interface. For me, it was uncomfortable. Using panels and Animated objects, the issue is not so important either.

My not-so-good PC specs: PC: Lenovo G360 OS: Windows 7 CPU: Intel Pentium CPU P6200 Dual Core GPU: Core Graphics (Nvidia GeForce 310M not used) Hard Drive/Virtual RAM: WDC WD3200BPVT-24JJ5T0 ATA device RAM: 2G

JunmoreHeavyBox avatar Dec 09 '22 13:12 JunmoreHeavyBox

@ginga81 thanks for confirm it, i though its only me who encounter it😅.

I hope this bug is a clue for optimization improvement.

@JunmoreHeavyBox yup, this issue not important but maybe can marked as known issue so if other people encounter similar bug as this, now they can dont blame their pc 😀.

Why you didnt use your nvidia gpu ?

adfriz avatar Dec 09 '22 14:12 adfriz

There is a similar situation in Object viewer and Route viewer, I can visually see the change in frame rate when switching the interface. Some kind of benefit of low performance? Optimization sensitivity.

Regarding gpu, some kind of PC failure. (= n =)

JunmoreHeavyBox avatar Dec 09 '22 14:12 JunmoreHeavyBox

Well on object viewer i havent see any fps drop when hide/unhide the interface, unless load a 50000+ heavy object 😅.

Benefit of low spec ? Yes if its only affect a low spec user but I think not, as you see ginga81 have a modern cpu and gpu in the screenshot he even touch 300+ fps in 2d cab but when debug menu is on its drop to 240~ fps. Dropping 30+ fps when only displaying more text as overlay its a sign of something not right under the hood.

adfriz avatar Dec 09 '22 14:12 adfriz

I can see the problem, but I don't think there's a good solution without re-writing the entire text drawing routine pretty majorly.

TLDR: https://github.com/leezer3/OpenBVE/blob/master/source/LibRender2/Text/OpenGlString.cs#L210 Each string draw call dynamically gets and combines the string characters into a single texture before drawing it, which is nastily slow.

As this only really affects the debug overlay, it's somewhat low on the priority list.

leezer3 avatar Dec 09 '22 17:12 leezer3