adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] Porting to SDL2


From: Kai Sterker
Subject: Re: [Adonthell-devel] Porting to SDL2
Date: Fri, 10 Jun 2016 10:20:31 +0200

On Thu, Jun 9, 2016 at 10:25 AM, Kai Sterker <address@hidden> wrote:

Unfortunately, I did notice a performance degradation during the dialogues. Especially with true type fonts it takes ages to render the text. CPU load goes way up, and I no longer can quickly skip through dialogues. Will take a look into that today.

First round of optimizations are in. At least on my PC that lets me rush through dialogues once again. I'll see how it fares on the 800Mhz iBook when I do the OSX binaries over the weekend. There's still room for improvement when it comes to text rendering.

Btw., I came across some interesting reading regarding optimization (and how to locate where the time gets wasted):

http://stackoverflow.com/questions/375913/what-can-i-use-to-profile-c-code-in-linux/378024#378024
http://stackoverflow.com/questions/1777556/alternatives-to-gprof/1779343#1779343

Applying the described, simple technique, at first it seemed that all Adonthell ever does in the absence of user input is sleeping. Pressing a key in a dialogue (where the performance issue was glaring obvious) and then quickly switching to the debugger to pause was also not proving helpful, as I was way too slow. So I ended up adding an endless loop into the dialogue window, that would constantly rebuild it from scratch. Now, pausing in gdb would always point towards SDL_UnlockTexture, which is indeed quite a costly operation, as it needs to convert the pixel data in main memory to the proper format and then transfer it to the GPU. So the logical fix was to limit the amount of pixels that needed to be transferred when drawing a letter. Before the change, the complete label got transferred each time a letter was drawn. Now, only the portion actually occupied by the letter is transferred. While this makes the code a bit more ugly, the performance gain was huge.

Well, so much for that.

Later,

Kai


reply via email to

[Prev in Thread] Current Thread [Next in Thread]