[Mesa-dev] [PATCH 0/2] Optimizing glGetTexImage for Gallium
Marek Olšák
maraeo at gmail.com
Thu Feb 7 12:13:53 PST 2013
For reasons I don't know, WarCraft 3 under Wine is using glGetTexImage during rendering, which is killing framerate, and it doesn't seem to be a problem with Wine, so I decided to optimize that function properly. I implemented st_GetTexImage using a blit, where the target format exactly matches the user-requested format and type, so that memcpy can be used to read back the texture.
The framerate in WarCraft 3 is improved from 25 fps to 39 fps in the main menu, and from 0.5 fps to 32 fps in the game on a RV530 GPU. The game doesn't use glGetTexImage all the time, but it's used so often that it can ruin gaming experience.
The blit-based implementation falls back to _mesa_get_teximage if the blit cannot be done (lack of format support in the driver is the main cause). I had to add new red-alpha gallium formats to be able to blit luminance and intensity textures as red (luminance alpha should be returned as (L,0,0,A), etc). Also, the blit is skipped if the used-requested format and type already match the texture format.
I hope I didn't miss some corner case of glGetTexImage not covered by piglit. Please review.
Marek
More information about the mesa-dev
mailing list