[Mesa-dev] [PATCH 0/2] Optimizing glGetTexImage for Gallium

Ian Romanick idr at freedesktop.org
Thu Feb 7 17:10:03 PST 2013


On 02/07/2013 12:13 PM, Marek Olšák wrote:
> 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.

In DX, apps can call LockSurface to get direct access to the 
framebuffer.   There's no such thing in OpenGL, so Wine has to fake it 
with GetTexImage or ReadPixels.

> 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
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>



More information about the mesa-dev mailing list