Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Remembered basic principals and gained 20fps!

Author
Message
nz0
AGK Developer
16
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 27th Oct 2012 23:35
As Paul knows, I have been somewhat frustrated by the performance of AppGameKit on the XOOM tablet, especially when using full screen backgrounds, where the precious FPS dips to unacceptable levels.

Well, after quite a bit of optimisation I thought I would share my results.

I spent a while going through all my sprites, where I could set them to have no alpha, I did so and gained a fair bit of FPS. Luckily, a lot of my "level" sprites are rectangular, so need no alpha in this case. When alpha is used, the more sprites behind that sprite, then the worse it is. It could be worth planning ahead to save a lot of grief in future, as from my findings, alpha is one of the prime issues with this tablet (and probably others).

Next, I tried using someone elses recommendations for full screen backgrounds - which was scaling.
I didn't see any real improvements in speed on 107 (although it did make a big difference in earlier versions).

The most significant speed increase (and it's a big one) was this:

When using a fullscreen background, of course there's no need to clear the backbuffer.
I didn't really expect much overhead on backbuffer clearing, as this should be pretty quick and not something you worry about much.
Back in the old days (amiga ASM!) you used to clear the backbuffer with the blitter - or if you wanted to be super efficient, you would clear half with the blitter and half with the CPU, as one worked on odd cycles, the other even.

I thought I'd try using a different colour for the backbuffer fill first, as I could shed 50 lines or so of the background image this way - however, setting a colour for the backbuffer clear seemed to make it worse!

Then I switched off the back buffer clearing and lo - my ~40fps was back up to ~60fps again!

Whilst I'm really happy to have got full framerate back again with such an obvious and basic addition, how the hell can back buffer clearing be so expensive?

Is this just another XOOM crazy thing or what?

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 28th Oct 2012 01:08
Clearing the back buffer does use up some fill rate, it would be the equivalent of drawing a single opaque full screen sprite. However there is another scenario that may impact performance even more and that is if you use SetClearColor but don't also set SetBorderColor to the same value, since then it does two full screen clears, one for the borders and then one for the clear color. This won't be a problem in the next version since using SetClearColor without having specified a border color anywhere in your program will make it automatically call SetBorderColor to maintain performance, so it can then do both with a single clear call. I've not seen the clear buffer command use up quite that much performance though.

Login to post a reply

Server time is: 2024-04-27 21:07:49
Your offset time is: 2024-04-27 21:07:49