URL:
<http://gna.org/patch/?1141>
Summary: Graphics optimization
Project: Battle for Wesnoth
Submitted by: cjhopman
Submitted on: Thursday 03/26/2009 at 07:51
Priority: 5 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
So, first off, this patch is not complete... I would mostly just like others
to test it.
To test this be sure to run with --no-delay and --max-fps 1000. The
--no-delay is needed because there is currently a 20ms delay on every frame
from controller_base.cpp (that delay is an old piece of code that I am
hesitant to remove without good testing). The biggest difference with this
patch will be when scrolling. Without this patch I would get 10-15 fps when
scrolling and a lot of tearing. With the patch, 35-40 fps and so much nicer
looking.
Why do we need this patch? Well, basically we get a list of rectangles of
areas that need to be redrawn. We don't want to redraw the same area multiple
times, though. So previously we would test every rectangle against every other
for containment and throw out ones that are contained in another one. But with
up to 600 rectangles per frame, this is way slow.
In this patch, I change it so that basically we take the rectangles, scan
them onto a grid with resolution based on the triangle size. Then when we
need to redraw, we merge all the grids down to the finest resolution one (128
x 128, currently) and then do a scan across this to find rectangles.
This outperforms the current implementation in all but the simplest cases.
That is, we get 500-700 fps instead of 1000fps when very little needs
updating, but is significantly better than the current in the worst cases. I
have not found a case where this performs poorly, and that is partly what I
need it tested for. I have set up several stressful cases and it has done
well.
I also tested with not using the hierarchical structure, that is just using a
single grid to scan the rectangles onto. This performed slightly better than
the approach in the patch in simple and moderate cases, but was outperformed
in worse cases.
So, I'm currently more worried about the performance and overall approach
than I am with some of the style and specifics. Especially if you can find a
situation where this performs poorly, please upload it.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Thursday 03/26/2009 at 07:51 Name: quadtree.patch Size: 5kB By:
cjhopman
<http://gna.org/patch/download.php?file_id=5509>
_______________________________________________________
Reply to this item at:
<http://gna.org/patch/?1141>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs