On Thursday 17 July 2008 22:33:34 Stefan Dösinger wrote:
How many different conversions do the two games need?
The games I've mentioned before use simple things like X8R8G8B8 to R5G6B5 or X8R8G8B8 to R8G8B8. By using Google I didn't found much applications with this particular FIXME (simcity3k, stranded2 and "army men" game, which requires conversion from argb to indexed color).
I think that I saw "converter not found" messages some time ago (6-12 months ago) when I've been trying to run things like Sims1, SimCity 2000 rush hour, etc, probably with some other games.
In real DirectX/D3DX conversion code (with similar functionality) might be used with loading texture from different surface formats (like when trying to load A4R4G4B4 from A16R16G16B16 using D3DXCreateTextureFromFile, etc) and when dealing with D3DXFillTexture1D/2D/3D.
The use of this function might be somehow dependand on hardware. In this: http://ubuntuforums.org/showthread.php?t=741465 thread user experience game gui corruption, while on my machine without converter only water is corrupted, and converter isn't called for gui elements at all (I've been setting some channels to zero to check that).
One of my concerns is that this generic code is way slower than a separate conversion function for each pair of color formats.
Ideally, this requires benchmark. Conversion shouldn't be deadly slow when compared with optimized function. Besides there is only one optimized function implemented right now.
An "optimized" replacement for current generic procedure would need up to 240..380 functions, which will be error-prone, and will need either "macros magic" or just a lot of code. It'll be difficult to debug that.
If you are concerned about conversion speed, then conversion function can be easily modified in the way that it'll use generic conversion routine only if optimized conversion is not available. This way it'll be possible to optimize frequently-used conversions, while unusual ones will be still available.