Ok, so I'm trying to weigh pro and con using various texture compression methods. I spend 99.999% of my time programming 2D sprites for Windows machines using DirectX.
So far I have looked at the alpha-trim texture packaging (SpriteSheets), and this seems like a decent way to get a bit more performance. Now I'm starting to look at the texture format in which they are stored; currently everything is stored as * .PNG.
I heard that * .DDS files are good, especially when they are used with DXT5 compression (/ 3/1 depending on the task), because the texture remains compressed in VRAM? People also say that since they are already DirectDraw Surfaces, they load much faster and faster.
So, I created an application to test this; I call the line below 20 times, freeing the texture between each call.
for (int i = 0; i < 20; i++) { if( FAILED( D3DXCreateTextureFromFile( g_pd3dDevice, L"Test.dds", &g_pTexture ) ) ) { return E_FAIL; } g_pTexture->Release(); g_pTexture = NULL; }
Now, if I try this with the DXT5 texture, it will take 5 times longer than when loading into a simple * .PNG. I heard that if you do not create Mipmaps, it may go slower, so I double-checked it. Then I changed the program that I used to generate the * .DDS file, switching to my own NVIDIA nvcompress.exe, but none of them had any effect.
EDIT: I forgot to mention that files (both * .png and * .dds) are the same image, just saved in different formats. (Same size, amount of alpha, that's it!)
EDIT 2: Using the following options, it loads almost 2.5 times faster AND consumes LOT less VRAM!
D3DXCreateTextureFromFileEx( g_pd3dDevice, L"Test.dds", D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, D3DX_FROM_FILE, 0, D3DFMT_FROM_FILE, D3DPOOL_MANAGED, D3DX_FILTER_NONE, D3DX_FILTER_NONE, 0, NULL, NULL, &g_pTexture )
However, now I am losing all my transparency in the texture, I was looking at the texture of DXT5, and it looks great in Paint.NET and DirectX DDS Viewer. However, when loaded in full transparency, it turns into a solid black color. Problem with ColorKey?
EDIT 3: Ignore this last bit, I was an idiot and in my quick response quickly forgot to turn on Alpha-Blending on D3DXSprite-> Begin (). Doh!