An idea that was proposed before was to delegate the conversion (and the patents burden) to the OpenGL drivers, something like using glCompressedTexImage2D() / glGetCompressedTexImage(). Not sure whether there are hidden issues with that approach (except, well, requiring an OpenGL driver with compressed textures support), but at a first glance it doesn't look as something particularly hard to do.
Good idea. This new patch implements this approach. It seems to be working perfectly at least with the nvidia blob. It is also much smaller than the previous one, and doesn't require hacks like inverting colors and so on.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 15.02.2011 um 14:39 schrieb alberto@mattea.info:
Good idea. This new patch implements this approach. It seems to be working perfectly at least with the nvidia blob. It is also much smaller than the previous one, and doesn't require hacks like inverting colors and so on.<dxt1.patch>
It has one major architectural problem however. You need a GL context, but the SW conversion code cannot use one because it may be called from surface_gdi.c, which works without opengl. There are two ways out:
1) The easy one is to lift this restriction and just handle a context_acquire failure(ok, context_acquire needs some extensions for that). Error handling could just look like FIXME("no gl, bad luck"). But I think that is pretty ugly.
2) Implement the s3tc blits in the opengl blitting code in surface.c. Unfortunately the opengl blitting code is a mess, and adding s3tc blits won't make it better. To allow this we'll need to clean it up first. Rockerick was working on that but dropped the ball because other work interfered.