Texture dimensions in DirectX 9

Started by
11 comments, last by FrankWoo 15 years, 6 months ago
I had a quick question. I want to be able to make games for a wide range of machines with my game engine in progress, and I was wondering if I can load textures that are larger than 256x256 without fear of it not being supported on certain machines. In other words, if I use textures larger than 256x256, will my game not run on some computers? Thanks!
Advertisement
Most DX9-level GPU's supported up to 2048x2048. The later SM3.0 GPU's supported 4096x4096.
This question comes up occasionally, and I really wonder why, considering that cards limited to 256x256 have IIRC last been sold in the year 2000, i.e., 8 years now. Can you tell me where you got the idea that 256x256 would be a limitation?
Quote:Original post by ET3D
This question comes up occasionally, and I really wonder why, considering that cards limited to 256x256 have IIRC last been sold in the year 2000, i.e., 8 years now. Can you tell me where you got the idea that 256x256 would be a limitation?
Doesn't the DX9 spec say that the minimum required texture size is 256x256? So to be 100% correct you should always check for support when creating textures larger than that.
Personally, I do this anyway - it's just adding a line or two of code to your startup checks.
You can load any size texture you want with D3DXCreateTextureFromFile(). It will automatically resize them if the hardware doesn't support textures of that size. The same goes for non square and non power of two textures.

That eliminates a lot of the testing you would otherwise need to do, but it can make things look ugly, especially 2D textures used as 2D sprites. However since any modern card will support decent sized textures I wouldn't worry too much about it - the chances are there will be performance and other problems if the hardware doesn't support big textures.
Quote:Original post by Adam_42
You can load any size texture you want with D3DXCreateTextureFromFile(). It will automatically resize them if the hardware doesn't support textures of that size. The same goes for non square and non power of two textures.

That eliminates a lot of the testing you would otherwise need to do, but it can make things look ugly, especially 2D textures used as 2D sprites. However since any modern card will support decent sized textures I wouldn't worry too much about it - the chances are there will be performance and other problems if the hardware doesn't support big textures.
What happens if you try to load a 8192x8192 texture on a card that only supports up to 2048x2048? Does D3DX only load the top 2048x2048 of it, or does it downsize the whole thing to 2048x2048 (I don't have an SDK to test here)?
Quote:Original post by Evil Steve
Quote:Original post by Adam_42
You can load any size texture you want with D3DXCreateTextureFromFile(). It will automatically resize them if the hardware doesn't support textures of that size. The same goes for non square and non power of two textures.

That eliminates a lot of the testing you would otherwise need to do, but it can make things look ugly, especially 2D textures used as 2D sprites. However since any modern card will support decent sized textures I wouldn't worry too much about it - the chances are there will be performance and other problems if the hardware doesn't support big textures.
What happens if you try to load a 8192x8192 texture on a card that only supports up to 2048x2048? Does D3DX only load the top 2048x2048 of it, or does it downsize the whole thing to 2048x2048 (I don't have an SDK to test here)?


In general D3DX scale to the target size.
Quote:Original post by Demirug
In general D3DX scale to the target size.
Not for np2 textures though - they load the image into the top left corner of the texture and fill the rest with black.
Quote:Original post by Evil Steve
Quote:Original post by Demirug
In general D3DX scale to the target size.
Not for np2 textures though - they load the image into the top left corner of the texture and fill the rest with black.

Only if you ask it nicely via a flag, otherwise it stretches it and makes it ugly.
Quote:Original post by Evil Steve
Quote:Original post by Demirug
In general D3DX scale to the target size.
Not for np2 textures though - they load the image into the top left corner of the texture and fill the rest with black.


No I'm 99% sure it will upscale the image, at least under default settings.

This topic is closed to new replies.

Advertisement