Jump to content
  • Advertisement
Sign in to follow this  

how to check texture capabilities

This topic is 4379 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey guys im using directx 9 and was wondering how large a texture the video card supports? my program uses a 2048 x 2048 map and runs fine on my desktop. It will run on my laptop, but it is much much slower. i guess my question is if the texture is too large, will directx resize it or will it just not work. the second part is what is the largest texture suggested anymore?

Share this post

Link to post
Share on other sites
For your second question, you could use this online Direct3D caps wizard to see what modern hardware supports. I think 9 series radeon's support at most 2048x2048 and geforce has supported up to 4096x4096 for a while.

For the first, I would expect creation of the texture to fail, but I am not completely sure as I haven't tested it [smile]


Share this post

Link to post
Share on other sites
If the requested size is too large, the call will probably fail with D3DERR_INVALIDCALL or D3DERR_INVALIDPARAM. You can test that by trying to create a 65536x65536 texture or something and see what the function returns.

You can determine the largest texture the card supports by querying the caps like so:

LPDIRECT3D9 pD3D; // Your D3D pointer (Assume this is some valid pointer)
D3DCAPS9 theCaps;
HRESULT hResult = pD3D->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &theCaps);
// Something is very wrong
// Handle error (Probably exit app)

After that code, the maximum texture size will be in theCaps.MaxTextureWidth and theCaps.MaxTextureHeight. Most cards these days support non-square textures, but if you're targetting old hardware or if you just want completeness, it may be worthwhile checking if theCaps.TextureCaps contains D3DPTEXTURECAPS_SQUAREONLY. If it does, you can only create square textures.

D3DX will try to work around the limits of the device - it'll make power-of-2 textures where needed, and it'll make square textures where needed. As far as I know, it won't cope with textures that are too large though.

EDIT: Assuming a 32-bit texture, 2048x2048 will be 16MB. With mip-maps, you're looking much larger. Unless this is for a sprite sheet of some sort that will be staying in VRAM for a long period of time, I'd recommend breaking it down into several smaller textures. This will also allow your app to run on lower end cards.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!