The testdevicecaps function considers compressed alpha format dfmt optimal
•SetTexture T->Texture
•For Each Material Group(M) of Texture Group (T)
•Set Material M->Material
•DrawIndexedPrimitive ( L->Vertices , M->Indices)
•End SceneSetting a texture is a more expensive operation than setting a material. This is especially true if the texture is not currently in video memory and has to be uploaded by the memory manager. This is why we make textures the primary key of the property chain. This final arrangement ensures that we are minimizing the number of SetLight, SetTexture, and SetMaterial calls and maximizing the number of primitives we can render with a single call to DrawIndexedPrimitive.
TeamLRN
The corresponding flexible vertex flags are shown below.
D3DFORMAT m_AlphaFormat;
This variable will not actually be used in this project, but will be used in future projects. TestDeviceCaps will also try and find the best supported texture format that supports an alpha channel. We can use this format if we have texture images that include alpha channels and require an appropriate format. By default, the TestDeviceCaps function considers compressed alpha format D3DFMT_DXT3 optimal, but will fall back to uncompressed 32-bit alpha formats or even 16-bit alpha formats if necessary.CGameApp::TestDeviceCaps
Below we show the last section of the CGameApp::TestDeviceCaps function. This code finds the best supported texture formats for both alpha and non-alpha texture surfaces. The rest of the function is unchanged from the previous incarnation.