Often TextureState changing and performance

Started by
1 comment, last by jollyjeffers 18 years, 9 months ago
Is it too slow to often change TextureState and SetTexture? Some of my meshs have one set of UVs, and some more, and for each mesh (or for every subset of mesh) i set Material, Texture, TextureState (mostly, becuase my models can have up to 2 set of UVs and different blending ops)? And if it is slow, how to optimize this? ZThanks, Zaharije Pasalic
Advertisement
Well something isn't slower than beyond what it is possible to optimize, meaning that if you have to change you change, but as few times as possible.

Setting texturestage I believe is not so costy, the possible cost is the settexture which if used infrequently during a render can be costy as the texture might have been removed from the graphicscard and needs to be sent again.

Try batching all renders that use a certain texture and then the different texturestates. Changing texture each time you get a new mesh or renderstate however is not optimal (but doesn't likely hurt extremely much either if you only render a couple of models)


You cannot judge performance without instrumentation [smile] - yes, it is usually found that changing texture's is an expensive operation, but how expensive and more importantly how much it affects YOUR application is near impossible to say. Load up 'PIX for Windows' and have a look at whats actually hurting you.

I noticed the other day that circlesoft put up a list of state change performance characteristics, maybe you want to have a look through those.

Syranide put it well - there is a limit at which you can't optimize, if you need to change your texture you should. What you want to look at is ways to reduce the number of times that you **need** to change that texture.

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement