← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/use_image_cache into lp:widelands

 

Review: Needs Fixing

I wanted to test this branch on my laptop right now, and I have to say it's a bit of a nightmare, all of which can be roughly summarized as "this is probably not a good idea when VRAM is small". Let me list a number of problems in no particular order:

1) Our driver correctly announces support for textures up to 16384 in size, but when you actually allocate such a texture, it is 1GB large, which is going to fail when VRAM is not that big. So that possibility is something that the code should account for.

2) It seems there are plenty of fun bugs in our driver when textures become gigantic, so on the plus side, this is a great test case for making our driver more robust...

3) When I force max_size to 4096, I no longer hit critical driver bugs (only ones leading to rendering errors, oh well). There is still a problem though because the atlas textures add up to something like 110 million texels, which means that the textures are going to take more than 400MB (okay, maybe slightly under since there are also mask textures), which means that on integrated GPUs, you get texture thrashing. (Mine has a 512MB VRAM reservation, and whether it starts thrashing or not seems to depend on what compiz is currently doing - if I only had a single monitor running Widelands fullscreen it would probably okay, but as is performance is occasionally killed completely.)

Even without texture atlases, an integrated GPU is going to swap textures occasionally, but it's going to happen much less because the working set is smaller. With texture atlases, your working set is going to be everything almost all of the time.

This sucks. Summary:

(1) Trying to reduce the atlas size is more important than you thought.

(2) Probably the best quick fix option you have is to check VRAM size (e.g. using GLX_MESA_query_renderer) and add some heuristic to disable texture atlases below a certain VRAM size. It should be possible to override the heuristic via the command line. It's kind of sad that you then have a performance optimization that doesn't help the hardware that needs it most...

(3) A longer term fix could be some kind of texture streaming. I actually don't know the best way to do this.
-- 
https://code.launchpad.net/~widelands-dev/widelands/use_image_cache/+merge/282106
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/full_texture_atlas.


References