Sign in to follow this  
Metus

the Internals of IDirect3DDevice-SetTexture

Recommended Posts

Metus    168
I'm in the basic optimization state of my engine at the moment and found out that SetTexture seems to be the biggest thief. Each scene in my planed space-shootergame will contain about 10-15 different textures (approx. 5-10Mb of texture data located in the video ram) and that isn't much on modern graphic adapters. my question: is there any way to cache textures so that SetTexture is neary free or does D3D manage that automatically when there is enough vram?

Share this post


Link to post
Share on other sites
Trip99    577
You should leave the management of the textures to D3D. You can give hints via the usage when creating the textures. Also you need to minimise SetTexture calls via batching by texture.

Share this post


Link to post
Share on other sites
Metus    168
Quote:
Original post by Trip99
You should leave the management of the textures to D3D. You can give hints via the usage when creating the textures. Also you need to minimise SetTexture calls via batching by texture.


Ahh.. I see that you misunderstood my question:
My space shooter will only need around 10Mb loaded texture at each level. Since these textures probably can be stored i vram on most of the graphic adapters of today. My Question was not about batching by texture or how D3D will manage the textures, but if there is some way to cache the textures in the vram so that SetTexture won't cause any hiccups to my rendering pipeline

Share this post


Link to post
Share on other sites
DrunkenHyena    805
If your textures are managed, then they'll be kept in video ram as long as there is sufficient room.

However, that does not make SetTexture free or even cheap. If you don't organize your geometry reasonably then you'll end up calling SetTexture more than you need to and it can impact your performance.

Share this post


Link to post
Share on other sites
DBX    178
The question would have to be Why do you think SetTexture is the biggest thief?

In general, changing textures is fairly expensive because you have to send a new batch to the card, and then the driver will have to do a load of stuff to get the hardware into the correct state for the textures you are switching to. The biggest overhead here is the new batch.

The textures are not uploaded each time though (if they are in video memory), you will get a simlar overhead if you do just change a vertex constant or something.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this